Amazon Services
Amazon Marketplace Web Service (Amazon MWS) Documentation

Deprecation Notice:

Amazon Marketplace Web Service (MWS) will no longer be available after March 31, 2024. All MWS developers must migrate to Selling Partner API (SP-API) to avoid service disruptions. Refer to the Migration Hub for more information.

Amazon MWS Documentation

Using NextToken to request additional pages

If you make a request to Amazon Marketplace Web Service (Amazon MWS) that generates more response elements than the maximum number of response elements that can be returned per page, you can submit NextToken with a "ByNextToken" operation to request additional pages. NextToken works slightly differently for the various Amazon MWS API sections.

Using NextToken

Using NextToken with operations that return HasNext

  1. Call an operation.

    If the HasNext response element returns false, there are no more response elements to return. Task is complete.

    OR

    If the HasNext response element returns true, there are more response elements to return. Continue to Step 2.

  2. Call the "ByNextToken" operation that matches the operation you called in Step 1 (for example, call GetReportListByNextToken if you called GetReportList) and include the NextToken value returned in Step 1.

    If the HasNext response element returns false, there are no more response elements to return. Task is complete.

    OR

    If the HasNext response element returns true, there are more response elements to return. Continue to Step 3.

  3. Continue calling the "ByNextToken" operation until the HasNext response element returns false.

Using NextToken with operations that return MoreResultsAvailable

  1. Call an operation.

    If the MoreResultsAvailable response element returns false, there are no more response elements currently available. However, more results might be available in the future. Continue to Step 2 at some point in the future. The amount of time to wait depends on your business processes and on how often you expect the operation to return new results.

    OR

    If the MoreResultsAvailable response element returns true, there are more response elements to return now. Continue to Step 2.

  2. Call the "ByNextToken" operation that matches the operation you called in Step 1 (for example, call ListCustomersByNextToken if you called ListCustomers) and include the NextToken value returned in Step 1.

    If the MoreResultsAvailable response element returns false, there are no more response elements currently available. However, more results might be available in the future. Continue to Step 3 at some point in the future. The amount of time to wait depends on your business processes and on how often you expect the operation to return new results.

    OR

    If the MoreResultsAvailable response element returns true, there are more response elements to return now. Continue to Step 3.

  3. Continue calling the "ByNextToken" operation until the MoreResultsAvailable response element returns false. Then, wait for a period of time before you call the "ByNextToken" operation again. The amount of time to wait depends on your business processes and on how often you expect the operation to return new results.

Using NextToken with operations that do not return HasNext or MoreResultsAvailable

  1. Call an operation.

    If the NextToken response element is not returned, there are no more response elements to return. Task is complete.

    OR

    If the NextToken response element is returned, there are more response elements to return. Continue to Step 2.

  2. Call the "ByNextToken" operation that matches the operation you called in Step 1 (for example, call ListOrdersByNextToken if you called ListOrders) and include the NextToken value returned in Step 1.

    If the NextToken response element is not returned, there are no more response elements to return. Task is complete.

    OR

    If the NextToken response element is returned, there are more response elements to return. Continue to Step 3.

  3. Continue calling the "ByNextToken" operation until the NextToken response element is no longer returned.

Handling errors with NextTokens

If you ever submit a NextToken to a "ByNextToken" operation and the service returns a NextTokenCorrupted error, do not attempt to repeat the call with the same NextToken. Instead, call the operation that originally created the NextToken to get a new NextToken.

For example, if you call the ListOrdersByNextToken operation and you receive a NextTokenCorrupted error, call the ListOrders operation to generate a new NextToken. You can then pass this new NextToken to the ListOrdersByNextToken operation.