Paginating through the Search API

Instructions on how to use Crunchbase's Search API endpoints

How do I paginate to the next page?

API 4.0 now uses keyset pagination to retrieve the next set of results. It will enable you to traverse our dataset faster, and it will also mitigate the performance deprivation that would occur paginating deep into a collection using API 3.1. Additionally, keyset pagination also helps ensure that you will never miss an entity since the keys remain constant even when the set changes.

To paginate to the next page:

  • Include "after_id" in your body response and the uuid of the last item in your current page
  • ex: "after_id": "5972288b-8188-475a-b153-1b6eb4d57fb1"

To paginate to the previous page:

  • Include "before_id" in your body response and the uuid of the first item in your current page

Below is an example:

--Body Request: Next Page--
{
    "field_ids": [
        "identifier",
        "announced_on",
        "funded_organization_identifier",
        "money_raised",
        "investment_type"
    ],
    "query": [
        {
            "type": "predicate",
            "field_id": "money_raised",
            "operator_id": "gte",
            "values": [
            	{"value": 10000000, "currency": "usd"}
            ]
        }
    ],
    "limit": 100,
    "after_id": "52e7351a-7744-4ca6-b0df-d39a31740fbc"
}

--Body Request: Previous Page--
{
    "field_ids": [
        "identifier",
        "announced_on",
        "funded_organization_identifier",
        "money_raised",
        "investment_type"
    ],
    "query": [
        {
            "type": "predicate",
            "field_id": "money_raised",
            "operator_id": "gte",
            "values": [
            	{"value": 10000000, "currency": "usd"}
            ]
        }
    ],
    "limit": 100,
    "before_id": "6bc24ac4-e062-458b-b70c-b4cb5918439c"
}

📘

Processing Entire Collections

An alternative to paginating through an entire collection via the Search API is to use the Complete Node List export. This alleviates the need to paginate and may work better if you prefer to work with CSV files.