Everything on this page is the same for every resource: the rules are written in one place in the engine, and a module adding a resource of its own gets them unchanged.
Addresses
GET /api/v2/openapi.json this shop's API description (OpenAPI 3.1, no key)
GET /api/v2/shop/{resource} storefront: a list
GET /api/v2/shop/{resource}/{key} storefront: one row
GET /api/v2/admin/{resource} admin: a list
GET /api/v2/admin/{resource}/{key} admin: one row
PATCH /api/v2/admin/{resource}/{key} a partial write
POST /api/v2/admin/{resource} create (only where allowed)
POST /api/v2/admin/{resource}/{key}/actions/{action} a named action
The version is in the path (v2), not in a header: an address pasted into a
browser, a log line or cURL stays the same call. The half (shop or admin)
is decided by the path, and no header can turn a storefront call into an admin
one.
Requests with a body send Content-Type: application/json. Send
Accept: application/json as well: answers are JSON anyway, and with this
header every error is guaranteed to come back as JSON too.
The description: openapi.json and the reference
GET /api/v2/openapi.json is a machine-readable description of this shop:
every address, its filters and sorts, the answer’s fields with explanations,
what can be written and which actions exist. It is assembled from what the
installed modules declare, so a shop without reviews has no /admin/reviews,
and a new field appears in the description the same day it appears in the
answer. Hand it to Postman, a client generator or an agent.
The admin has the same as a page: Data exchange → API reference. Every address there has a “Send” button that makes the call from the page.
Tokens and rights
The admin half needs a token:
Authorization: Bearer tg_9fK2…
Issue one in Data exchange → API tokens → Issue a token (needs the “Issue and revoke API tokens” permission):
- What is it for — a name to recognise the integration by later (“1C exchange”, “CRM”, “Support agent”).
- May —
readand/orwrite. A read-only token can neitherPATCHnorPOST, whatever its owner may do. Nothing ticked — the token may do everything its owner may. - Expires in, days — empty means never; 1 to 3650.
The token is shown once, right after it is issued — copy it. The database
keeps only its SHA-256 hash: a token cannot be recovered, only replaced by a
new one. Tokens start with tg_ so they are recognisable in logs and config
files.
A token belongs to the account that issued it, and a call runs as that account: every permission check is the admin panel’s own. Each resource has its permission:
| Resource | Permission |
|---|---|
products, categories | catalog.manage |
orders | orders.manage |
returns | rma.manage |
enquiries | enquiries.manage |
comments | comments.moderate |
reviews | reviews.moderate |
giftcards | giftcards.manage |
points | points.manage |
promotions | promotions.manage |
pages | pages.manage |
The token list shows when each one was last used (updated at most once a minute) — that is how you tell whether an old integration is still alive. Revoking a token takes effect at once.
Storefront and language
X-Storefront: main
Accept-Language: en
X-Storefront— a storefront’s code or id (or the parameter?storefront=main). Absent or unknown — the default storefront. The storefront decides the currency, the prices, which promotions run and what the catalogue shows.Accept-Language— its first two letters are read; the language must be enabled in the shop. Otherwise — the storefront’s own language. The language decides names and texts in the storefront half and the text of error messages.
In the admin half translatable fields come whole — an object
{"en": "…", "ru": "…", "uk": "…"}; in the storefront half they are already a
string in the request’s language.
A row’s key
{key} in an address is our id or any key the resource declares. An
accounting system never has to store our autoincrements:
| Resource | What can name a row |
|---|---|
admin/products | id, external_id, sku, slug |
shop/products | id, sku, slug |
admin/categories | id, external_id, slug |
shop/categories | id, slug |
admin/orders | id, external_id, the order number (order_number, e.g. TG-000123) |
admin/pages | id, slug |
| the rest | id |
The search order: a key made only of digits is tried as an id first; then
each key of the table in turn. Nothing found — 404.
external_id is the field for your own id. Write it once
(PATCH {"external_id": "1c-42"}) and address the row by it from then on. File
imports also match rows by external_id first and by sku second.
Lists
?page=2&itemsPerPage=50 the page and its size
?order[updated_at]=desc a sort; several are fine: ?order[status]=asc&order[id]=desc
?updated_after=2026-09-01T00:00:00+03:00
?status=active filters — each resource has its own
itemsPerPagedefaults to 30, the ceiling is 200 (both are settings of the API module). Ask for more and you get the ceiling, with no error.- You can sort only by the fields the resource allows (listed in
openapi.jsonand on the resources’ pages). Without a sort rows come by id, so pages never repeat each other. - An unknown filter or sort field is silently ignored: a typo in
?stauts=returns the whole list. - In
curlsquare brackets are a glob: writecurl -g '…?order[id]=desc'or encode them (order%5Bid%5D=desc), or curl refuses to send the request.
The answer:
{
"data": [ { "id": 1, "sku": "ST-1001", "…": "…" } ],
"meta": { "page": 1, "itemsPerPage": 30, "total": 184, "pages": 7 }
}
total is how many rows match the query, not how many are on this page. Walk
the pages while page < pages.
Writes
PATCH is partial. A body with three fields changes three fields and
nothing else: pushing a stock level does not risk the name, the price or the
description. Every resource lists what may be written (writable); fields not
on the list are skipped without an error. The answer is the whole row, after
the write:
{ "data": { "id": 4, "stock": 12, "…": "…" } }
An empty string "" in a plain field is written as null. A resource with no
writes answers 405.
Creation (POST /admin/{resource}) exists only where the shop itself makes
a row on request — currently gift cards. An order is not made this way: it is
placed through the cart (see Cart and checkout).
The answer is 201 and the new row.
Actions (POST /admin/{resource}/{key}/actions/{action}) are everything
that is a decision rather than a value: moving an order’s status, answering an
enquiry, accepting a return, crediting points. An action runs the same code as
the button in the admin — stock movements, history and emails included. The
answer is the row after the action. An unknown action is 404.
Errors
An error is always JSON with message; when particular fields are at fault,
errors too:
{
"message": "The checkout is not complete.",
"errors": {
"email": ["The email field is required."],
"shipping_method_id": ["The shipping method id field is required."]
}
}
| Code | When | message |
|---|---|---|
401 | no token | No token. Send Authorization: Bearer <token>. |
401 | no such token (or it was revoked) | Unknown token. |
401 | the token has expired | This token has expired. |
403 | a read-only token tries to write | This token may not write. |
403 | the token’s owner lacks the resource’s permission | Not allowed. |
404 | no such resource (its module is not installed; in the storefront half — anything but products, categories, carts and gift cards) | No such resource. or empty |
404 | no row by this key | Not found. |
404 | no such action | No such action. |
404 | no cart with this token | No such cart. |
405 | the resource is read-only | This resource is read-only. |
405 | the resource is not created through the API | Rows of this resource are not created through the API. |
405 | the wrong method (e.g. PATCH on /shop/…) | The PATCH method is not supported for route … |
422 | the data failed validation | the first error’s text + errors |
429 | the rate limit is exceeded | Too Many Attempts. |
5xx | the shop failed | retry later, with a pause |
message and errors come in the language of Accept-Language; the table
shows English. Act on the status code and the field names in errors, not on
the text.
Rate limit
By default 120 requests a minute (the “Requests per minute, per token” setting). Counted per token, and without a token per IP address: two integrations behind one office NAT do not throttle each other. Every answer carries:
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 114
Past the limit — 429 with a Retry-After header (seconds). Wait that long and
carry on; never retry in a loop without a pause.
Money
- Money is a decimal string in major units with a dot:
"999.00"withcurrency: "USD"is $999.00. The currency is always named beside it, and the API reads money in exactly the format it writes it (a JSON number is accepted too). - Two kinds of number. An amount — a line’s total, an order’s subtotal
and total, delivery, a payment, a refund, a gift card’s balance — always has
two places (
"12.00"). A price per unit — a product’s price, cost and RRP, a line’sunit_price, an option’samount— has exactly as many places as the shop keeps a price (the setting “Places in a product price”, 2 to 4):"0.0120"in a shop that keeps four. A price sent with more places than that is refused with 422, never rounded. - A line’s total is its price × quantity, rounded once, half away from
zero: 1000 ×
"0.0120"="12.00", 333 ×"0.0120"="4.00". Add upline_total, neverunit_price × quantity, and your numbers will match the shop’s to the cent. - In the admin half every amount is in the shop’s books currency (its code
is the row’s
currency). An order also has the currency the payment was asked of the bank in (payment.currency), which may differ. - A product’s price may have been typed in another currency: then
price_currencyandprice_typedare what a person typed, andpriceis the conversion into the books currency, which moves with the rate. - Writing works the same way everywhere:
"price": "420.50"inPATCH /admin/products/{key},"amount": "399.20"in a refund. - A storefront price (
/shop/products) has been through the same display filter as the page: a tax the shop adds to prices, for instance, is already inside it.
Weight and size
Weight is whole grams, sizes whole millimetres, always, whatever units
the shop picked for its admin. null means “not measured”, which is not the
same as 0: delivery treats the two differently.
Dates
Dates are ISO 8601 with an offset (2026-11-01T14:05:00+02:00), in the shop’s
time zone. Pass ISO 8601 to filters (updated_after) too, preferably with an
offset or Z.
A public map for machines
Besides openapi.json a shop serves https://<shop>/llms.txt — a site map for
language models. Its “Programmatic access” section links to the API
description and to the public catalogue.