Skip to main content

Overview

The KDP API uses cursor-based pagination for endpoints that return large collections of data. This approach provides consistent results even when data is being added or removed.

How It Works

Paginated endpoints accept the following query parameters:
  • limit - Number of items to return (default: 20, max: 100)
  • starting_after - Cursor for forward pagination
  • ending_before - Cursor for backward pagination
You cannot use both starting_after and ending_before in the same request.

Response Format

Paginated responses include a metadata object:
  • hasMore - Indicates if there are more results available
  • count - Number of items in the current page

Examples

First Page

Next Page

Use the last item’s ID from the previous response as starting_after:

Previous Page

Use the first item’s ID from the current page as ending_before:

Implementation Example

TypeScript

Python

Best Practices

  1. Use consistent limits: Keep the same limit value when paginating through results
  2. Handle empty results: Check if the data array is empty before accessing items
  3. Store cursors: Save pagination state to resume later if needed
  4. Respect rate limits: Add delays between requests for large datasets
  5. Use appropriate page sizes: Balance between number of requests and response size