V1 and V2 errors and status codes
This page documents the HTTP status codes and the response formats you encounter when you call the V1 and V2 APIs. Successful responses and error responses use different shapes, so it helps to know both before you write error handling.
Deprecation notice
The API sends a custom X-Plytix-Deprecation header in the response when the endpoint you're calling is scheduled for deprecation soon. Log this header in your integration so you hear about a retirement before it happens.
HTTP status codes
The API uses a small subset of standard HTTP status codes, grouped by class:
| Status code | Meaning |
|---|---|
| 200 OK | The request has succeeded. The response body usually contains a representation of the resource. |
| 201 CREATED | The request has succeeded and a resource has been created. The response body usually contains a representation of the resource, and its location is available in the location header. |
| 202 ACCEPTED | The request has been accepted but will be completed at some point in the future. |
| 204 NO CONTENT | The request has been fulfilled. There's no response body. |
| Status code | Meaning |
|---|---|
| 400 BAD REQUEST | The request has invalid syntax. |
| 401 AUTH FAILED | The request lacks valid authentication credentials for the target resource. |
| 403 FORBIDDEN | The server understood the request but refuses to authorize it. |
| 404 NOT FOUND | The requested resource hasn't been found on the server. |
| 405 METHOD NOT ALLOWED | The HTTP method isn't allowed on the target resource. |
| 409 CONFLICT | The server understood the request, but it has no effect on the current state of the resource. |
| 422 UNPROCESSABLE ENTITY | The request is syntactically well formed but has semantic errors. |
| 428 PRECONDITION REQUIRED | The request can't be processed because some conditions aren't met. |
| 429 TOO MANY REQUESTS | The API rate limit has been exceeded. |
| Status code | Meaning |
|---|---|
| 500 SERVER ERROR | The server wasn't able to fulfill the request. You can repeat the request later. |
On search endpoints, 422 means the search itself is invalid, and 428 means the search matches too many records to sort. See Filtering and search for the exact rules.
Successful response format
A successful response wraps its results in a data list. A single record still comes back as a list with one item, and a request that matches nothing returns an empty list.
{
"data": [
{
"id": "123456789012345678901234",
"filename": "example.pdf",
"file_size": 30358
}
]
}{
"data": []
}Search responses add a pagination object next to data. See Pagination.
Error response format
When an operation fails, the response contains an error object instead of data. The error object has these fields:
| Field | Type | Required | Description |
|---|---|---|---|
msg | string | Yes | A general error message. |
errors | array | No | Detailed information about each problem. Present when more than one field is at fault. |
Each entry in errors has two fields:
| Field | Type | Description |
|---|---|---|
field | string | The offending column, attribute, or field. |
msg | string | A detailed message about the problem. |
A simple error carries only msg:
{
"error": {
"msg": "Missing Authorization Header"
}
}A detailed error lists each field that failed validation:
{
"error": {
"msg": "product data validation failed",
"errors": [
{
"field": "some_non-existing_attribute_to_patch",
"msg": "label does not exist"
},
{
"field": "some_decimal_number_attribute_to_patch_using_wrong_number_format",
"msg": "Not a valid decimal value. Format must be: ."
}
]
}
}V1 and V2 authentication
Reference for getting a bearer token and using it on V1 and V2 requests, including how long a token stays valid and the errors you can get.
V1 and V2 rate limits
Reference for how rate limits work on V1 and V2, what happens when you exceed them, and where to find the limits for your plan.