Guide
How to create and post a sales order with the Business Central API
Updated 2 November 2026
Creating a sales order takes up to three calls: create the order, add its lines, then ship and invoice it. The examples use the v2.0 API, and assume you can already sign in and have your company's id.
1. Create the order
POST https://api.businesscentral.dynamics.com/v2.0/<tenant-id>/<environment>/api/v2.0/companies(<company-id>)/salesOrders
Authorization: Bearer <access-token>
Content-Type: application/json
{
"orderDate": "2026-11-02",
"customerNumber": "10000"
}
A successful call returns 201 Created and the new order. Keep its id for the next steps. Business Central fills in the rest, such as the customer's name, addresses and payment terms, from the customer record.
2. Add the lines
POST .../companies(<company-id>)/salesOrders(<order-id>)/salesOrderLines
Content-Type: application/json
{
"lineType": "Item",
"lineObjectNumber": "1996-S",
"quantity": 12
}
Here lineObjectNumber is the number of the item or account the line is for, and lineType says which kind it is.
Microsoft also describes a deep insert, where child records go inside the parent's POST body when $metadata exposes them as a navigation property. Its published example uses sales quotes, so test it against your own version before relying on it for orders.
3. Ship and invoice it
Posting isn't a field you change. It's a bound action, called with a POST and no body:
POST .../companies(<company-id>)/salesOrders(<order-id>)/Microsoft.NAV.shipAndInvoice
A successful call returns 204 No Content.
Common errors
- "A customerNumber or a customerID must be provided." The order has no customer.
- "You may not enter numbers manually." The number series doesn't allow it. Leave
numberout and let Business Central assign one. - "Control '…' is read-only." Remove that field from the body. Totals, for example, are calculated.
More in Business Central API errors explained.
The same thing in Ava
In Explore, pick salesOrders and choose Create. Tick the fields you want, and tick salesOrderLines to include lines. Ava writes the JSON from your own tenant's $metadata, so it includes your extensions' fields too. shipAndInvoice is listed under What you can do, with its URL already built.
