Omono API
Menu Guides

Plan the dispatches for an order

View as Markdown

Use this recipe when another system plans how a sales order ships, for example a planning tool that splits an order into weekly shipments. You add the dispatches, move their dates as plans change, and remove the ones you no longer need. Your staff allocate, pick and ship them in Omono.

Every request in this recipe sends your API key in an Authorization: Bearer <key> header, and every POST and PATCH also sends an Idempotency-Key. Paths are relative to https://<host>/api/v1, and the examples show the full path.

Note: The dispatch write operations are in beta. Learn more about beta operations.

You need the scopes sales:read and sales:write.

What you can change, and when#

A dispatch moves through your organisation's workflow statuses. Creating, changing and deleting a dispatch through the API never moves stock, so each change is allowed only at the stages where it can't:

Stage of the dispatch Date Line items Delete
The first, unallocated stage Yes Yes Yes, if nothing is picked
Allocated, or later Yes Serial numbers only No
Shipped (the final status) No Serial numbers only No

Goods that were picked can't come off a dispatch: you can't remove a line item or lower its quantity below what was picked. If any of an assembly's components were picked, you can't remove the assembly or lower its quantity at all. Learn more about dispatches and invoicing.

Steps#

  1. Read the order. GET /api/v1/sales-orders/{id}?include=dispatches returns the line items, the dispatches and the order's ETag. For each line item, the quantity you can still plan is its quantity minus the quantities on its dispatches.

  2. Add a dispatch for each shipment.

    POST /api/v1/sales-orders/{id}/dispatches
    Idempotency-Key: plan-1042-week-41
    Content-Type: application/json
    
    {
      "dispatchDate": "2026-10-09",
      "lineItems": [
        { "salesOrderLineItemId": "…", "quantity": 40 }
      ]
    }
    

    You can add dispatches to a Draft order and to an active one. A Draft that isn't a call-off can be activated only when its dispatches cover every line item in full.

  3. Move a shipment. Send the new date in a PATCH, with the order's ETag from your last read:

    PATCH /api/v1/sales-orders/{id}/dispatches/{dispatchId}
    If-Match: "1759480012345"
    Idempotency-Key: plan-1042-week-41-move
    Content-Type: application/json
    
    { "dispatchDate": "2026-10-16" }
    

    If the new date is later, Omono emails the staff your organisation chose to tell about late dispatches, as it does in Omono.

    A date change counts against your rate limits as one write for every 10 of the dispatch's line items, because Omono saves them all again.

  4. Change the quantities. While the dispatch is unallocated, send the line items to change in lineItems. Send "delete": true to take a line item off the dispatch. The quantities on all of a line item's dispatches can't add up to more than the line item's quantity.

  5. Remove a shipment. DELETE /api/v1/sales-orders/{id}/dispatches/{dispatchId} with If-Match removes an unallocated dispatch with nothing picked. It returns 204. A DELETE doesn't need an Idempotency-Key: if you send it again after it worked, it fails with a 404 error, which means the dispatch is already gone. Learn more about deleting a dispatch.

Every successful write returns the order's new ETag. Use it for your next write, or read the order again.

Errors to handle#

Status Code What to do
409 dispatch-allocated The dispatch is past the unallocated stage, so its quantities can't change and it can't be deleted. Ask your staff to unallocate it in Omono, or plan the change on another dispatch.
409 dispatch-picked Goods on the dispatch are picked. Leave the picked quantities on it.
409 dispatch-shipped The dispatch has shipped. Its date and quantities are final.
409 quantity-exceeds-remaining A quantity is more than is left to plan on its line item, and the message says how many are left. Read the order again.
409 sales-order-locked The order is cancelled.
412 precondition-failed The order changed since you read it. Read it again, check your plan, and retry with the new ETag.
503 temporarily-unavailable Another request, or a save in Omono, is changing the same order's dispatches. Retry after the number of seconds in Retry-After.