Request Errors
In the event of API request errors, AfterShip uses conventional HTTP response codes in 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 (E.g., you omitted a required parameter or a charge failed), and codes in the 5xx range indicate an error related to AfterShip’s servers.
HTTP Status Code Summary
HTTP Status Code | meta.code | meta.type | Sample Error Message |
---|---|---|---|
400 | 400 | BadRequest | The request body is an invalid JSON. |
401 | 401 | Unauthorized | The API key is invalid. |
403 | 403 | Forbidden | The request is understood, but it has been refused or access is not allowed. |
404 | 404 | NotFound | The URI requested is invalid or the resource requested does not exist. |
409 | 409 | Conflict | The request conflicts with another request (perhaps due to using the same idempotent key). |
422 | 422 | UnprocessableEntity | The data given in the request failed validation. Inspect the response for details. |
500 | 500 | InternalError | Something went wrong on AfterShip's end. Also, some error that cannot be retried happened on an external system that this call relies on. |
422 | 10001 | UnprocessableEntity | The account with the given email does not exist in the system. |
422 | 10002 | UnprocessableEntity | Role does not exist. |
422 | 10003 | UnprocessableEntity | No available member seats. |
Examples
Invalid API key
preparing...
Unprocessable Entity
preparing...
Internal Server Error
preparing...