TIC

The LENS API uses two pagination patterns depending on the endpoint type:

  • Offset-based (AG-Grid model) - used by POST endpoints that return tabular data. Covered in detail on this page.
  • page/per_page - used by the /search-public/* endpoints. See the Public Search group for query-string parameters.

Offset-based pagination

Tabular endpoints (companies at an address, watchlist members, person companies, etc.) accept a POST request whose JSON body specifies the row range, sort order, and filters.

Request body

{
  "startRow": 0,
  "endRow": 50,
  "sortModel": [
    { "colId": "companyName", "sort": "asc" }
  ],
  "filterModel": {}
}
Field Type Description
startRow int Zero-based index of the first row to return: 0 for the first page, then the previous answer’s nextStartRow
endRow int Zero-based index of the row after the last row (exclusive)
sortModel array Optional. Sorting instructions - see Sorting
filterModel object Optional. Server-side filters - see Filtering

The page size is endRow - startRow. For example, startRow: 0, endRow: 50 returns the first 50 rows. If endRow is left out, or is not above startRow, the page has 100 rows. The screening endpoints return at most 500 rows per page.

Response

{
  "success": true,
  "rows": [ ... ],
  "lastrow": -1,
  "hasMore": true,
  "nextStartRow": 100
}
Field Type Description
success bool Always true for a page. Errors come as an HTTP status code
rows array The rows of the page
hasMore bool true when the page is full, so more rows may follow
nextStartRow int The startRow of the next page. Left out on the last page
lastrow int AG Grid’s value: -1 while more rows may follow; on the last page, the total number of rows

hasMore and nextStartRow are the simplest way to page. lastrow says the same thing in the form AG Grid’s server-side row model expects, for integrations that use AG Grid.

How to paginate

Start at startRow: 0 and request pages until hasMore is false, each one from the previous answer’s nextStartRow:

  • hasMore: true - request the next page from nextStartRow
  • hasMore: false - this is the last page, and lastrow is the total number of rows

The total number of rows is known only on the last page. When the last page is exactly full, the API cannot tell that no more rows follow: it answers hasMore: true, and the next page has no rows and hasMore: false.

Example - fetch all rows in pages of 100:

# Page 1
curl -X POST "https://lens-api.tic.io/addresses/12345/companies" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "startRow": 0, "endRow": 100 }'
# → 100 rows, hasMore: true, nextStartRow: 100

# Page 2
curl -X POST "https://lens-api.tic.io/addresses/12345/companies" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "startRow": 100, "endRow": 200 }'
# → 42 rows, hasMore: false, lastrow: 142 (142 rows in all)

The same as a loop:

const rows = []
let startRow = 0
while (startRow !== undefined) {
  const response = await fetch('https://lens-api.tic.io/addresses/12345/companies', {
    method: 'POST',
    headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
    body: JSON.stringify({ startRow, endRow: startRow + 100 })
  })
  const page = await response.json()
  rows.push(...page.rows)
  startRow = page.nextStartRow // left out on the last page
}

Sorting

Add a sortModel array to sort by one or more columns:

{
  "startRow": 0,
  "endRow": 50,
  "sortModel": [
    { "colId": "companyName", "sort": "asc" }
  ]
}
Field Type Values
colId string Column name to sort by
sort string asc or desc

Filtering

Add a filterModel object to filter results server-side. Each key is a column name; the value describes the filter.

Text filter

{
  "filterModel": {
    "companyName": {
      "type": "contains",
      "filter": "Volvo",
      "filterType": "text"
    }
  }
}

Number filter

{
  "filterModel": {
    "numberOfEmployees": {
      "type": "greaterThan",
      "filter": 100,
      "filterType": "number"
    }
  }
}

Date range filter

{
  "filterModel": {
    "registrationDate": {
      "type": "inRange",
      "dateFrom": "2024-01-01",
      "dateTo": "2024-12-31",
      "filterType": "date"
    }
  }
}

Set filter (match any of the values)

{
  "filterModel": {
    "localCompanyCode": {
      "filterType": "set",
      "values": ["AB", "HB"]
    }
  }
}

Multiple conditions on the same column

{
  "filterModel": {
    "numberOfEmployees": {
      "operator": "AND",
      "filterType": "number",
      "conditions": [
        { "type": "greaterThan", "filter": 10, "filterType": "number" },
        { "type": "lessThan", "filter": 500, "filterType": "number" }
      ]
    }
  }
}

Supported filter operators

Operator Types Description
equals text, number Exact match
notEqual text, number Not equal
contains text Substring match
startsWith text Starts with
endsWith text Ends with
greaterThan number, date Greater than
lessThan number, date Less than
inRange date Between dateFrom and dateTo (inclusive)
blank all Value is null
notBlank all Value is not null

Combining conditions

Use the operator field with "AND" or "OR" to combine multiple conditions on the same column.

Endpoints using this pattern

These POST endpoints accept the pagination request body described above:

Endpoint Description
POST /addresses/{id}/companies Companies at an address
POST /addresses/{id}/workplaces Workplaces at an address
POST /addresses/{id}/persons Persons at an address
POST /addresses/se/{uuid}/companies Companies at an address, by Lantmäteriet UUID
POST /addresses/se/{uuid}/workplaces Workplaces at an address, by Lantmäteriet UUID
POST /addresses/se/{uuid}/persons Persons at an address, by Lantmäteriet UUID
POST /properties/se/{uuid}/companies Companies at a property
POST /properties/se/{uuid}/workplaces Workplaces at a property
POST /companies/{id}/assignments Roles the company holds in other companies
POST /companies/{id}/assignments/history The company’s ended roles in other companies
POST /companies/assignments Positions several companies hold in other companies
POST /companies/{id}/vehicles Vehicles the company is registered on now
POST /companies/{id}/vehicles/history Earlier vehicle registrations of the company
POST /persons/{id}/companies Companies where person is a representative
POST /persons/{id}/beneficial-owners Beneficial ownership positions
POST /watchlists/{id}/companies Company members of a watchlist
POST /watchlists/{id}/persons Person members of a watchlist
POST /watchlists/{id}/addresses Address members of a watchlist
POST /watchlists/{id}/properties Property members of a watchlist
POST /watchlists/{id}/vehicles Vehicle members of a watchlist
POST /watchlists/{id}/events Watchlist events
POST /screening/{screeningId}/subjects/{subjectId}/hits A subject’s screening hits (at most 500 per page)
POST /screening/history Screenings (at most 500 per page)
POST /payment-controls Parsed payment controls
POST /payment-controls/{id}/intents Payment intents of a payment control
POST /payment-controls/imports Payment-control imports
POST /orders Your document orders
POST /team/orders Team document orders
POST /team/exports Team exports