Create Sales Order
create_sales_orderCreate a LIVE customer SALES ORDER through the same lifecycle the Sales Orders page uses: it gets a document number, price-book pricing, tax and totals, and (when submitted) reserves stock and appears in picking. Use this for a real, open order to fulfil; use import_historical_sales_orders only for already-completed history and push_external_sales_orders only for orders fulfilled at an External warehouse. Give the store (storeId from list_warehouses' stores[].storeId — or warehouseId when that warehouse has exactly one store), the customer (customerId, customerEmail, or customerName — an unmatched name is kept as free text like the UI allows), and the lines (each itemSku, itemUpc or itemId plus a quantity; unitPrice optional — omit it to price from the price book). submit=false (default) leaves an editable draft (status "created", no reservations); submit=true issues it, which reserves stock and lands it in "pending" for picking — or in "waitingApproval" when the tenant's sales-approval flow is on. A draft is not checked against stock, so a future order (set requestedShipDate) can be recorded before the stock exists: a shortfall is returned as a warning. Submitting refuses quantities above available stock for items that do not allow backorders, exactly as the UI's Issue does. A client-pinned token only resolves its own client's items and stamps the order to that client; an operator token on a 3PL tenant must pass clientId. Max 500 lines per call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"lines": "<lines>"
},
"name": "create_sales_order"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Optional customer-facing note. | |
| lines | Yes | The lines to sell (max 500). Each names an item and a quantity. | |
| submit | No | false (default) = leave an editable draft (status "created", no stock reserved). true = also submit it: reserves stock and moves it to "pending" for picking, or to "waitingApproval" when the tenant's sales-approval flow is on. | |
| preview | No | Step 1 of the required two-step write: set true to validate and receive a structured preview plus a single-use previewReceipt. Nothing is created until the commit call. | |
| storeId | No | Store id (GUID) the order belongs to — from list_warehouses' stores[].storeId (NOT the warehouse id). Provide storeId or warehouseId. | |
| clientId | No | Optional 3PL client id (GUID) to stamp the order to. Required for an operator (unpinned) token on a 3PL tenant; refused when it differs from a pinned token's client. | |
| orderDate | No | Optional order (demand) date, ISO 8601. Omit to date the order now. A bare date is that calendar day in the tenant's time zone. | |
| customerId | No | Customer id (GUID). Provide one of customerId, customerEmail, customerName. | |
| warehouseId | No | Warehouse id (GUID) to fulfil from — accepted instead of storeId when the warehouse has exactly one store. | |
| customerName | No | Customer name — resolved to the customer record with that exact name; when none matches it is recorded as free text on the order (no customer record is created). | |
| internalNote | No | Optional internal note (never shown to the customer). | |
| customerEmail | No | Customer email — resolved to the customer record with that email (exact match). | |
| idempotencyKey | No | Caller-generated idempotency key; required with previewReceipt to commit. | |
| previewReceipt | No | Step 2 of the required two-step write: the receipt returned by the preview call. Supply together with a fresh idempotencyKey to commit; calls without it are refused. | |
| requestedShipDate | No | Optional date the customer asked the order to ship, YYYY-MM-DD on the tenant's calendar (a wholesale or pre-book date). While the order is open its units count as demand on that date in the stock projection and reorder timing. | |
| scheduledPickupAt | No | Optional scheduled pickup/delivery date-time (ISO 8601). | |
| customerPurchaseOrder | No | Optional customer purchase-order reference recorded on the order. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| number | No | ||
| status | No | ||
| preview | No | ||
| storeId | No | ||
| clientId | No | ||
| warnings | No | ||
| expiresAt | No | ||
| lineCount | No | ||
| submitted | No | ||
| customerId | No | ||
| totalAmount | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| customerName | No | ||
| salesOrderId | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| approvalRequired | No | ||
| approvalRuleName | No | ||
| idempotentReplay | No |