Skip to content

Documentation

Flow API reference

Everything an order does, as HTTP. The object model is small on purpose: an order has line items, moves through stages, produces an invoice, and gets dispatched.

The order object

Fields on the order object
ParameterTypeDescription
idstringOpaque identifier, prefixed ord_.
referencestringYour own order number, e.g. ESR-2026-0431. Unique per account.
buyerobjectExpanded buyer with id and name. Use ?expand=buyer for the full object.
unit_idstringThe manufacturing unit the order is assigned to.
statusenumenquiry, quoted, in_production, qc_hold, ready_to_dispatch, dispatched, payment_due, closed, cancelled.
stageenum | nullcutting, printing, stitching, qc, packing. Null unless status is in_production or qc_hold.
line_itemsarrayOne entry per product line, each with hsn, quantity and rate.
quantityobjectRolled-up quantity across line items: { value, uom } where uom is a UQC code.
valueobjectTaxable value as { amount, currency }. Amount is in paise.
ordered_ondateCalendar date the order was confirmed.
due_ondateCommitted delivery date.
dispatched_ondate | nullSet when dispatch is recorded.
metadataobjectUp to 20 key-value pairs of your own. Never interpreted by us.
created_attimestampISO 8601 with offset.
updated_attimestampISO 8601 with offset.

Orders

GET/v1/orders

List orders, newest first, with optional filters.

Requires scope orders:read

Query parameters for listing orders
ParameterTypeDescription
statusenumFilter by status. Repeat the parameter to pass several.
stageenumFilter by current production stage.
unit_idstringRestrict to one manufacturing unit.
buyer_idstringRestrict to one buyer.
due_beforedateOrders due on or before this date.
updated_sincetimestampFor incremental sync. Use this rather than polling everything.
limitinteger1 to 100. Defaults to 25.
cursorstringThe next_cursor from the previous page.
curl
curl "https://api.easarctech.com/v1/orders?status=in_production&unit_id=unt_02&limit=25" \
  -H "Authorization: Bearer esk_live_7f3a9c2e8b14d05a" \
  -H "Easarc-Version: 2026-08-01"

Create an order

POST/v1/orders

Create an order with its line items. Returns the created order.

Requires scope orders:write

JavaScript
const order = await easarc.orders.create(
  {
    reference: 'ESR-2026-0431',
    buyer_id: 'buy_01J8T2A5',
    unit_id: 'unt_02',
    due_on: '2026-08-02',
    line_items: [
      {
        description: 'Poly-viscose suiting, 58"',
        hsn: '5407',
        quantity: { value: 3200, uom: 'MTR' },
        // ₹186.00 per metre, in paise
        rate: 18600,
      },
      {
        description: 'Satin lining, 44"',
        hsn: '5407',
        quantity: { value: 1600, uom: 'MTR' },
        rate: 9200,
      },
    ],
    metadata: { po_number: 'RJE/PO/2026/318' },
  },
  // Safe to retry: the same key never creates a second order.
  { idempotencyKey: crypto.randomUUID() }
)
201 Created
{
  "id": "ord_01J9ZK4M7Q2X8V",
  "reference": "ESR-2026-0431",
  "buyer": { "id": "buy_01J8T2A5", "name": "Rajhans Exports" },
  "unit_id": "unt_02",
  "status": "quoted",
  "stage": null,
  "line_items": [
    {
      "id": "oli_01J9ZK4M8A",
      "description": "Poly-viscose suiting, 58\"",
      "hsn": "5407",
      "quantity": { "value": 3200, "uom": "MTR" },
      "rate": 18600,
      "taxable_value": 59520000
    },
    {
      "id": "oli_01J9ZK4M8B",
      "description": "Satin lining, 44\"",
      "hsn": "5407",
      "quantity": { "value": 1600, "uom": "MTR" },
      "rate": 9200,
      "taxable_value": 14720000
    }
  ],
  "quantity": { "value": 4800, "uom": "MTR" },
  "value": { "amount": 74240000, "currency": "INR" },
  "ordered_on": "2026-07-12",
  "due_on": "2026-08-02",
  "dispatched_on": null,
  "metadata": { "po_number": "RJE/PO/2026/318" },
  "created_at": "2026-07-12T09:14:22+05:30",
  "updated_at": "2026-07-12T09:14:22+05:30"
}

Retrieve and update

GET/v1/orders/{id}

Retrieve one order. Accepts ?expand=buyer,line_items.stage_history.

Requires scope orders:read

PATCH/v1/orders/{id}

Update due date, unit, metadata or line items. Rate changes are versioned and appear in the audit log.

Requires scope orders:write

POST/v1/orders/{id}/cancel

Cancel an order. Fails with order_not_cancellable once an invoice carries an active IRN.

Requires scope orders:write

You can address an order by its Easarc id or by your own reference — pass ref:ESR-2026-0431 in place of the id. That saves storing our identifier if you would rather not.

Production stages

POST/v1/orders/{id}/stages

Advance the order to a stage, recording who did it and when.

Requires scope orders:write

GET/v1/orders/{id}/stages

The full stage history, oldest first, with durations.

Requires scope orders:read

Body parameters when advancing a stage
ParameterTypeDescription
stagerequiredenumcutting, printing, stitching, qc or packing.
quantity_completedobjectPartial completion, as { value, uom }. Omit for a full stage completion.
operator_idstringWho completed it. Required if your account enforces operator attribution.
machine_idstringThe machine used. Links Vision defects to this stage.
occurred_attimestampDefaults to now. Set it when syncing an offline update.
notestringFree text, up to 500 characters. Shown in the stage history.
curl
curl -X POST https://api.easarctech.com/v1/orders/ord_01J9ZK4M7Q2X8V/stages \
  -H "Authorization: Bearer esk_live_7f3a9c2e8b14d05a" \
  -H "Easarc-Version: 2026-08-01" \
  -H "Content-Type: application/json" \
  -d '{
    "stage": "printing",
    "quantity_completed": { "value": 3200, "uom": "MTR" },
    "operator_id": "OP-2291",
    "machine_id": "PR-04",
    "occurred_at": "2026-07-24T14:20:00+05:30"
  }'
201 Created
{
  "id": "stg_01J9ZM8K3P",
  "order_id": "ord_01J9ZK4M7Q2X8V",
  "stage": "printing",
  "quantity_completed": { "value": 3200, "uom": "MTR" },
  "operator_id": "OP-2291",
  "machine_id": "PR-04",
  "occurred_at": "2026-07-24T14:20:00+05:30",
  "duration_from_previous_seconds": 187200,
  "order_status": "in_production"
}

Invoices, IRN and e-way bill

POST/v1/orders/{id}/invoice

Generate the tax invoice and register it with the IRP. Returns the IRN, signed QR and, optionally, the e-way bill.

Requires scope invoices:write

GET/v1/invoices/{id}

Retrieve an invoice with its IRN, signed payload and current e-way bill state.

Requires scope invoices:read

POST/v1/invoices/{id}/eway-bill/part-b

Complete Part-B with the vehicle number at the gate. Starts the validity clock.

Requires scope invoices:write

POST/v1/invoices/{id}/cancel

Cancel within 24 hours. Cancels the e-way bill first, then the IRN, in that order.

Requires scope invoices:write

Pass generate_eway_bill: true to get both in one call. Leave the vehicle number out if you do not have it yet — Part-A is registered, and Part-B is completed later from the gate.

JavaScript
const invoice = await easarc.orders.invoice('ord_01J9ZK4M7Q2X8V', {
  invoice_date: '2026-08-02',
  place_of_supply: '27',            // Maharashtra — taken from ship-to, not bill-to
  generate_eway_bill: true,
  transport: {
    distance_km: 284,
    transporter_gstin: '24AABCT1332L1ZW',
    mode: 'road',
    // vehicle_number omitted: Part-B is completed at the gate
  },
})

console.log(invoice.irn, invoice.eway_bill.number)
201 Created
{
  "id": "inv_01J9ZP2C6R",
  "order_id": "ord_01J9ZK4M7Q2X8V",
  "invoice_number": "ESR/2026-27/0118",
  "invoice_date": "2026-08-02",
  "status": "registered",
  "irn": "a4f81c9e07b2f3d5c8a1904e6b7f2c3d9e5a8b1c4d7f0a2e6b9c3d5f8a1e4d31f6a",
  "ack_no": "172310000481234",
  "ack_date": "2026-08-02T18:41:00+05:30",
  "signed_qr_code": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjE0…",
  "place_of_supply": "27",
  "taxable_value": 74240000,
  "taxes": [
    { "type": "igst", "rate": 5, "amount": 3712000 }
  ],
  "total": 77952000,
  "eway_bill": {
    "number": "391044728815",
    "part_b_complete": false,
    "valid_until": null,
    "distance_km": 284
  },
  "pdf_url": "https://api.easarctech.com/v1/invoices/inv_01J9ZP2C6R/pdf"
}

Note the tax split: place of supply 27 differs from our own state code 24, so IGST applies rather than CGST and SGST. We derive that from ship-to; you do not have to.

Dispatch

POST/v1/orders/{id}/dispatch

Record dispatch. Moves status to dispatched and triggers the buyer notification.

Requires scope dispatch:write

POST/v1/orders/{id}/deliver

Confirm delivery, optionally with a proof-of-delivery attachment.

Requires scope dispatch:write

curl
curl -X POST https://api.easarctech.com/v1/orders/ord_01J9ZK4M7Q2X8V/dispatch \
  -H "Authorization: Bearer esk_live_7f3a9c2e8b14d05a" \
  -H "Easarc-Version: 2026-08-01" \
  -H "Content-Type: application/json" \
  -d '{
    "vehicle_number": "GJ05BX4471",
    "transporter_name": "Shree Transport Lines",
    "lr_number": "STL/2026/44118",
    "dispatched_at": "2026-08-02T18:42:00+05:30",
    "notify_buyer": true
  }'

Setting notify_buyer sends the WhatsApp template message in the language on the buyer record, and completes e-way bill Part-B from the vehicle number in the same call.

Expanding related objects

Rather than following identifiers with extra requests, pass expand with a comma-separated list of dot-separated paths. Up to four levels, up to eight paths.

Expandable paths on the order object
PathAdds
buyerThe full buyer object with GSTIN, addresses and credit terms
line_items.stage_historyPer-line stage completions with durations
invoiceThe invoice, IRN and e-way bill state
defectsVision defect events linked to this order
unitThe manufacturing unit with address and GSTIN