Response Format
How SP-API returns response headers and messages.
In response to an HTTP request, the Selling Partner API returns response headers and a JSON response message.
The following table lists the response headers you may receive. The actual headers you receive will depend on the specific API section and operation.
Response headers
Name | Description | Example |
---|---|---|
Connection | Default value keep-alive for a persistent connection with the client. | Connection: keep-alive |
Content-Length | Standard HTTP response header. | Content-Length: 624 |
Content-Type | Standard HTTP response header. | Content-Type: application/json |
Date | Standard HTTP response header. | Date: Fri, 17 Feb 2023 20:13:55 GMT |
x-amz-apigw-id | Extended request ID created by APIGateway. This header is optional and may not be returned. | x-amz-apigw-id: Ac1E1EycvHcFyNw= |
x-amzn-ErrorType | APIGateway populates this error with the errorType if the response status code is 4xx or 5xx. This header is optional and may not be returned. | x-amzn-ErrorType: AccessDeniedException |
x-amzn-RateLimit-Limit | Returns the rate limit applied to the request. This header is returned on a best-effort basis and only for specific HTTP responses. Refer to Usage Plans and Rate Limits in the SP-API for more information. | x-amzn-RateLimit-Limit: 2.0 |
x-amzn-RequestId | Request identifier. Provide this if you contact us for support. | x-amzn-RequestId: 6875f61f-6aa1-11e8-98c6-9bExample |
X-Amzn-Trace-Id | A trace identifier generated by APIGateway. This header is optional and may not be returned. | X-Amzn-Trace-Id: Root=1-63ee9bb8-52ea8e6d108209842abc2a4d |
Success response
If your request is successful, the Selling Partner API returns the data requested. Here is an example of a successful response:
HTTP/1.1 200 OK
Content-Length: 368
Content-Type: application/json
Date: Thu, 01 Jun 2020 22:23:31 GMT
x-amzn-RequestId: 6875f61f-6aa1-11e8-98c6-9bExample
{
"payload": {
"ConfirmedNeedByDate": "2020-04-23",
"ConfirmedFulfillableDate": "2020-04-23"
}
}
Error response
If your request is unsuccessful, the Selling Partner API returns an error response. Here are the elements of the response message in an error response:
Response message
Element | Description | Required |
---|---|---|
code | HTTP status code. | Yes |
message | Explanation of the error condition. | Yes |
details | Link to additional information. | No |
Here is an example of an error response:
HTTP/1.1 400 Bad Request
Content-Length: 117
Content-Type: application/json
Date: Fri, 01 Jun 2020 21:48:02 GMT
x-amzn-ErrorType: ValidationException
x-amzn-RequestId: a8c8d99a-6ab5-11e8-b0f8-19363980175b
{
"errors": [
{
"message": "Access to requested resource is denied.",
"code": "Unauthorized",
"details": "Access token is missing in the request header."
}
]
}
Updated about 1 month ago