Push orders into Omono
Use this recipe when orders arrive somewhere else first, for example in a web shop, and you want them in Omono as sales orders. You look up a few IDs once, and then create each order, add its dispatch and activate it with three calls.
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, so a prompt retry doesn't do the work twice. Paths are relative
to https://<host>/api/v1, and the examples show the full path.
Note: The sales order write operations are in beta, and you can use this recipe once they appear in the API reference for your platform.
You need the scopes sales:read, sales:write, companies:read,
stock:read and reference:read.
Before your first order#
Look up the IDs you need and cache them. Look them up again whenever your reference data changes.
- The customer. Find the company with
GET /companies?accountNo=<your account number>, or withcompanyName=<name>, and take itsid. Note itscurrencyIdtoo, for the exchange rate below. Learn more about companies. - The contact. Choose one of the customer's contacts from
GET /companies/{id}/contacts, for example the one whoseemailmatches your shop's customer. - The delivery address. Omono addresses have no delivery flag, so
match your shop's shipping address to one from
GET /companies/{id}/addresses, for example by itspostcodeandline1. If none matches, you can deliver to the customer's accounts address, the one whoseaccountsAddressistrue, and flag the order for your staff to check. Or, if your key also hascompanies:write, add the new address withPOST /companies/{id}/addressesand use itsid. - Each product. Find the stock item with
GET /stock-items?partNo=<part number>. Only stock items withcanSell: truecan go on a sales order. - The sales person. Choose a user from
GET /userswhoseassignablefield istrue, which means you can name that user on a record. Many integrations use a user that your staff set up in Omono for this, such as "Web shop", so that web orders are easy to find. - The exchange rate. Read your base currency from
GET /organisation, inbaseCurrencyId. If the customer'scurrencyIdis the same, send anexchangeRateof 1. Otherwise, take the currentratefor the customer's currency fromGET /currency-rates. Learn more about money and exchange rates.
Your organisation can require a customer order number on every sales
order. Read salesOrders.customerOrderNoRequired from GET /settings to
find out. When it's required, send the reference your customer gave you,
or your own order number if they gave none.
For each order#
Give each order your own reference. Send your web shop's order number in
externalRef. It's unique among your organisation's sales orders, cancelled ones included, so Omono never creates the same order twice, even long after anIdempotency-Keyhas expired. If you send an order again, the create fails with a409error and the codeduplicate-external-ref, andconflictingIdis the order you created before: read it instead. KeepcustomerOrderNofor the reference that your customer gave you, because it prints on the order paperwork. Learn more about external references.Create the order and its line items in one call.
POST /api/v1/sales-orders Idempotency-Key: shop-order-10452 Content-Type: application/json { "companyId": "…", "contactId": "…", "addressId": "…", "salesPersonId": "…", "exchangeRate": 1, "externalRef": "WEB-10452", "customerOrderNo": "PO-7731", "lineItems": [ { "stockItemId": "…", "quantity": 2, "price": 19.5, "externalRef": "WEB-10452-1" }, { "stockItemId": "…", "quantity": 1, "price": 120, "externalRef": "WEB-10452-2" } ] }For each line item, you send only the stock item, the quantity and the price. Omono fills in the tax rate from the customer, and the sales analysis code and the description from the stock item. A sales analysis code is a category you use to analyse your sales. The
201response returns the order with the statusdraft, itsETag, andcreatedLineItems, which gives the ID of the new line item made from each position in your array. Learn more about creating a document with its line items and the fields Omono fills in.Add a dispatch. A dispatch is a shipment that delivers the order. As in Omono, an order can only be activated once all of its line items are on dispatches, so add one dispatch that ships everything, using the line item IDs from
createdLineItems:POST /api/v1/sales-orders/{id}/dispatches Idempotency-Key: shop-order-10452-dispatch Content-Type: application/json { "dispatchDate": "2026-10-05", "deliveryNotes": "Gate code 1234. Deliver to the rear entrance.", "lineItems": [ { "salesOrderLineItemId": "…", "quantity": 2 }, { "salesOrderLineItemId": "…", "quantity": 1 } ] }Put the customer's delivery instructions from your checkout in
deliveryNotes. The delivery note prints them, so your warehouse and the carrier see them. Leave it out if there are none.To ship the order in parts, add one dispatch for each part. The quantities on the dispatches must add up to each line item's quantity. Creating a dispatch doesn't allocate stock, so it's safe to do on a draft. The
201response returns the dispatch, and itsETagis the order's newETag. Skip this step if the order is a call-off (callOff: true): a call-off can be activated without dispatches.Activate the order. Call
POST /api/v1/sales-orders/{id}/activate, with a newIdempotency-Keyand theETagfrom the dispatch's201response in anIf-Matchheader. Send it without a body. It returns200with{ "applied": true, "salesOrder": … }. The order is now part of your workflow, and your staff allocate, pick and ship its dispatches in Omono. Learn more about ETags and lifecycle actions.
Errors to handle#
Each code links to its own page. The Errors guide explains the format of every error, and Retry requests safely explains how keys work.
| Status | Code | What to do |
|---|---|---|
| 422 | missing-required-field |
You left out a field that's required, and errors[].field names it. For example, addressId is required unless customerCollection is true, and your organisation's settings can require customerOrderNo. The error also comes when the customer has no account manager. Nothing was written, and no order number was used. |
| 422 | validation-failed, invalid-reference |
A value is wrong, and errors[].field names it, for example lineItems[1].stockItemId. Fix the data instead of retrying the same request. Omono reports the first problem it finds, so a fixed request can name another field. |
| 409 | duplicate-external-ref |
You sent this order before: conflictingId is the order Omono already has, so read it instead of creating it again. |
| 409 | dispatches-incomplete |
On /activate, the order's dispatches don't cover all of its line items. Each entry in errors names a line item and how much of it is on dispatches. Add a dispatch for the rest, then retry /activate with the new ETag. |
| 409 | no-line-items |
On /activate, the order has no line items, and errors[].field is lineItems. Add them with a PATCH, then retry /activate with the new ETag. |
| 409 | company-archived |
The customer is archived. Ask your staff whether to unarchive it. |
| 412 | precondition-failed |
On /activate, someone changed the draft after you created it. Read the order again, check it, and retry /activate with the new ETag. You can reuse the same Idempotency-Key, because Omono doesn't store a failed request. |
| 409 | idempotency-in-progress |
A request with the same key is still running. Wait for the number of seconds in Retry-After, then retry. |
| 409 | idempotency-key-reuse |
You sent a key again to the same operation with a different body, so your integration is using one key for two orders. Give each shop order its own key, and send that same key only when you retry that order. |
| 409 | create-incomplete |
An earlier attempt with this key stopped part-way, and someone has changed the draft order it left. Don't create the order again, and don't switch to a new key. Read the draft that keptDocument names, and finish it with a PATCH or leave it to your staff. |
| 429, 503 | rate-limited, temporarily-unavailable, request-timeout |
Retry the same request, with the same Idempotency-Key, after the number of seconds in Retry-After. If there's no Retry-After header, wait 60 seconds. |
| 500 | internal-error |
If the error names a draft order in keptDocument, don't retry and don't use a new key. Read that draft, add the line items that aren't in its createdLineItems with a PATCH, and then activate it. Otherwise, retry once with the same Idempotency-Key. Recover from a failed create explains both cases. |