API referenceIntroduction
API reference
v1.
Products, stock, coupons, orders, customers, checkout sessions, licenses, webhooks and events, and data exports of your store, as JSON over HTTPS at api.anyshop.io. Every endpoint follows the rules on this page; its own page lists only what is its own. The same reference, as an OpenAPI 3.1 document, is at /v1/openapi.json.
What it covers
| Resource | What you do with it |
|---|---|
| Products and stock | Create, change, publish and unpublish products; add, list and reveal keys |
| Coupons | Create, list, change and archive codes buyers type at checkout |
| Orders | List and read orders, refund them, take back what was delivered, resend the delivery email |
| Customers | List and read your buyers, keep a record by email, record marketing consent |
| Checkout sessions | Start a checkout for a buyer on your own site, with the answers to your questions for the buyer, read it, cancel it |
| Licenses and license checks | Look up, revoke and free devices from your server; check keys from your app |
| Webhooks and events | Manage endpoints and their secrets; list the events of the last 30 days |
| Exports | Export your store's data as files |
Erasing a customer and exporting one customer's data are not in the API: they stay in the dashboard, with the owner's fresh two-factor code when two-factor is on. What changed and what stays stable is in the changelog.
Authentication
Send an API key from the dashboard's Developers, API keys as a Bearer token. Every key is a live key, as_live_..., and belongs to one store: nothing in a request can reach another store. Keep keys on your servers, never in a browser or an app.
You can make a key on your store's first day. Before anyshop approves your store, the key can set up products, stock, coupons and webhooks, and a checkout answers store_not_approved (409). Objects keep their livemode field, always true, because v1 does not remove fields.
curl https://api.anyshop.io/v1/orders?limit=10 \
-H "Authorization: Bearer $ANYSHOP_API_KEY"Each key has scopes, such as orders:read or products:write; a write scope includes reading. Full stock keys come back only from POST /v1/stock_items/{id}/reveal, which needs stock:reveal and is recorded in your security log. The license checks, the index and the OpenAPI document need no key.
Browsers: the four license checks answer web pages on any site (Access-Control-Allow-Origin: *, without credentials, for a JSON body), so an app can check a license from the page; see Check licenses. No other endpoint answers a page on another site, so an API key never belongs in a browser.
Errors
Every error answers with a 4xx or 5xx status and the same body. Branch on type and code; message is for a person, and param names the field at fault when there is one. Every code, and when it happens, is in Error codes.
{
"error": {
"type": "invalid_request",
"code": "too_long",
"message": "name is at most 120 characters",
"param": "name"
}
}| Status | type | When |
|---|---|---|
| 400 | invalid_request | A parameter or the body is wrong; param says which |
| 401 | authentication | No API key, or not a valid one |
| 403 | permission | The key lacks the scope (missing_scope), or the store is suspended (store_suspended) |
| 404 | not_found | Nothing with that ID in this store |
| 409 | conflict | The object's state does not allow it, such as refunding a refunded order |
| 409 | idempotency | An Idempotency-Key reused for another request, or still running |
| 429 | rate_limited | Too many requests; wait for Retry-After |
| 500 | api_error | Our fault. Try again; with an Idempotency-Key, a retry is safe |
Pagination
Lists answer { "object": "list", "data": [...], "has_more": true }, newest first. Ask for up to 100 with limit (20 by default), and for the next page pass the last ID you got as starting_after.
curl "https://api.anyshop.io/v1/orders?limit=100&starting_after=ord_01m3rt5x2c7q9f0a4d6k8h1n3p" \
-H "Authorization: Bearer $ANYSHOP_API_KEY"Idempotency
Send an Idempotency-Key header with any write, 1 to 255 visible characters such as a UUID. For 24 hours, a retry with the same key and the same request gets the first answer again, with an idempotent-replayed: true header, and the work runs once. The same key with a different request is refused with idempotency_key_reused, and a retry while the first request is still running with idempotency_in_progress: try again in a moment.
Rate limits
1,000 requests a minute per API key. Over it, the answer is 429 with a Retry-After header in seconds. Failed authentication is limited per network, and the public license checks have their own limits, in the licenses guide.
Money and time
Amounts are integers in minor units of the store's currency: 1999 is $19.99, and 1999 in JPY is ¥1,999. Times are ISO 8601 strings in UTC, such as 2026-10-02T14:21:07.000Z. IDs start with their object's prefix, like prod_, ord_ and lic_.
Prices and sales
A variant's price is its own price per unit, and compare_at_price an earlier price shown struck through beside it. Outside a sale, compare_at_price is yours to keep right: in the EU a price cut must compare with your lowest price of the 30 days before it.
A sale is a lower price for one variant for a set time, up to 90 days, scheduled in the dashboard's product editor (Price and options, Sales). It starts and ends by itself; one not started yet can be cancelled, and a running one ended now. A variant's sales never overlap, and a variant has at most 5 scheduled or running at once. Variants whose price the buyer chooses, and free ones, take no sale; bundles take sales like any fixed price. The editor says, under the "Was" price: "In the EU, a price cut must compare with your lowest price of the 30 days before it. During a sale, anyshop shows that price for you."
The sale price must be below the variant's lowest price of the 30 days before the sale starts (its reference): its own price over those days, and an earlier sale's price while that sale ran. While the sale runs, buyers see the reference struck through in place of compare_at_price, and beside the sale price on the product page and at checkout: "Lowest price in the 30 days before the sale: $59.00". A change of the variant's price that would put a scheduled or running sale at or above its reference, or the price at or below a sale's, is refused until you cancel or end that sale.
In the API, sales are read only: a variant's current_price is what buyers pay now, and sale the running sale with its reference_price, starts_at and ends_at; an order item priced at a sale has sale with its reference_amount. Checkout charges the sale price, with quantity discounts and then coupons on it.
Questions for the buyer
A product can ask the buyer up to 3 questions at checkout, set in the dashboard's product editor (Checkout, Questions for the buyer): a short text (up to 200 characters), an email address, or a choice from a list of 2 to 20 options, each required or optional, with a help text under the field. Ask only what you need to deliver the order. Questions that ask for passwords, payment card details, government ID numbers or health information are refused, and the Acceptable Use Policy does not allow asking for them. A bundle asks its own questions: the products it holds ask nothing at its checkout. A free order asks them too.
The hosted checkout, the buy button's overlay and a demo store's checkout ask them after Email, under "Larkfield asks" (your store's name), and refuse Pay until every required one is answered as it should be. In the API, a product's questions lists them (read only), and a checkout session takes the answers your own page asked in answers, keyed by question ID: a required question unanswered, an email that is not one, an option not listed or an answer too long starts nothing, with 400 and invalid_answers, error.param naming the question (answers.pq_...).
anyshop stores the answers encrypted with the order. Each order item has answers: [{ "question_id", "question", "kind", "answer" }], the question as the buyer read it (editing a question later does not change past orders), in the questions' order, empty for none. They are in the REST API's orders, in the order.paid and order.fulfilled events, and in the request to your server for a "From your server" product, and on the order's page in the dashboard. They are never in an email, your store's data exports (orders.csv and orders.json) or the order's timeline. A buyer's own data, which you export from the dashboard (Customers, Export their data) when they ask for it, includes their answers. They are deleted with the order, and when you delete a buyer's data at their request.
Suspended stores
While a store is suspended its keys can still read everything, and still serve what it already sold: refunds, taking back items, resending the delivery email, revealing a stock key, revoking a license and freeing its devices, managing webhook endpoints, and starting a data export. Its webhooks keep delivering. Anything that sells or changes the catalog answers 403 with store_suspended; each endpoint's page says which it is.