Orders and returns

Pulling orders into a CRM or the books, moving a status by an action, payment as a separate axis, returns and exchanges.

Orders

Permission: orders.manage.

GET   /api/v2/admin/orders
GET   /api/v2/admin/orders/{id | external_id | number}
PATCH /api/v2/admin/orders/{key}                       external_id only
POST  /api/v2/admin/orders/{key}/actions/status        move the status

An order is not created through the admin half: an order is placed — through the cart and checkout or by a manager in the admin. An order’s lines, amounts and customer are not changed through the API.

Filters and sorts

ParameterWhat it does
statusa shop status’s code (see below)
payment_statethe payment state
emailthe customer’s email, exactly
updated_aftereverything changed since a moment — new orders, status moves, payments
order[id], order[order_number], order[created_at], order[updated_at], order[total]sort

The answer

{
  "data": {
    "id": 30,
    "url": "https://shop.example/api/v2/admin/orders/30",
    "external_id": null,
    "number": "TG-000123",
    "status": "open",
    "payment": {
      "state": "pending",
      "paid_total": "0.00",
      "prepaid_total": 0,
      "deposit": null,
      "paid_at": null,
      "method": "Cash on delivery",
      "method_id": 2,
      "currency": "UAH",
      "amount": "1049.00",
      "payments": []
    },
    "customer": { "name": "Ivan Petrenko", "email": "ivan@example.com",
                  "phone": "+380675550128", "user_id": null },
    "delivery": {
      "method": "Nova Poshta — branch",
      "address": null, "city": "Kyiv", "country": "UA", "postal_code": null,
      "cost": "50.00",
      "details": { "carrier": "novaposhta", "warehouse_ref": "…", "warehouse_name": "Branch No. 1" }
    },
    "currency": "UAH",
    "subtotal": "999.00",
    "discount": "0.00",
    "total": "1049.00",
    "items": [
      { "key": "1", "product_id": 1, "sku": "ST-1001", "name": "Phone Alpha 256GB",
        "qty": 1, "unit_price": "999.00", "line_total": "999.00", "warehouses": { "2": -1 } }
    ],
    "adjustments": [
      { "code": "vat", "label": "VAT 20%", "amount": "166.50", "included": true }
    ],
    "notes": null,
    "fields": [ { "code": "call_time", "label": "When to call", "value": "after 6 pm" } ],
    "source": "api",
    "locale": "en",
    "ip_address": "203.0.113.10",
    "created_at": "2026-10-21T19:24:31+03:00",
    "updated_at": "2026-10-21T19:24:31+03:00"
  }
}
FieldWhat it is
numberthe order number the customer sees; the order can be addressed by it
external_idyour id of the order — the only thing PATCH can write
statusa status from the shop’s list; moved only by the status action
paymenta separate axis from the status: an order can be “paid and shipped”
payment.statepending (nothing has arrived — a new order, and cash on delivery), authorized (the money is held on the card), paid, partially_paid, partially_refunded, refunded, failed, expired
payment.paid_totalwhat has actually arrived; not derivable from state
payment.prepaid_totalthe part paid before any bank (a gift card)
payment.depositthe prepayment, when the order was sold with part paid online
payment.method, method_idthe payment method: its name at the time of the order, and the link to the method
payment.currency, amountwhich currency and how much the bank was asked for (the total minus prepaid_total)
payment.payments[]each payment at a gateway on its own: gateway, external_id (the gateway’s id), state, requested, held, order_id
customer.user_idthe customer’s account; null — a guest
delivery.methodthe delivery’s name at the time of the order
delivery.detailswhat was chosen on top of the address — a branch, a pickup point, the carrier’s data (each carrier has its own keys)
currency, subtotal, discount, totalthe shop’s books currency and the amounts as decimal strings with two places; a line’s unit_price has the places a price has
items[]the lines as bought: the name and price at the time, not today’s catalogue; warehouses — which warehouses gave how many
adjustments[]what else the total is made of: taxes, surcharges; included: true — the amount is already inside the prices and only disclosed
fields[]answers to the shop’s own checkout questions: code, label, value
sourcehow it was placed: checkout (the site), one_click, admin (a manager), api, exchange; null on old orders
localethe customer’s language — emails and printed forms use it
ip_addresswhere it was placed from; null — not from a browser

Statuses

Statuses are the shop’s own list (the “Order statuses” screen in the admin), which the shop may change: add its own, rename. By default:

CodeStatus
awaiting_paymentAwaiting payment — an unpaid online order, holds no stock
openOpen
processingProcessing
shippedShipped
completeComplete
backorderedBackordered
declinedDeclined
failedFailed
cancelledCancelled
mergedMerged into another order

The codes in use are visible in the answers (status) and in the admin.

Move the status

curl -s -X POST https://shop.example/api/v2/admin/orders/TG-000123/actions/status \
     -H "Authorization: Bearer $TG_TOKEN" -H 'Content-Type: application/json' \
     -d '{"status": "shipped"}'

The same code runs as when a status is picked in the admin: stock moves (a cancellation puts goods back), the change goes into the order’s history, the customer gets the status email, automations fire. The answer is the order after the move.

Remember your own id

curl -s -X PATCH https://shop.example/api/v2/admin/orders/TG-000123 \
     -H "Authorization: Bearer $TG_TOKEN" -H 'Content-Type: application/json' \
     -d '{"external_id": "CRM-58812"}'

From then on the order is found as /admin/orders/CRM-58812.

Returns and exchanges

Permission: rma.manage. The Returns module (torgash.rma).

GET  /api/v2/admin/returns
GET  /api/v2/admin/returns/{id}
POST /api/v2/admin/returns/{id}/actions/approve
POST /api/v2/admin/returns/{id}/actions/decline
POST /api/v2/admin/returns/{id}/actions/receive
POST /api/v2/admin/returns/{id}/actions/refund
POST /api/v2/admin/returns/{id}/actions/exchange

A return is the goods, the money and the shop’s acts. The conversation about a return is an enquiry, read through /admin/enquiries/{enquiry_id} (see Enquiries).

Filters: state, resolution (refund / exchange — what the customer wants), order_id, open=1 (the queue: everything neither declined nor completed), updated_after. Sorts: order[id], order[created_at], order[updated_at], order[received_at], order[completed_at].

{ "data": {
    "id": 5, "enquiry_id": 41, "order_id": 30, "order_number": "TG-000123",
    "resolution": "refund", "state": "approved",
    "lines": [ { "product_id": 1, "sku": "ST-1001", "name": "Phone Alpha 256GB",
                 "qty": 1, "unit_price": "999.00", "line_total": "999.00" } ],
    "lines_total": 99900,
    "disposition": null, "warehouse_id": null, "refund_amount": null,
    "exchange_order_id": null, "surcharge": null,
    "received_at": null, "completed_at": null,
    "allows": ["receive", "decline"],
    "created_at": "…", "updated_at": "…" } }

allows — the actions possible right now: the same list the admin draws its buttons from. An action not on it is 422 with errors.state. The states: requested → approved / declined → received → completed.

ActionBodyWhat it does
approve{"note": "…"} (optional)say yes; note goes to the customer as a reply in the enquiry
decline{"note": "…"}say no; put the reason in note — the customer reads it
receive{"disposition": "restock" | "writeoff", "warehouse_id": 2, "note": "…"}the parcel is here — only now does stock move. restock puts it back, writeoff writes it off (a warranty fault). Without warehouse_id — back to the warehouses it shipped from
refund{"amount": "999.00", "note": "…"}give the money back, a decimal string in the books currency. Where a gateway took it, the gateway is asked; a held but uncaptured amount is released. Without a gateway the refund is recorded and a person makes the transfer
exchange{"surcharge": "none" | "due" | "owed", "note": "…"}place a new order for the same goods to the same address, linked to the old one; priced from today’s catalogue, surcharge records who owes whom (no money is taken)

The refund need not equal lines_total: a shop may keep the postage or agree on something else.