Amazon Selling Partner API
website·Indexed 35 days ago
https://sp-api.apifox.cnDeveloper documentation and OpenAPI definitions for the Selling Partner API (SP-API), including the Feeds v2021-06-30 API, Fulfillment Outbound versions 2020-07-01 and 2026-07-04, grantless operations, and application client secret rotation.
What's inside Selling Partner API
- The Fulfillment Outbound dynamic sandbox allows developers to test Multi-Channel Fulfillment (MCF) workflows without affecting production data. While production order and package status transitions are driven by physical events (picking, packing, carrier scans), the sandbox provides programmatic control over these transitions using specific simulation operations. This enables end-to-end validation of integration logic for various order and package status scenarios.
Understand the Feed object in the Selling Partner API
The
Feedobject provides detailed information about a specific feed. It is used to track the lifecycle and status of a feed submission. Key properties include:feedId: Unique identifier for the feed (unique when combined with a seller ID).feedType: The type of feed submitted.marketplaceIds: A list of marketplace identifiers the feed applies to.createdTime: ISO 8601 timestamp of when the feed was created.processingStatus: The current state of the feed. Possible values are:IN_QUEUE: Waiting to be processed.IN_PROGRESS: Currently being processed.DONE: Processing complete. Check the result document for specific operation errors.CANCELLED: Cancelled before processing started.FATAL: Aborted due to a fatal error; some operations may have succeeded.
processingStartTime: ISO 8601 timestamp of when processing began.processingEndTime: ISO 8601 timestamp of when processing finished.resultFeedDocumentId: The identifier for the resulting feed document (unique when combined with a seller ID).
Understand the Feed object schema
The
Feedobject provides detailed metadata about a data upload. Key properties include:feedId: Unique identifier for the feed (unique when combined with seller ID).feedType: The type of feed being processed.marketplaceIds: List of marketplaces the feed applies to.createdTime: ISO 8601 timestamp of creation.processingStatus: Current state (e.g., DONE, IN_PROGRESS).processingStartTime/processingEndTime: ISO 8601 timestamps for the processing window.
Register an SQS queue for new client secrets
Before rotating a secret, you must configure where the new credential will be sent:
- Sign in to the Developer Console (via Solution Provider Portal, Seller Central 'Develop Apps', or Vendor Central 'API Integration').
- Navigate to Notification Preferences.
- On the Subscription page, locate the target application.
- In the Application Client New Secret row, enter the ARN or URL of the SQS queue intended to receive the new credential.
Rotate the Selling Partner API application client secret
To rotate your application's client secret, you must register an SQS queue to receive the new credentials, call the
rotateApplicationClientSecretoperation, and then retrieve the secret from the queue.Prerequisites:
- Access to the Developer Console.
- Access to Amazon SQS and a new SQS queue.
- The application's current client credentials.
Important Constraints:
- Credential rotation is only available for regular/production applications; it cannot be used with sandbox applications.
- The current credential used to call the rotation operation expires after seven days. You must update your credentials within this window to avoid application downtime.
Create a feed using the Selling Partner API
The
createFeedoperation is used to create a feed for processing data on behalf of a selling partner. A critical prerequisite is that the contents of the feed document must be uploaded to Amazon before calling this operation.Rate Limits:
- Default Rate: 0.0083 requests per second
- Burst: 15
- The
x-amzn-RateLimit-Limitresponse header provides the specific rate limits applied to the request.
Important Note: The rate limit for the
JSON_LISTINGS_FEEDfeed type is different from the generalcreateFeedoperation rate limit. Developers using JSON listings feeds should refer to the Building Listings Management Workflows Guide for specific throughput constraints.Create and complete a sandbox Fulfillment Outbound order
Follow these steps to test the end-to-end fulfillment process in the sandbox environment.
Prerequisites:
- Authorization from the selling partner.
- The 'Amazon Fulfillment' role assigned to your developer profile and selected in the App registration page.
Workflow:
- Create Order: Call the
createOrderoperation. - Verify Initial Status: Call
getOrderand verify the status isPROCESSING. - Update Status: Call
updateOrderStatuswith thestatusvalue set toCOMPLETE. - Verify Final Status: Call
getOrderand verify the status isCOMPLETE. - Update Packages: Use
updatePackagewith thepackageId(obtained fromgetOrder) to advance individual packages independently.
Execute grantless operations in the SP-API
Grantless operations are SP-API calls that do not require explicit authorization (a refresh token) from a selling partner. These operations are available only to seller applications. To call a grantless operation, request a Login with Amazon (LWA) access token and use thescopeparameter to specify the scope of the LWA authorization grant instead of providing a refresh token.Retrieve the rotated client secret from SQS
After calling therotateApplicationClientSecretoperation, the new client secret is sent to the pre-registered SQS queue. Use an Amazon SQS client and theReceiveMessageAPI to retrieve the message containing the new credentials.Integrate Fulfillment Outbound and FBA Inventory Sandboxes
You can combine the FBA Inventory and Fulfillment Outbound dynamic sandboxes to test specific SKUs and observe virtual inventory movements.
Workflow:
- Create inventory items using
createInventoryItemin the FBA Inventory sandbox. - Add stock using
addInventory. - Create Fulfillment Outbound orders referencing those specific SKUs.
Behavioral Note: When used together,
HOLDorders are initially created in theReceivedstate, andSHIPorders are created in thePlanningstate (unlessINVALID).- Create inventory items using
Create a feed using the SP-API createFeed operation
To create a feed in the Selling Partner API, you must provide aCreateFeedSpecificationobject. This operation requires that you have already calledcreateFeedDocumentto obtain aninputFeedDocumentIdand uploaded the feed contents to that document before callingcreateFeed.{ "feedType": "string", "marketplaceIds": ["string"], "inputFeedDocumentId": "string", "feedOptions": { "optionKey": "optionValue" } }Encode URLs for SP-API SKUs
To avoid errors when including SKUs in URLs, characters that are forbidden, non-ASCII, or have special meanings must be percent-encoded. This is done by converting each byte of the UTF-8 encoding of the character to a two-digit hexadecimal number preceded by a percent sign (%). For example, a backslash (\) is encoded as%5C.import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.io.UnsupportedEncodingException; // Method to encode a SKU using `UTF-8` encoding scheme private static String encodeSKU(String sSKU) { try { return URLEncoder.encode(sSKU, StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } }