Pagination

The API supports pagination to manage large sets of data efficiently. Different endpoints support different pagination methods:

Standard Pagination

Both /api/company/search and /api/company/export support standard pagination using:

  • page: The page number to retrieve. Defaults to 1 if not provided.
  • pageSize: The number of records to return per page.

Search Endpoint (/api/company/search)

  • Defaults to 25 records per page
  • Maximum pageSize is 50
  • Maximum total records retrievable: 50

Export Endpoint (/api/company/export)

  • Defaults to 25 records per page
  • Recommended pageSize: 100-1000
  • Maximum total records retrievable: 10,000 with standard pagination

Scroll Pagination (Export Endpoint Only)

The /api/company/export endpoint also supports scroll pagination for unlimited record retrieval:

  • useScroll=true: Enable scroll pagination mode
  • scrollId: Use the scroll ID from previous response for subsequent requests
  • Unlimited records: No maximum record limit
  • Time-limited: Scroll context expires after 8 minutes

For detailed information and examples, see the Company Export documentation.

Response Structure

Standard pagination returns records nested under data.records:

{
  "data": {
    "records": [ /* company objects */ ],
    "totalCount": 1250
  },
  "page": 1,
  "pageSize": 25,
  "totalPages": 50
}

Scroll pagination returns records directly in data (not data.records):

{
  "data": [ /* company objects */ ],
  "scrollId": "abc123xyz456",
  "hasMoreRecords": true,
  "pageSize": 1000,
  "totalRecords": null
}

How Standard Pagination Works

  • Calculation of from: The from parameter is calculated as (page - 1) * pageSize. This determines the starting point of the records to be retrieved for the specified page.

  • Total Count and Pages:

  • The total number of records (totalCount) is determined from the search query results.

  • The total number of pages (totalPages) is calculated by dividing totalCount by pageSize and rounding up.

Example Request

To request the second page of results with 10 records per page:

curl -G https://app.companydata.com/api/company/search \
  -H "x-api-key: {ApiKey}" \
  -d "page=2&pageSize=10"

Was this page helpful?