Pagination

how to navigate large collections that expand multiple pages

Introduction

Some API responses may contain a large number of items. To efficiently handle this, the API uses a pagination system based on the page and size parameters, cursors, or offset/limit for more efficient pagination.


Link Response Structure

Requests that this list entries in a collection can require pagination to navigate a large number of entries.
When a request support pagination it will respond with a Link http header.

This header includes a link to "next" page of entries, unless on the last page (use this to determine the end of the collection).

Link: <https://api.securityscorecard.io/companies/example.com/...>; rel="next"

In some cases when a collection exceeds a certain size, we'll offer instead a report to asynchronously generate a dump of the entire collection.

An example of this is to Generate a Full Scorecard report to dump all issue findings on a scorecard.



Page and Size Pagination (/v2 history and findings)

The paginated /v2 history events, history findings and active findings endpoints take page and size query parameters and return the pagination state in the response body. They don't send a Link header.

ParameterTypeDefaultNotes
pageinteger11-based page number. Minimum 1.
sizeinteger100Number of entries per page. 0 to 500. 0 is a count-only request.

Other paginated endpoints, such as GET /v2/portfolios/{portfolio_id}/companies (page and limit), document their own parameters on their reference page.

Paginated Response Structure

{
  "entries": [
    // List of items on the current page
  ],
  "total": 250,     // Total number of entries matching the request, across all pages
  "page": 2,        // Page returned
  "size": 100,      // Page size requested
  "has_more": true  // true if more entries remain after this page
}

Requesting the First Page

GET /v2/companies/example.com/history/events?page=1&size=100

Example with cURL

curl -X GET "https://api.securityscorecard.io/v2/companies/example.com/history/events?page=1&size=100" -H "Authorization: Token YOUR_API_KEY"

Requesting the Next Page

Repeat the request with page incremented by 1:

GET /v2/companies/example.com/history/events?page=2&size=100

Detecting the End of the Collection

Stop paginating once has_more is false. A page past the end returns empty entries, not an error.

A size of 0 is a count-only request: it returns empty entries, a valid total and has_more: false.



Cursor-Based Pagination

For large collections, the API may use cursors instead of page and size, allowing for more efficient pagination and preventing skipped items.

Cursor-Based Response Structure

{
  "entries": [
    { "id": "abc123", "name": "Item 1" },
    { "id": "def456", "name": "Item 2" }
  ],
  "next_cursor": "ghi789"
}

Requesting the First Page with Cursors

GET /resource?limit=50

Example with cURL

curl -X GET "https://api.securityscorecard.io/resource?limit=50" -H "Authorization: Token YOUR_API_KEY"

Requesting the Next Page with Cursors

To get the next page, use the next_cursor returned in the previous response.

GET /resource?limit=50&cursor=ghi789

Example with cURL

curl -X GET "https://api.securityscorecard.io/resource?limit=50&cursor=ghi789" -H "Authorization: Token YOUR_API_KEY"

If next_cursor is not present in the response, it means you have reached the end of the collection.



Offset-Based Pagination (Issue Findings)

Some endpoints — including the issue findings paginated endpoint below — use offset and limit instead of page/size or cursors, and return the total match count directly in the response.

Example Endpoint

POST /companies/{scorecard_identifier}/issues/{issue_type}/paginated
📘

scorecard_identifier must be the scorecard's UUID for this endpoint, not a domain name. Passing a domain will return an error.

Query Parameters

ParameterTypeDefaultNotes
offsetinteger0Number of entries to skip. Minimum 0.
limitinteger100Number of entries to return. Minimum 1, maximum 500.

Requesting the First Page

POST /companies/80e01290-0fb4-5aaa-bd20-36fe5013edc6/issues/service_vuln_host_v3_high/paginated?offset=0&limit=500

Example with cURL

curl -X POST "https://api.securityscorecard.io/companies/80e01290-0fb4-5aaa-bd20-36fe5013edc6/issues/service_vuln_host_v3_high/paginated?offset=0&limit=500" \
  -H "Authorization: Token YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

API Response Example

{
  "entries": [
    // List of items on the current page
  ],
  "total_count": 98018,
  "has_more": true,
  "count": 500,
  "offset": 0,
  "limit": 500
}
  • total_count — total number of entries matching the query, across all pages.
  • has_more — true if more entries remain after this page.
  • count — number of entries returned in this page's entries array.
  • offset / limit — echoed back from the request.

Requesting the Next Page

Increment offset by the limit you requested:

POST /companies/80e01290-0fb4-5aaa-bd20-36fe5013edc6/issues/service_vuln_host_v3_high/paginated?offset=500&limit=500

Detecting the End of the Collection

Stop paginating once has_more is false in the response. Don't rely on entries being empty — check has_more directly.



Handling Large Data Volumes

If the collection exceeds a certain size limit, the API may provide an alternative mechanism, such as generating a full report for asynchronous download.

Generating a Full Report Example

POST /reports/full-dump

Example with cURL

curl -X POST "https://api.securityscorecard.io/reports/full-dump" -H "Authorization: Token YOUR_API_KEY"

Response Example

{
  "report_url": "https://api.securityscorecard.io/reports/12345/download",
  "status": "processing"
}

Once generated, you can download the report from report_url.


Best Practices

  • Always use the values returned in the response to determine if more pages are available — has_more for page-based and offset-based pagination, or next_cursor for cursor-based pagination.
  • Avoid manually constructing pagination URLs. Instead, always use the next_cursor provided in the response for cursor-based pagination, increment offset by limit for offset-based pagination, or increment the page parameter for page-based pagination. This ensures compatibility with any future API changes and prevents data inconsistencies.
  • Set an appropriate page size (size/limit, defaults and maximums vary by endpoint — see each endpoint's reference page) to balance performance and resource consumption.
  • Prefer cursor-based or offset-based pagination for large lists to improve efficiency and prevent inconsistencies.

By following this guide, you can efficiently handle API pagination and optimize data loading in your application.