Pagination
Search endpoints return paginated results. This guide explains how to navigate through result pages using cursor-based pagination.
The WebsiteData API uses cursor-based pagination via the search_after parameter. This approach is efficient for large datasets and ensures consistent results even as the underlying data changes.
How it works
When you make a search request, the response includes a search_after array that acts as a cursor for the next page. Pass this value back in your next request to get the following page of results.
Response fields
- Name
results- Type
- array
- Description
Array of matching records for the current page.
- Name
search_after- Type
- array
- Description
Cursor value to pass in the next request to get the next page. Absent when there are no more results.
- Name
total- Type
- integer
- Description
Total number of matching records across all pages.
Request parameters
- Name
pageSize- Type
- integer
- Description
Number of results per page. Maximum depends on your plan.
- Name
searchAfter- Type
- array
- Description
Cursor from a previous response to fetch the next page.
First page
curl -s -X POST https://websitedata.app/json/api/v1/domain/search \
-H "Authorization: Bearer {your-api-key}" \
-H "Content-Type: application/json" \
-d '{"pageSize": 2}'
Response
{
"results": [
{"name": "wordpress.org", "rank": 1},
{"name": "creativecommons.org", "rank": 2}
],
"search_after": [2, 36411284],
"total": 879083
}
Next page
curl -s -X POST https://websitedata.app/json/api/v1/domain/search \
-H "Authorization: Bearer {your-api-key}" \
-H "Content-Type: application/json" \
-d '{"pageSize": 2, "searchAfter": [2, 36411284]}'