Request Errors
In the event of API request errors, AfterShip uses conventional HTTP response codes within the 4XX and 5XX range to indicate the reason behind the error along with the error code already defined in the response body.
In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error caused by the given information (such as missing required parameters or failed charges), and codes in the 5xx range indicate errors related to AfterShip’s servers.
For non-generic error codes, AfterShip employs a range from 10000 to 99999 (a total of 90000 codes) to define specific codes, offering finer granularity for each HTTP status. The first bit of the meta.code identifies the module, while the second and third digits collectively identify the category of the error cause, and the fourth and fifth digits collectively locate the specific cause of the error.
Module | bit 1 of meta.code |
---|---|
common | 1 |
recommendation | 2 |
search | 3 |
tagging | 4 |
HTTP Status Code Summary
HTTP Status Code | meta.code | meta.type | Sample Error Message |
---|---|---|---|
200 | 200 | OK | The request has been processed successfully. |
400 | 400 | BadRequest | The request body JSON payload is invalid. |
401 | 401 | Unauthorized | The API key is invalid. |
403 | 403 | Forbidden | Access forbidden. |
429 | 429 | TooManyRequests | You have exceeded the API call rate limit. The default limit is 10 requests per second. |
500 | 500 | InternalError | Something went wrong on AfterShip's end. |
422 | 422 | UnprocessableEntity | Invalid request parameters. |
422 | 40000 | UnprocessableEntity | Unable to predict tags and category from the product content. |
Examples
Invalid API key
preparing...
Invalid Request Parameters
Unable to predict tags and category from the product content
preparing...