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
| Parameter | Type | Description |
|---|---|---|
| id | string | Opaque identifier, prefixed ord_. |
| reference | string | Your own order number, e.g. ESR-2026-0431. Unique per account. |
| buyer | object | Expanded buyer with id and name. Use ?expand=buyer for the full object. |
| unit_id | string | The manufacturing unit the order is assigned to. |
| status | enum | enquiry, quoted, in_production, qc_hold, ready_to_dispatch, dispatched, payment_due, closed, cancelled. |
| stage | enum | null | cutting, printing, stitching, qc, packing. Null unless status is in_production or qc_hold. |
| line_items | array | One entry per product line, each with hsn, quantity and rate. |
| quantity | object | Rolled-up quantity across line items: { value, uom } where uom is a UQC code. |
| value | object | Taxable value as { amount, currency }. Amount is in paise. |
| ordered_on | date | Calendar date the order was confirmed. |
| due_on | date | Committed delivery date. |
| dispatched_on | date | null | Set when dispatch is recorded. |
| metadata | object | Up to 20 key-value pairs of your own. Never interpreted by us. |
| created_at | timestamp | ISO 8601 with offset. |
| updated_at | timestamp | ISO 8601 with offset. |
Orders
GET/v1/orders
List orders, newest first, with optional filters.
Requires scope orders:read
| Parameter | Type | Description |
|---|---|---|
| status | enum | Filter by status. Repeat the parameter to pass several. |
| stage | enum | Filter by current production stage. |
| unit_id | string | Restrict to one manufacturing unit. |
| buyer_id | string | Restrict to one buyer. |
| due_before | date | Orders due on or before this date. |
| updated_since | timestamp | For incremental sync. Use this rather than polling everything. |
| limit | integer | 1 to 100. Defaults to 25. |
| cursor | string | The next_cursor from the previous page. |
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
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() }
){
"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
| Parameter | Type | Description |
|---|---|---|
| stagerequired | enum | cutting, printing, stitching, qc or packing. |
| quantity_completed | object | Partial completion, as { value, uom }. Omit for a full stage completion. |
| operator_id | string | Who completed it. Required if your account enforces operator attribution. |
| machine_id | string | The machine used. Links Vision defects to this stage. |
| occurred_at | timestamp | Defaults to now. Set it when syncing an offline update. |
| note | string | Free text, up to 500 characters. Shown in the stage history. |
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"
}'{
"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.
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){
"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 -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.
| Path | Adds |
|---|---|
| buyer | The full buyer object with GSTIN, addresses and credit terms |
| line_items.stage_history | Per-line stage completions with durations |
| invoice | The invoice, IRN and e-way bill state |
| defects | Vision defect events linked to this order |
| unit | The manufacturing unit with address and GSTIN |