Requests and errors
Responses
Section titled “Responses”A successful response wraps its result in data:
{ "data": { "name": "Acme Studio", "read_only": false } }An error has a stable code, a human-readable message and, sometimes, details:
{ "error": { "code": "checkout_conflict", "message": "Some items can't be checked out as they are.", "details": { "lines": [] } }}Branch on code, not on message, because messages can change.
Every response carries an X-Request-Id header. Include it when you contact support.
Browsers and CORS
Section titled “Browsers and CORS”Browser requests with a public token are allowed from the storefront’s allowed origins. The API answers preflight requests for:
- methods
GET,POSTandOPTIONS; - headers
Authorization,Content-Type,Idempotency-Key,If-None-MatchandX-Guest-Order-Token.
Error codes
Section titled “Error codes”| Code | Status | Meaning | What to do |
|---|---|---|---|
validation_error |
400 | A field is invalid, for example an availability range over 62 days, or products and a service in one checkout. | Read message and details, which name the field. |
invalid_cursor |
400 | A page cursor is malformed or out of date. | Start the list again without cursor. |
invalid_buyer_ip |
400 | X-Sevigram-Buyer-IP isn’t a valid IP address. |
Check what your proxy sends. |
invalid_token |
401 | The token is missing, mistyped, revoked, or was rotated more than 24 hours ago. | Copy the current token from Settings → Custom storefronts. |
customer_session_invalid |
401 | The customer session is missing, expired, malformed or belongs to another shop. | Treat the shopper as signed out and ask them to sign in again. |
customer_code_invalid |
401 | The sign-in code is wrong or has expired. | Ask the shopper to check the code or request a new one. |
origin_not_allowed |
403 | A public token was used from an origin that isn’t allowed. | Add the exact origin (scheme, host and port) to the storefront. |
storefront_disabled |
403 | The storefront is off, the business no longer has custom storefronts, or the business is suspended. | Turn the storefront on and check the business’s plan. |
demo_shop_read_only |
403 | The demo shop refuses checkout, contact and quote responses. | Connect your own shop to take real orders. |
private_token_required |
403 | A customer route, or a checkout with a customer session, was called with a public token. | Call it from your server with the private token. |
not_found |
404 | No such product, service, collection, checkout, order or document in this shop, or the guest order token is wrong. Unknown paths also return a JSON 404. |
Check the handle or ID. |
checkout_conflict |
409 | A cart line can’t be checked out as it is. details.lines gives each line’s reason, such as a price change, sold out or slot taken. |
Let the shopper fix the marked lines and try again. |
idempotency_key_reused |
409 | The same Idempotency-Key was sent with a different checkout body. |
Use a new key whenever the cart changes. |
quote_not_respondable |
409 | The quote was already answered, has expired or was withdrawn. | Reload the document and show its current status. |
return_url_not_allowed |
422 | The checkout return_url isn’t on an allowed origin. |
Use a return URL on one of the storefront’s origins. |
rate_limited |
429 | Too many requests. | Wait for the number of seconds in Retry-After. See Rate limits. |
service_unavailable |
503 | Sevigram is briefly unavailable. Retry-After is 5 seconds. |
Retry after a few seconds. |
A wrong method on a known route returns a JSON 405.