Each recipe is an order of calls and what must not be missed. In every example
$SHOP is the shop’s address (https://shop.example) and $TG_TOKEN a token
from Data exchange → API tokens.
Stock and prices from an accounting system
Token: read + write, an owner with catalog.manage.
Once — link the products. Write your id onto each product:
curl -s -X PATCH "$SHOP/api/v2/admin/products/ST-1001" \ -H "Authorization: Bearer $TG_TOKEN" -H 'Content-Type: application/json' \ -d '{"external_id": "1c-42"}'For thousands of products a file import with an
external_idcolumn is faster (Data exchange → Import). Categories get theirexternal_idthere too.Regularly — send only the changes:
curl -s -X PATCH "$SHOP/api/v2/admin/products/1c-42" \ -H "Authorization: Bearer $TG_TOKEN" -H 'Content-Type: application/json' \ -d '{"stock": 7, "price": "1249.00", "cost_price": "910.00"}'- Prices are in major units. If your system keeps prices in another
currency, add
"price_currency": "EUR": the shop converts by the rate itself, and again on every change of it. - Out of stock —
stock: 0. Taken off sale —"availability_status": "discontinued"or"status": "hidden". 404— the shop has no product with thatexternal_id: create it in the admin or by import; the API does not create products.
- Prices are in major units. If your system keeps prices in another
currency, add
Pull the shop’s own changes (managers’ edits, say):
curl -s -g "$SHOP/api/v2/admin/products?updated_after=2026-11-01T03:00:00%2B02:00&order[updated_at]=asc&itemsPerPage=200" \ -H "Authorization: Bearer $TG_TOKEN"Remember the
updated_atof the last row you got and start the next request from it (encode the offset’s+as%2B). The filter includes its boundary (>=), so the last row comes once more — that is expected.
Mind the limit (120 requests a minute by default): on 429 wait Retry-After
seconds. 5,000 products one by one is ~42 minutes; send only what changed.
Orders into a CRM or the books
Token: read (+ write if the CRM moves statuses), orders.manage.
Pull new and changed orders:
curl -s -g "$SHOP/api/v2/admin/orders?updated_after=$LAST&order[updated_at]=asc&itemsPerPage=100" \ -H "Authorization: Bearer $TG_TOKEN"Walk the pages while
meta.page < meta.pages; keep the last order’supdated_atas the next$LAST. An order you have seen comes again on any change (status, payment) — update it on your side byidornumber.Write your own id onto the order to address it by later:
PATCH /admin/orders/TG-000123 {"external_id": "CRM-58812"}.Move the status from the CRM — only by the action:
POST /admin/orders/CRM-58812/actions/status {"status": "shipped"}. The shop writes stock off or puts it back and tells the customer itself.Payment — read
payment.stateandpayment.paid_total, not the status: it is a separate axis. An order is paid whenpayment.stateispaid.
customer_ref on enquiries and customer.email / customer.user_id on orders
help tie one person’s orders and enquiries together.
A support agent
Token: read + write, issued as a staff member of its own with
enquiries.manage (and orders.manage if the agent answers about orders —
remember that such a token can then move order statuses too). The agent’s acts
show in the audit log under that account’s name.
- The queue:
GET /admin/enquiries?awaiting_reply=1&order[created_at]=asc. - For each enquiry read
answers(what was asked),messages(the conversation),subject(which product or order),locale(which language to answer in). - Context:
- a product —
GET /admin/products/{subject.id}(stock, price) or the storefront’sGET /shop/products/{id}(as the customer sees it); - an order —
GET /admin/orders?email={email}.
- a product —
- If
can_be_answeredisfalsethe answer will not arrive (they left only a phone): assign a manager withPATCH {"manager_id": 3, "status": "in_progress"}and leave a note innotesso a person calls back. - Otherwise answer:
POST /admin/enquiries/{id}/actions/reply {"body": "…"}— plain text in thelocalelanguage. The customer’s email goes out by itself. - Settled —
PATCH {"status": "done"}; to lock the conversation —POST …/actions/close.
A sales agent (on a customer’s behalf)
No key — the storefront half only. Send Accept-Language in the customer’s
language and X-Storefront if there are several storefronts.
- Find the product:
GET /shop/products?q=<what the customer asked>. Narrow it down bycharacteristics(comparecodeandvalue_code), checkin_stock. The category tree —GET /shop/categories, a category’s products —?category={slug}. - The cart:
POST /shop/carts→ keep thetoken;PATCH /shop/carts/{token}/items {"product": "<sku>", "quantity": 1}. A422witherrors.product— not that many in stock, offer fewer. - The town:
GET /places/suggest?q=<town>→ when there are several, ask again showinglabelandcontext. - Checkout answers:
PATCH /shop/carts/{token}/checkoutwithcustomer_name,phone(with the country code),email,country,city,place_id,address_line. - Delivery and payment: the answer has
delivery[]andpayment[]. Tell the customer the options with prices (cost: null— “the shop will quote it”, not “free”). Choose withPATCH {"shipping_method_id": "…", "payment_method_id": …}; if an option hasneeds_fields: true, it needsshipping_fieldstoo. - The total: before placing, tell the customer
totalandto_payfrom the answer and get an explicit yes. - Place:
POST /shop/carts/{token}/checkout/complete.422—errorslists what is missing: ask for it and try again.201— tell them the order number (number); if there is apayment.url, give the customer the link to pay.
Moderating reviews and comments
Permission reviews.moderate / comments.moderate.
GET /admin/reviews?status=pending&only=reviews&order[created_at]=asc.- Publish —
PATCH {"status": "published"}, reject —PATCH {"status": "rejected", "moderation_note": "advertising"}. The product’s average follows by itself. - Answer in public —
POST /admin/reviews/{id}/actions/reply {"body": "…"}(this publishes the review). - Comments —
GET /admin/comments?status=pending, thenPATCH {"status": "approved"}or"rejected".
A gift card for a review or a campaign
POST /admin/giftcards {"amount": "200.00", "recipient_email": "…", "recipient_name": "…", "message": "Thank you for the review!"}— the letter goes at once.- Save
codefrom the answer if your system needs it: the API will not show it again. - Or points instead of a card:
POST /admin/points/{user_id}/actions/adjust {"points": 200, "reason": "For a review with a photo"}.
An external storefront or a mobile app
- Catalogue, search, product cards —
/shop/products,/shop/categories. - “About us” and “Delivery” texts —
GET /admin/pages/{slug}→rendered_body(a read-only token is enough; keep it on your server, never in the app). - Cart and checkout — as for the sales agent above; keep the cart token on the device.
- Payment — open
payment.urlin a web view or the browser.