Recipes
Five common integrations with the exact sequence of calls, the permissions the key needs and the failures to plan for.
Orders into an accounting program
Goal: every new or changed order reaches the accounting program, and the invoice number it issues is visible on the order in the store.
Permissions: orders:read, orders:billing (names, addresses and tax details for the invoice), orders:reference.
- Once: call
GET /v1/store, savestore_refandcurrency, and check thatkey.scopeshas the three permissions. - Every few minutes: read the orders changed since your previous poll, overlapping it by five minutes, through all pages (
GET /v1/orders).curl# every few minutes: orders changed since the last poll (minus five minutes), page by page curl -sS "https://example.com/api/v1/orders?updated_since=2026-12-01T09:55:00Z&limit=100" \ -H "Authorization: Bearer $ORIGELA_API_KEY" - For each order: match it by
id. Decide bystatusandpayment_statuswhether it is ready for an invoice (for examplepayment_status=paid), and skip it ifreferencesalready carries a number of your program.json{ "id": 1042, "order_number": "ORD-2026-001042", "status": "processing", "payment_status": "paid", "currency": "EUR", "total": "149.90", "updated_at": "2026-12-01T09:58:12Z", "items": [ { "sku": "A-100", "name": "Example product", "qty": 1, "price": "149.90", "total": "149.90", "tax_rate": "20.00", "discount_amount": "0.00" } ], "references": [], "billing": { "invoice_type": "individual", "name": "Jane Example", "address": "1 Example Street", "city": "Izmir", "district": "Konak" } } - Issue the invoice in your program from
items, the amounts andbilling. Amounts are decimal text in the order'scurrency. - Write the number back with
PUT /v1/orders/{id}/reference. Use a value built from order and invoice number asIdempotency-Key, so that a repeat after a lost answer changes nothing.curlcurl -sS -X PUT "https://example.com/api/v1/orders/1042/reference" \ -H "Authorization: Bearer $ORIGELA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: invoice-1042-INV-2026-000123" \ -d '{"system":"Accounting","number":"INV-2026-000123","date":"2026-12-01"}' - Only after all pages were handled, store the start time of this poll as the next
updated_since.
Failures to handle
- The same order arrives again (overlap, or the write of your own reference changed it): this is normal. The
referencescheck in step 3 makes it harmless. - An order changes after the invoice (refund, cancellation): it comes back with a new
status,payment_statusorrefunded_amount. Decide in your program what follows; the API never cancels an invoice for you. 409reference_limit: the order already has numbers of five programs. Use one fixedsystemname for your program; sending it again replaces the number.422invalid_parameterwithfield=numberorsystem: only plain text is accepted, no web addresses or markup.404on the write: the order was removed. Log it and go on.429,503, no answer: wait and repeat; the write with the sameIdempotency-Key.403license_inactiveor401: stop and tell a person.
Stock in step with a warehouse program
Goal: the store sells what the warehouse has. The warehouse program is the master for quantities, but the store sells in between, so a figure must never be overwritten blindly.
Permissions: stock:read, stock:write.
- Map the stock codes. Read
GET /v1/stockthrough all pages. Each row is one countable unit, identified bysku. Rows withtracked=falsehave no quantity in the store and cannot be written. A product whose variants keep their own quantity has no row of its own: write the variants. - Follow the store's sales. Poll with
updated_sinceand take over the store's figures as "what the store believed at that time".curlcurl -sS "https://example.com/api/v1/stock?updated_since=2026-12-01T09:55:00Z&limit=100" \ -H "Authorization: Bearer $ORIGELA_API_KEY" # -> { "data": [ { "sku": "A-100", "product_id": 7, "variant_id": null, "stock": 15, "tracked": true, ... } ], "next_cursor": null } - After a count: set the figure with
expected. Sendquantity(the new figure) together withexpected(the store's figure your count started from). If a sale happened in between, the store's figure is no longerexpectedand the row is refused instead of wiping out the sale.curlcurl -sS -X PATCH "https://example.com/api/v1/stock" \ -H "Authorization: Bearer $ORIGELA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: stock-sync-20261201-1000-01" \ -d '{"mode":"partial","items":[{"sku":"A-100","quantity":12,"expected":15},{"sku":"A-200-RED","quantity":40,"expected":40}]}'Herejson{ "data": { "updated": 1, "rejected": 1, "results": [ { "sku": "A-100", "status": "rejected", "reason": "expected_mismatch", "stock": 14 }, { "sku": "A-200-RED", "status": "updated", "previous": 40, "stock": 40, "product_id": 9, "variant_id": 31 } ] } }A-100was refused: the store has 14, not 15, because one was sold. Take 14 as the new starting point, work out the figure again (12 − 1 = 11) and send that row once more withexpected14 and a newIdempotency-Key. - For movements: send a change. Goods received or written off are a
delta, which needs noexpectedbecause it adds to whatever the store has now.curlcurl -sS -X PATCH "https://example.com/api/v1/stock" \ -H "Authorization: Bearer $ORIGELA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: goods-in-GR-20261201-0007" \ -d '{"items":[{"sku":"A-100","delta":24}]}'
All or partial
Mode all (the default) changes nothing when one row is refused and answers 409 stock_rejected with the result of every row. Use it when the rows belong together. Mode partial applies the good rows and answers 200 with updated, rejected and results; use it for a routine sync and repeat only the refused rows.
Failures to handle
| Reason | What to do |
|---|---|
expected_mismatch | The store's figure changed. stock is the current one; recalculate and send again. |
unknown_sku | No such stock code in the store. Check the mapping; the product may have been removed. |
ambiguous_sku | Two units in the store share this code. A person has to make the codes unique in the store panel. |
duplicate_sku | The same unit appears twice in your request (codes are compared without regard to case). Send one row per unit. |
has_variants | The product's quantity is the sum of its variants. Write the variants. |
not_tracked | The store does not track a quantity for this unit. Leave it, or ask the owner to switch tracking on. |
insufficient | A negative delta would take the figure below zero. stock is the current figure. |
too_large | The result would exceed 1,000,000. |
Also plan for 503 unavailable when a row is locked by a payment at that moment (repeat with the same Idempotency-Key), the limit of 30 writes a minute (up to 100 rows fit into one request), and 413 for bodies over 256 KB.
Shipments from a shipping program
Goal: when a parcel gets its label, the order in the store becomes "shipped" with carrier and tracking number, and the customer is told.
Permissions: orders:read, shipping:read, orders:shipment; orders:billing as well if the program needs the delivery name and address for the label.
- Once a day: read the store's active carriers and map their
codeto the carriers of your program (GET /v1/shipping/carriers). Only these codes are accepted.curlcurl -sS "https://example.com/api/v1/shipping/carriers" \ -H "Authorization: Bearer $ORIGELA_API_KEY" # -> { "data": [ { "code": "yurtici", "name": "Yurtiçi Kargo", "has_tracking_link": true } ], "next_cursor": null } - Fetch the orders to ship with
GET /v1/orders: those being prepared. ThePOST /v1/orders/{id}/shipmententry of the reference says exactly which orders can be shipped through the API.curlcurl -sS "https://example.com/api/v1/orders?status=processing&limit=100" \ -H "Authorization: Bearer $ORIGELA_API_KEY" - Create the label in your program.
- Mark the order as shipped with
POST /v1/orders/{id}/shipment. Build theIdempotency-Keyfrom order and tracking number. The customer gets the store's "shipped" e-mail unless you send"notify_customer": falseor the key is set not to notify;email_senttells you what happened.curlcurl -sS -X POST "https://example.com/api/v1/orders/1042/shipment" \ -H "Authorization: Bearer $ORIGELA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: ship-1042-1234567890-01" \ -d '{"carrier_code":"yurtici","tracking_number":"1234567890"}' # -> { "data": { "order_id": 1042, "status": "shipped", "carrier_code": "yurtici", "carrier_name": "Yurtiçi Kargo", # "tracking_number": "1234567890", "tracking_url": "...", "email_sent": true } } - Later, if you need it:
GET /v1/orders/{id}/trackingreturns carrier, tracking number and the tracking link of an order.
Failures to handle
409order_not_shippable: the order is not being prepared any more (cancelled, already shipped by a person in the panel, payment missing). Read the order. If it isshippedwith your tracking number, you are done. If not, do not send the parcel on the strength of the label alone: a person decides.422invalid_parameterwithfield=carrier_code: the carrier is not active in the store. Refresh your list. Withfield=tracking_number: 3 to 64 letters, digits, dot, underscore or hyphen; nothing that reads as a web address.- Shipping works once. A wrong tracking number cannot be corrected through the API; a person corrects it in the store panel. Check the number before you send.
429daily_limit: a key can ship at most 500 orders a day.- No answer,
503: repeat with the sameIdempotency-Key. The order is shipped once and the customer gets one e-mail, however often you repeat. 409request_in_progress: read the order, then decide.
Prices in step with an accounting or ERP program
Goal: the price list kept in the accounting or ERP program is the price list of the store. The store owner may still change a price by hand in the panel, so a price must never be overwritten blindly, and a slip in the list must not reach the storefront.
Permissions: products:read, prices:write. Only an administrator of the store can give a key prices:write.
- Once: call
GET /v1/storeand savecurrency. Prices are written in the store's own currency only; a request that names another one is refused with422,field=currency. If your program keeps its list in another currency, convert before you send. - Read what the store has.
GET /v1/productsreturns every product and variant withsku,priceandsale_price. Keep the store's price next to each stock code of your list; it is theexpected_priceof your next write. A variant whosepriceisnullfollows its product: for such a variant the product's price is the one to expect.curl# all products with their variants, page by page; "price" and "sale_price" are what the store has now curl -sS "https://example.com/api/v1/products?limit=100" \ -H "Authorization: Bearer $ORIGELA_API_KEY" # -> { "data": [ { "id": 7, "sku": "A-100", "price": "149.90", "sale_price": null, "currency": "EUR", ... } ], "next_cursor": "100" } - Send only the rows that differ, up to 100 per request, each with
expected_price, withPATCH /v1/prices. Amounts are text with exactly two decimals ("159.90"); a JSON number is refused. Leavesale_priceout to keep it, sendnullto remove it. Build theIdempotency-Keyfrom the number of your price list and the part you are sending.curlcurl -sS -X PATCH "https://example.com/api/v1/prices" \ -H "Authorization: Bearer $ORIGELA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: pricelist-PL-2026-12-0007-01" \ -d '{"currency":"EUR","mode":"partial","items":[ {"sku":"A-100","price":"159.90","expected_price":"149.90"}, {"sku":"A-200-RED","price":"89.90","expected_price":"84.90"}, {"sku":"A-300","price":"24.90","expected_price":"24.90"}, {"sku":"A-400","price":"12990.00","expected_price":"129.90"}]}'json{ "data": { "updated": 1, "unchanged": 1, "rejected": 2, "results": [ { "sku": "A-100", "status": "updated", "previous_price": "149.90", "price": "159.90", "previous_sale_price": null, "sale_price": null, "product_id": 7, "variant_id": null, "currency_overrides": ["USD"] }, { "sku": "A-200-RED", "status": "rejected", "reason": "expected_mismatch", "price": "86.90", "sale_price": null }, { "sku": "A-300", "status": "unchanged", "price": "24.90", "sale_price": null, "product_id": 12, "variant_id": null }, { "sku": "A-400", "status": "rejected", "reason": "change_too_large", "price": "129.90", "sale_price": null } ] } } - Read the result row by row.
A-100was changed;currency_overridessays that the store also keeps a hand-set price in USD for it, which was not changed.A-200-REDwas refused because somebody set 86.90 in the store after you read 84.90.A-300already had the price you sent.A-400would have gone to a hundred times its price. - Tell the owner where to look. Every applied request appears in the store panel under Products > Price manager > History as a batch made through the API. The owner can undo a batch there, so a wrong list is put right in one step and without your program.
All or partial
Mode all (the default) changes nothing when one row is refused and answers 409 price_rejected with the result of every row; rows that were fine come back as not_applied. Use it for prices that belong together, such as a campaign. Mode partial applies the good rows and answers 200 with updated, unchanged, rejected and results; use it for the routine sync and deal with the refused rows one by one.
Failures to handle
| Reason / status | What to do |
|---|---|
unchanged (status) | The store already has these figures. Nothing was written and nothing appears in the price history. Treat the row as done. |
expected_mismatch | The store's price is no longer the one you expected: a person changed it in the panel, or another program did. price and sale_price are the current figures. Do not simply send again with the new figure: let your program, or a person, decide which price is right. |
sale_not_lower | A sale price must be lower than the price the row ends up with. This also happens when you change only price and the sale price stored in the store is no longer below it, and for variants that follow the product's price. Send both members together, or remove the sale price with "sale_price": null. |
change_too_large | The price would leave the range of one tenth to 10 times what it was before the API's first change within 24 hours (see the guard on price writes). Almost always a misplaced decimal point or a wrong unit: check the row. If the price is really meant, a person sets it in the store panel. Never split the change into steps. |
unknown_sku | No such stock code in the store, or the product is in the recycle bin. Check the mapping. |
ambiguous_sku | Two units in the store share this code. A person has to make the codes unique in the store panel. |
duplicate_sku | The same unit appears twice in your request (codes are compared without regard to case). Send one row per unit. |
not_a_variant | "price": null means "follow the product's price again" and is possible only on a variant. A product always has a price. |
variant_not_recorded | The price history of this store cannot record variants yet (a database update of the store is pending), so the API does not change variant prices there. Tell the store owner; until then variant prices are changed in the panel. |
Also plan for 429 daily_limit after 20,000 price rows of one key in a day (a reason to send only the rows that differ), 503 unavailable when a row is locked at that moment (repeat with the same Idempotency-Key), and the limit of 30 writes a minute. Campaign prices of the store are worked out from the prices you write, as they are after a change in the panel.
New products from a product-information system
Goal: a product that is new in the product-information system appears in the store as a draft with its basic data, ready for the owner to add pictures and a description and to publish it.
Permissions: products:write; products:read as well if the program checks stock codes before it creates.
- Once: call
GET /v1/storeand savecurrency; the product's price must be in it. Ask the store owner for the ids of the categories and brands your products belong to: the API has no endpoint that lists them, and an id that does not exist is refused with422. - Check the stock code (optional, needs
products:read). The store refuses a code that is taken anyway; the check saves you a refused request.curl# is the stock code free? Drafts are returned only with status=draft, so ask twice curl -sS "https://example.com/api/v1/products?sku=PLA-1KG-RED" \ -H "Authorization: Bearer $ORIGELA_API_KEY" curl -sS "https://example.com/api/v1/products?sku=PLA-1KG-RED&status=draft" \ -H "Authorization: Bearer $ORIGELA_API_KEY" # -> { "data": [], "next_cursor": null } both empty: no product outside the recycle bin has this code - Create the draft with
POST /v1/products, one product per request. Build theIdempotency-Keyfrom the stock code, so that a repeat after a lost answer does not create a second product.curlcurl -sS -X POST "https://example.com/api/v1/products" \ -H "Authorization: Bearer $ORIGELA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: pim-product-PLA-1KG-RED-v1" \ -d '{"name":"PLA filament 1 kg, red","sku":"PLA-1KG-RED","currency":"EUR","price":"24.90","stock":25, "tax_rate":"20.00","weight_kg":"1.200","category_id":3, "short_description":"1.75 mm, 1 kg spool."}' # -> 201 { "data": { "id": 512, "sku": "PLA-1KG-RED", "name": "PLA filament 1 kg, red", "status": "draft", # "price": "24.90", "sale_price": null, "currency": "EUR", "stock": 25, ... } } - Save the
idof the answer with your record. The product is a draft: it is not in the storefront, the sitemap, the feeds or the search, andGET /v1/productsreturns it only withstatus=draft. - The owner publishes. In the store panel the owner opens the draft, adds what the API does not take, and sets it to active. Your program cannot do that step, and cannot change or delete the product afterwards. Stock and price of the draft can still be written by stock code with
PATCH /v1/stockandPATCH /v1/prices, if the key has those permissions.
What is accepted and what is not
| Accepted | Not accepted |
|---|---|
Name, stock code, price and sale price in the store's currency, stock quantity (or null for "not tracked"), tax rate, weight, GTIN, manufacturer part number, one category, one brand, a short description in plain text. | Images and other files, variants and options, a long or formatted description, any HTML (a < or > anywhere in a text is refused), web address (slug) and search-engine fields, status, translations, prices in other currencies, cost price. |
Text is taken as plain text and stored as it is: no markup, no control or invisible characters, no blank at either end; line breaks only in short_description. The name needs at least one letter or digit. A member that is not in the list of the reference is refused, like everywhere in the API.
Failures to handle
409sku_exists: a product or variant already has this stock code; products in the recycle bin count, and so do drafts. If it is the product you created earlier, you are done. Otherwise do not invent another code: the owner decides.409product_limit: the store has as many products as its plan allows; drafts count. Stop and tell the owner.429daily_limit: a key can create at most 500 products a day. Continue the next day.422invalid_parameter:fieldnames the member. Common cases:currencyis not the store's;priceis a number instead of text or has not exactly two decimals;sale_priceis not lower thanprice;category_idorbrand_iddoes not exist;gtinhas a wrong check digit, is not 8, 12 or 13 digits long, or belongs to another product;namecontains markup.- No answer,
503: repeat with the sameIdempotency-Key.409request_in_progress: look the stock code up (step 2) before you decide.