Status codes and error codes
HTTP status codes and business error codes shared by the imgrender API
HTTP status codes
| HTTP status code | Description | Suggested action |
|---|---|---|
200 | Success | |
400 | Request failed | This is usually because the request parameters are invalid. Check the request parameters against the message. |
401 | Authentication failed | Check that the API key is set correctly. |
403 | Request rejected | The server received the request, but rejected it because of a business restriction. Follow the message. |
404 | Resource not found | Check the request parameters. |
429 | Rate limited | Lower the request rate. |
500 | System error | Something went wrong on the server. Contact support. |
Common error codes
The following are common error codes. Error codes specific to an API are documented on that API's page.
| Error code | HTTP status code | Description | Suggested action |
|---|---|---|---|
0 | 200 | Success | |
10101 | 500 | System error | Something went wrong on the server. Contact support. |
10102 | 429 | Rate limited | QPS is too high. Lower the request rate. |
10103 | 400 | Invalid parameters | Check the request parameters against the message. |
10104 | 401 | Authentication failed | Check that the API key is set correctly and is still valid. |
10105 | 403 | Operation forbidden | The request was rejected because of a business restriction. Follow the message. |
10106 | 403 | Duplicate operation | The request is a duplicate. Retry shortly. |
10107 | 404 | Resource not found | Check the request parameters. |
30101 | 403 | Insufficient resources | Check that the account has enough credits. |
Error response body
A failed response includes an error object in addition to code and message. A successful response does not include this field.
{
"code": 10105,
"message": "Try again in 30 seconds",
"error": {
"name": "captcha.cooldown",
"params": { "seconds": 30 }
}
}| Field | Type | Description |
|---|---|---|
code | integer | Error category. See the table above for values. |
message | string | English error message that can be shown to users directly. |
error.name | string | Stable error name, written as lowercase dot-separated English. Different scenarios under the same error code use different names. |
error.params | object | Interpolation parameters for the message. Omitted when there are no parameters. |
When your code needs to branch by scenario, match error.name. Matching the message text is unreliable. Once published, an error.name keeps its meaning; the wording of message may change.
Common error.name values for the Open API:
| error.name | Error code | Description |
|---|---|---|
system.validation_failed | 10103 | Request parameter validation failed. See message for details. |
apikey.missing | 10104 | No API key was set. |
apikey.invalid_format | 10104 | The API key format is invalid. |
apikey.invalid | 10104 | The API key does not exist, or the key is incorrect. |
apikey.revoked | 10104 | The API key is no longer valid. Replace it. |
credits.insufficient | 30101 | Not enough credits are available. |
template.not_found | 10107 | The template does not exist. |
template.not_published | 10112 | The template is not published or has been archived. |
render.failed | 20105 | Image rendering failed. |
blueprint.* | 10103 | Blueprint parameter validation failed. See message for details. |