---
title: Amazon SP API Pagination
date: 2025-12-11T06:13:34Z
modified: 2025-12-15T05:18:42Z
permalink: "https://ezintegrations.ai/docs/pagination-for-amazon-sp-api/"
type: docs
status: publish
excerpt: ""
wpid: 3909
doc_category:
  - Pagination examples
author: Automation Hub
---

#### Pagination for Amazon SP API

This example demonstrates **custom pagination** using a `nextToken` returned in the API response .

---

#### API Response

![Amazon SP API Response](https://help.bizdata360.com/uploads/images/gallery/2025-09/scaled-1680-/z8Himage.png)

---

#### Custom Pagination for Amazon SP API

import base64

response_parameters = "['items']"
nextToken = api_response['pagination']['nextToken']

result1 = nextToken.rstrip("=")
skip_token = result1
---

#### Params

{
  "pageToken": "{%skip_token%}"
}
---

#### Pre-request Script

skip_token = ''
---

#### Explanation

- `api_response` → Refers to the complete JSON response returned by the API. 
    - `items` → Contains the actual product records.
    - `pagination.nextToken` → Token required to fetch the next page of results.
- The script removes trailing `=` characters from `nextToken` before assigning it to `skip_token`.
- The `pageToken` parameter dynamically uses `{%skip_token%}`.
- The pre-request script initializes `skip_token` as an empty string for the first API call.

## Topics

**Docs Categories:** [Pagination examples](https://ezintegrations.ai/wp-content/uploads/wp-mfa-exports/taxonomy/doc_category/pagination-examples.md)