POST/api/orders

Create a draft order

Creates a new draft order with one or more item lines. Provide customerId, source, and lines; prices are resolved and recorded when you confirm the order, not when you create it. The server generates the order number and returns the created order with its lines.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

5 body fields

The customer, order source, and at least one order line.

customerIdstringrequired
The unique identifier of the customer placing the order.
sourcestringrequired
How the order was received: phone, walk_in, email_import, or self_service.
Allowed:phonewalk_inemail_importself_service
requestedDeliveryDatestringoptional
The day it ships. Production and packing group by this, not the order date (D-14).
specialInstructionsstringoptional
An order-level note.
linesarray<object>required
The order lines. Include at least one line; each line requires `itemId`, `qty`, `rawBaked`, `loosePacked`, and `sliced`.

5 status codes
201Returns the created draft order, including its generated identifier and order number, customer and order details, and lines.
idstringoptional
Order id.
orderNumberstringoptional
Human-facing, `ORD-YYMM-NNN`.
customerIdstringoptional
Customer id.
customerNamestringoptional
customerTypeSnapshotstringoptional
The customer's type AT ORDER TIME — it may change later, and the order keeps what it was sold under.
orderDatestringoptional
The day the order was taken.
requestedDeliveryDatestringoptional
The day it ships — what production and packing group by (D-14).
statusstringoptional
Allowed:draftconfirmedin_productionpackingshippingshippedclosed
sourcestringoptional
Allowed:phonewalk_inemail_importself_service
specialInstructionsstringoptional
Order-level note.
createdByIdstringoptional
createdByNamestringoptional
createdAtstringoptional
fromRecurringIdstringoptional
The standing order that generated this one (R6). Null for every hand-taken order. Note the `source` does NOT distinguish one: a generated order says `phone`, because the OrderSource enum was deliberately left untouched.
linesarray<object>optional
400Returned when the input is invalid; the response includes an `error` string describing the problem.
errorstringrequired
401Returned when the request is unauthenticated; sign in before calling this operation.
errorstringrequired
403Returned when the authenticated user lacks the required department membership or role.
errorstringrequired
500Returned when an unexpected server error occurs.
errorstringrequired

Error handling

A 400 is returned for invalid input; a 401 when the request is unauthenticated; a 403 when the authenticated user lacks the required department membership or role; and a 500 for an unexpected server error. customerId, source, and lines are required, lines must contain at least one item, and each line must include itemId, qty, rawBaked, loosePacked, and sliced. source, rawBaked, loosePacked, and sliced must use their listed enum values.