Errors
Every refusal the Admin API and the storefront API answer: its status, its code and what it means.
The error envelope
A refusal answers its HTTP status and this body; branch on error.code, show error.message to a person.
| Field | Type | Description |
|---|---|---|
error | object | |
error.code | one of unauthorized, forbidden, not_found, method, invalid, gated, feature_off, conflict, rate_limited, failed | What went wrong, as a stable code to branch on. |
error.message | string | What went wrong, in a sentence for a person. |
{
"error": {
"code": "not_found",
"message": "No product with that id in this store."
}
}Admin API
| Code | Status | What it means |
|---|---|---|
unauthorized | 401 | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
feature_off | 403 | The store has switched off the feature the operation stands behind (Settings, Store features); the message names it. |
forbidden | 403 | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
gated | 403 | The request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed. |
not_found | 404 | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
method | 405 | The method is not one this path takes. |
conflict | 409 | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
invalid | 422 | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
rate_limited | 429 | More calls than the budget allows; Retry-After says how many seconds to wait. |
failed | 500 | Something went wrong on our side; nothing more was done. It is safe to try again. |
unauthorized
Status 401. No valid token in Authorization: Bearer kf_…, or one that was revoked.
Any operation can answer it.
feature_off
Status 403. The store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
Answered by price_lists.list, price_lists.prices, price_lists.set_prices, drafts.list, drafts.get, drafts.create, drafts.update, drafts.send, drafts.decline, customers.loyalty, gift_cards.list, gift_cards.get, gift_cards.issue, gift_cards.disable, subscriptions.list, subscriptions.get, subscriptions.pause, subscriptions.cancel, reports.list, reports.run, contracts.list, contracts.get.
forbidden
Status 403. The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
Any operation can answer it.
gated
Status 403. The request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed.
Answered by products.update, orders.fulfil, categories.add_product, categories.remove_product, tags.add_product, tags.remove_product, products.media_add, products.media_order, products.media_remove, orders.refund, orders.cancel, orders.note, customers.update, pages.update, articles.update, content.entry_update, jobs.apply.
not_found
Status 404. No such route, or nothing with that id in the token's store (another store's ids are simply not found).
Answered by products.get, products.update, orders.get, orders.fulfil, invoices.ubl, credit_notes.ubl, customers.get, customers.tag, customers.untag, checkout.rule_update, checkout.rule_delete, checkout.field_update, checkout.field_delete, categories.get, categories.update, categories.delete, categories.add_product, categories.remove_product, tags.get, tags.update, tags.delete, tags.add_product, tags.remove_product, products.media, products.media_add, products.media_order, products.media_remove, products.publish, products.unpublish, products.archive, products.unarchive, price_lists.prices, price_lists.set_prices, drafts.get, drafts.update, drafts.send, drafts.decline, orders.refunds, orders.refund, orders.cancel, orders.notes, orders.note, orders.tag, orders.untag, returns.get, returns.approve, returns.decline, returns.receive, events.create, customers.update, customers.store_credit, customers.loyalty, segments.get, discounts.get, discounts.update, discounts.disable, gift_cards.get, gift_cards.disable, subscriptions.get, subscriptions.pause, subscriptions.cancel, pages.get, pages.update, pages.publish, articles.get, articles.update, articles.publish, content.entries, content.entry, content.entry_create, content.entry_update, content.entry_publish, menus.get, reports.run, experiments.get, webhooks.update, webhooks.delete, webhooks.deliveries, webhooks.resend, jobs.product_import_check, jobs.apply, jobs.get, jobs.download, forms.get, forms.responses, forms.create, forms.update, contracts.get.
method
Status 405. The method is not one this path takes.
No operation answers it yet.
conflict
Status 409. Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
Answered by products.create, inventory.adjust, inventory.set, orders.fulfil, customers.tag, discounts.create, checkout.rule_create, checkout.field_create, categories.create, categories.add_product, tags.create, tags.add_product, media.upload, media.create, products.media_add, products.publish, products.unpublish, products.archive, products.unarchive, price_lists.set_prices, drafts.create, drafts.update, drafts.send, drafts.decline, orders.refund, orders.cancel, orders.note, orders.tag, returns.approve, returns.decline, returns.receive, events.create, customers.create, customers.update, discounts.update, discounts.disable, gift_cards.issue, gift_cards.disable, subscriptions.pause, subscriptions.cancel, pages.create, pages.publish, articles.create, articles.publish, content.entry_create, content.entry_publish, reports.run, webhooks.create, webhooks.resend, jobs.product_export, jobs.product_import, jobs.product_import_check, jobs.apply, jobs.download, forms.create.
invalid
Status 422. Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what.
Answered by products.list, products.create, products.update, inventory.levels, inventory.adjust, inventory.set, orders.list, orders.fulfil, invoices.ubl, credit_notes.ubl, customers.list, customers.tag, discounts.list, discounts.create, checkout.rule_create, checkout.rule_update, checkout.field_create, checkout.field_update, categories.list, categories.create, categories.update, categories.add_product, categories.remove_product, tags.list, tags.create, tags.update, tags.add_product, tags.remove_product, media.upload, media.create, media.list, products.media_add, products.media_order, products.publish, products.unpublish, products.archive, products.unarchive, price_lists.list, price_lists.prices, price_lists.set_prices, drafts.list, drafts.create, drafts.update, drafts.send, drafts.decline, orders.refund, orders.cancel, orders.note, orders.tag, returns.list, returns.approve, returns.decline, returns.receive, events.create, customers.create, customers.update, segments.list, discounts.update, discounts.disable, gift_cards.list, gift_cards.issue, gift_cards.disable, subscriptions.list, subscriptions.pause, subscriptions.cancel, pages.list, pages.create, pages.update, pages.publish, articles.list, articles.create, articles.update, articles.publish, content.entries, content.entry_create, content.entry_update, content.entry_publish, menus.list, reports.list, webhooks.create, webhooks.update, webhooks.deliveries, webhooks.resend, jobs.product_export, jobs.product_import, jobs.product_import_check, jobs.apply, forms.responses, forms.create, forms.update, contracts.list.
rate_limited
Status 429. More calls than the budget allows; Retry-After says how many seconds to wait.
Any operation can answer it.
failed
Status 500. Something went wrong on our side; nothing more was done. It is safe to try again.
Any operation can answer it.
Storefront API
The storefront API answers the same envelope; its codes say which part of a request it could not take.
| Status | Codes | What it means |
|---|---|---|
| 400 | invalid_cart, invalid_line, invalid_request | The request could not be read: the error's code says which part. |
| 401 | unauthorized | No storefront token of this store in X-Storefront-Token. |
| 404 | no_such_cart, no_such_market, no_such_product, not_found | No such store (or it is not open, sells nothing or is private), market, product or cart. |
| 422 | nothing_to_buy, quantity, too_many_lines, unavailable | Nothing changed: the error's code says why. |
| 429 | rate_limited | Too many calls; Retry-After says when to try again. |