API introduction
Responses and errors
On this page
Every answer is JSON and has the same shape.
Success#
A success answer has data and meta. A list also has links.
{
"data": {
"id": 3,
"name": "Sample Category",
"slug": "sample-category",
"sort": 1,
"archived": false,
"general": false,
"products_count": 12,
"created_at": "2026-10-01T09:00:00Z",
"updated_at": "2026-10-01T09:00:00Z"
},
"meta": {}
}{
"data": [
{
"id": 3,
"name": "Sample Category",
"slug": "sample-category",
"sort": 1,
"archived": false,
"general": false,
"products_count": 12,
"created_at": "2026-10-01T09:00:00Z",
"updated_at": "2026-10-01T09:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1,
"last_page": 1
},
"links": {
"first": "https://yourstore.example.com/api/v1/categories?page=1",
"last": "https://yourstore.example.com/api/v1/categories?page=1",
"prev": null,
"next": null
}
}- In a list,
metahaspage,per_page,totalandlast_page, andlinkshasfirst,last,prevandnext(nullwhen there is none). See Pagination. - In every other answer
metais an empty object{}. - Creating a product can add
meta.warnings: a list of points that did not stop the product from being created. - Dates are ISO 8601 in UTC (for example
2026-11-21T10:00:00Z); thecreated_atof an order is written with its UTC offset. Money is in whole units of the store's currency. Ids are whole numbers and never change. - Adding
?expand=fullto the original product and order calls adds more fields. See Versioning.
HTTP status codes#
| Status | Meaning |
|---|---|
200 | OK: the call worked. |
201 | Created: something new was made. These calls answer 201 when they succeed: POST /products, POST /products/{id}/variants, POST /inventory/adjustments, POST /orders/{number}/notes. (Adjusting stock answers 200 instead when the adjustment changed nothing.) |
401 | No key, or a key that is not valid, revoked or expired. |
403 | The key is paused, used from a blocked address, or lacks the scope for this call. |
404 | No such address, or no such product, order, size or other resource. |
405 | That method does not exist on that address. |
409 | Idempotency-Key problem, or a change that conflicts with the current state (for example the stock is not the number you expected). |
422 | The request was understood but refused: a field is missing or wrong, or a rule of the store stops it. error.fields says what to fix. |
429 | Too many requests. Wait for the Retry-After seconds. |
500 | Something went wrong on our side. Nothing is recorded as done unless a success answer says so; try again later. |
503 | The store could not reach its database for a moment (service_busy). Wait the seconds in the Retry-After header (10) and send the same request again. For POST and PATCH, send the same Idempotency-Key. |
Errors#
Every error has the same shape:
{
"error": {
"code": "validation_failed",
"message": "The request could not be accepted. See \"fields\" for what to fix.",
"fields": {
"hsn": [
"HSN 1234567 has 7 digits, so a leading zero was probably lost. Send it as 01234567 (an HSN code is 4, 6 or 8 digits). It is never padded automatically."
]
}
}
}codeis short and stable. Check it in your code.messagesays what went wrong in plain words. Show it to a person, not to your logic.fieldsappears for 422 and lists, for each field, what to fix.required_scopeappears for 403insufficient_scopeand names the scope the key is missing.
Good to know
One answer is shaped differently. When the store cannot reach its database for a moment, the answer is 503 with a Retry-After: 10 header and the body {"error": "service_busy", "message": "..."}: here error is a plain word, not an object. Read the HTTP status first; treat any 503 as "try again shortly".
Error codes#
| Code | HTTP status | Meaning |
|---|---|---|
missing_api_key | 401 | No key was sent. Use "Authorization: Bearer KEY" or the X-Api-Key header. |
invalid_api_key | 401 | The key is not valid. Check you copied all of it. |
revoked_api_key | 401 | The key was revoked in the admin. Create a new one. |
expired_api_key | 401 | The key passed its expiry date. |
api_key_disabled | 403 | The key is paused in the admin. |
ip_not_allowed | 403 | The key has an IP allow-list and your address is not on it. |
insufficient_scope | 403 | The key does not have the scope this call needs. error.required_scope names it. |
not_found | 404 | No such address, product, order, size or other resource. |
method_not_allowed | 405 | That method does not exist on that address (for example DELETE on an order: nothing is deleted through the API). |
idempotency_key_reuse | 409 | The Idempotency-Key was already used for a different request. |
idempotency_in_progress | 409 | The first request with this Idempotency-Key is still running. Retry in a moment. |
stock_changed | 409 | You sent expected and the stock is no longer that number. Nothing was changed. |
validation_failed | 422 | A field is missing or wrong. error.fields says which and why. |
transition_not_allowed | 422 | The order cannot move to that status (cancelled orders are final; online orders must be paid first). The message is the admin's. |
order_not_cancellable | 422 | A delivered or already cancelled order cannot be cancelled. |
insufficient_stock | 422 | You tried to remove more stock than is available. |
cannot_publish | 422 | The product failed the import's checks, so it was not published. |
product_archived | 422 | An archived product cannot be published through the API. |
rate_limited | 429 | The key sent more requests than its per-minute limit. Wait for Retry-After. |
too_many_failed_attempts | 429 | Too many invalid keys from your address. Wait for Retry-After. |
server_error | 500 | Something went wrong on our side; nothing is recorded as done unless a success answer says so. |
service_busy | 503 | The store could not reach its database for a moment. Wait the seconds in Retry-After (10) and send the same request again. Here the whole answer is {"error": "service_busy", "message": "..."}: error is plain text, not an object. |
Rare errors can also use the codes forbidden (403) or http_error with the matching HTTP status.
Response headers#
| Header | When | Meaning |
|---|---|---|
X-RateLimit-Limit | Every answer to an authenticated request | The requests per minute this key may send. |
X-RateLimit-Remaining | Same | How many are left in the current minute. |
X-RateLimit-Reset | Same | A Unix time: when the count starts again. |
Retry-After | On 429 and 503 (and on a 409 that says the first request is still running) | Seconds to wait before you try again. |
Idempotent-Replayed | When a stored answer is returned | The value is true. |
WWW-Authenticate | On 401 | The value is Bearer. |
Allow | On 405 | The methods that exist on that address. |