Pagination

Overview

General information about the pagination is listed in Results Pagination topic.

Examples of pagination usage with cURL requests.

Using pagination in cURL requests

This tutorial requires prior knowledge of compiling and executing POST requests in Clean Employee API.

Use parameter x-next-page-after to retrieve a second page of IDs.

  1. Navigate to the Headers section and click it:

  1. Find the following information: – x-next-page-after x-total-pages x-total-results

  2. Add parameter ?after={x-next-page-after} to the POST request to see the next results page

  3. Execute the request, and you will see the next page in the Body section:

[
1000,
1001,
3000,
4004
]

Pagination using sorting

Pagination using ID sorting has similar x-next-page-after format, but the last updated date is excluded.

Pagination usage example (cURL request in Postman)

  1. Add parameter ?after={x-next-page-after} to the POST request: Refer to the example below for the exact parameter placement:

Pagination (sorted by id)
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/employee_clean/search/es_dsl?after=25828893'\
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "query": {
      "bool": {
         "should": [
            {
               "query_string": {
                  "query": "Python",
                  "default_field": "description",
                  "default_operator": "and"
               }
            },
            {
               "query_string": {
                  "query": "Python",
                  "default_field": "job_title",
                  "default_operator": "and"
               }
            },
            {
               "nested": {
                  "path": "experience",
                  "query": {
                     "bool": {
                        "should": [
                           {
                              "query_string": {
                                 "query": "Python",
                                 "default_field": "experience.description",
                                 "default_operator": "and"
                              }
                           },
                           {
                              "query_string": {
                                 "query": "Python",
                                 "default_field": "experience.title",
                                 "default_operator": "and"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   },
       "sort": [
        "id"
    ]
}'

Send the request, and you will see the next page in the (Response) Body.


Pagination using score sorting has a different ID format. The format difference is seen by the x-next-page-after parameter, showing the score, the last updated date, and the last ID on the page.

Pagination usage example (cURL request in Postman)

Add parameter ?after={x-next-page-after} to the POST request to see the next results page. Refer to the example below for the exact parameter placement:

Pagination (sorted by score)
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/employee_clean/search/es_dsl?after=27.780201,"2025-02-14T00:00:00.000Z",645866204'\
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "query": {
      "bool": {
         "should": [
            {
               "query_string": {
                  "query": "Python",
                  "default_field": "description",
                  "default_operator": "and"
               }
            },
            {
               "query_string": {
                  "query": "Python",
                  "default_field": "job_title",
                  "default_operator": "and"
               }
            },
            {
               "nested": {
                  "path": "experience",
                  "query": {
                     "bool": {
                        "should": [
                           {
                              "query_string": {
                                 "query": "Python",
                                 "default_field": "experience.description",
                                 "default_operator": "and"
                              }
                           },
                           {
                              "query_string": {
                                 "query": "Python",
                                 "default_field": "experience.title",
                                 "default_operator": "and"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   },
       "sort": [
        "_score"
    ]
}'

Send the request, and you will see the next page in the (Response) Body.

Limiting search results per page

Query parameter ?items_per_page={int} allows you to specify the number of results retrieved per Search results page. The current limit is 1,000. Thus, this parameter lets you set a smaller limit value for the results page.

Items per page
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/employee_clean/search/es_dsl?items_per_page=500'\
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "query": {
      "bool": {
         "should": [
            {
               "nested": {
                  "path": "experience",
                  "query": {
                     "bool": {
                        "should": [
                           {
                              "query_string": {
                                 "query": "social",
                                 "default_field": "experience.description",
                                 "default_operator": "and"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      }
   }
}'

Last updated

Was this helpful?