Start here
Core concepts
IDs
IDs are opaque strings with a type prefix: prod_…, var_…, cat_…, col_…, ord_…, cus_…, addr_…, ship_…. Store them as strings and never parse them. An ID from one store means nothing in another.
Products also have SEO-friendly variant slugs (blue-mug-large); GET /v1/products/{id} accepts either a prod_ ID or a variant slug.
Money
Amounts are integers in the currency's smallest unit, with the currency code:
{ "amount": 49900, "currency": "INR" } // ₹499.00
formatMoney() in the SDK formats them. compare_at_price is the original price when a variant is discounted; tax_inclusive says whether the price includes tax. Never compute totals yourself: use quotes (see Cart and checkout).
Lists and paging
Lists return:
{ "data": [ … ], "next_cursor": "cD0yMDI2…", "has_more": true }
Pass cursor=<next_cursor> for the next page; limit is 1–50 (default 20). Cursors are opaque and stable when items are added. A cursor from a different list or sort returns 400 INVALID_CURSOR. The SDK's client.paginate() walks every page for you.
Errors
Every error has the same shape and a stable code:
{ "error": "Some fields are invalid.", "error_code": "VALIDATION_ERROR",
"request_id": "req_6f1c…", "fields": { "phone": ["Enter a 10-digit Indian mobile number."] } }
Branch on error_code, not the message. Quote request_id when you contact support. Full list: Error codes. The SDK throws StorefrontApiError with status, code, requestId, fields and retryAfter.
Rate limits
| Bucket | Limit |
|---|---|
| Publishable key, per key | 6,000 requests a minute |
| Publishable key, per visitor IP | 120 requests a minute |
| Secret key, per key | 12,000 requests a minute |
Secret key, per shopper (X-Buyer-IP) | 120 requests a minute |
Over a limit you get 429 RATE_LIMITED with Retry-After (seconds). Back off and retry after that time. From your server, forward each shopper's IP and browser (see Keys and security) so one busy shopper can't use up your key's whole allowance.
Login has its own, stricter limits; see Shopper login.
Retries and idempotency
GET requests are safe to retry. POST /v1/checkouts requires an Idempotency-Key header (8–100 characters, e.g. a UUID per checkout attempt):
- retrying with the same key and body returns the first result; no second order is created;
- the same key with a different body returns
422 IDEMPOTENCY_KEY_REUSED; - while the first request is still running, a retry returns
409 IDEMPOTENCY_IN_PROGRESS; - if the first attempt was refused (for example
VALIDATION_ERROR), you may fix it and retry with the same key.
The SDK sends a key automatically; pass idempotencyKey yourself to retry safely.
Caching
Catalog and account responses are Cache-Control: no-store. Branding and content (/v1/storefront/settings, /v1/storefront/content) may be cached for 60 seconds; merchants' dashboard changes show up within that time.
Availability
When the API is switched off for maintenance every call returns 503 SERVICE_UNAVAILABLE with Retry-After. Every response carries X-Request-ID.