Sales Order POST
URI
https://{DATACENTER}.brightpearlconnect.com/public-api/{ACCOUNT}/order-service/sales-order/ Refer to our documentation on URI syntax for more information on how to construct URIs.
Description
This message enables you to create new sales orders in Brightpearl.
POST creates a new order and returns its ID.
Field summary: sales order
| Field | Description | Data Type | Required | Values |
|---|---|---|---|---|
| customer.id | The ID of the customer you wish this order to be created for. | int | If customerId not supplied | |
| customerId | A top-level backward-compatible alias of customer.id. GET returns both fields with the same contact ID. | int | If customer.id not supplied | |
| customer.address | Override the address of the customer for this order. If not specified, the customer's default address from the contact record will be used. | address object (see later) | ||
| billing.contactId | The ID of the customer you wish to use as the billing contact for this order. If not specified, the primary contact of the customer's organization will be used. | int | ||
| billing.address | Override the billing address for this order. If not specified, the billing address of the billing.contactId will be used. | address object (see later) | ||
| ref | The customer reference you wish to assign to this order. | string of up to 64 characters | ||
| placedOn | The date and time this order was placed. If omitted, the current date and time are used. | string. ISO8601 format date-time. | ||
| taxDate |
The tax date of the order. If omitted, it uses the date given by placedOn; if placedOn is also omitted, it uses today's date. To specify an exact calendar date, send a date such as 2027-06-04. You can also send a full ISO 8601 date-time with a time zone. Its date is determined in the account's local time zone: 2027-06-04T17:00:00.00-07:00 becomes 2027-06-05 for an account in Europe/London. GET returns this field and invoice.taxDate as ISO 8601 date-times. |
string. ISO 8601 date or date-time with time zone. | ||
| parentId | You can use parentId if you want to link your new order to an existing order in Brightpearl. | int | ||
| statusId |
The ID of the status you wish to assign to this order. If no status ID is specified then the configured default is used. |
int | ||
| warehouseId |
The ID of the warehouse which will be used by default for fulfilment. |
int | ||
| channelId |
The ID of the channel you wish to assign this order to. |
int | ||
| externalRef | The external reference you wish to assign to this order. | string of up to 100 characters | ||
| staffOwnerId |
The ID of the staff member who owns this order. If you do not specify this value and the auto assign property is enabled in your sales settings, it will be set to the staff owner currently assigned to the customer contact. |
int | ||
| projectId |
The ID of the project you wish to assign this order to. |
int | ||
| leadSourceId |
The ID of the lead source you wish to assign this order to. If not specified the default for the customer is used. |
int | ||
| teamId |
The ID of the team you wish to assign this order to. |
int | ||
| priceListId |
The ID of the price list you wish to use for this order. If no price list ID is provided the customer's assigned price list is used. |
int | ||
| priceModeCode |
The price mode for the order. If omitted, it defaults to the mode of the effective price list: 'INC' when the price list is configured as gross, otherwise 'EXC'. |
string | 'INC' or 'EXC' | |
| costPriceListId | The ID of the cost price list to use for this order. If omitted, the account's default cost price list is used. | int | ||
| orderWeighting | The weighting of the order as a percentage. If omitted, it defaults to 100. | int | An integer between 0 and 100 inclusive. | |
| currency.code |
The currency you wish to set this order to be. If not specified the default for the customer is used. |
string. 3 chars. | ||
| currency.fixedExchangeRate |
If true, the supplied currency.exchangeRate is fixed on the order. If the exchange rate is omitted, Brightpearl obtains the configured rate for the selected currency. If false, Brightpearl obtains the configured rate and uses the rate available when the order is invoiced. Supplying currency.exchangeRate when this field is false or omitted causes a validation error. If both fields are omitted, currency.fixedExchangeRate defaults to true. |
boolean | ||
| currency.exchangeRate |
The exchange rate used to calculate base-currency amounts from the order currency. This field is optional and can be supplied only when currency.fixedExchangeRate is explicitly true. If omitted for a fixed-rate order, Brightpearl obtains the configured rate for the selected currency. |
string. A number with up to six decimal places. | ||
| paymentDueDate |
The payment due date of the order. If omitted, it is calculated from today's date and the customer's credit terms. To specify an exact calendar date, send a date such as 2027-06-04. You can also send a full ISO 8601 date-time with a time zone. Its date is determined in the account's local time zone: 2027-06-04T17:00:00.00-07:00 becomes 2027-06-05 for an account in Europe/London. GET returns this field and invoice.dueDate as ISO 8601 date-times. Only the top-level paymentDueDate field is used when creating an order. |
string. ISO 8601 date or date-time with time zone. | ||
| delivery.date | The date you wish to have the order delivered on. | string. ISO8601 format date-time. | ||
| delivery.address | The delivery address for the order | address object (see later) | ||
| delivery.shippingMethodId | The ID of the shipping method to be used to fulfil this order. | int | ||
| rows | An array of sales order rows associated with this order. | array of up to 250 row objects (see below) |
Field summary: sales order rows
| Field | Description | Data Type | Required | Values |
|---|---|---|---|---|
| productId | The ID of the product you wish to add to the order. | int | If name not supplied | |
| name | The name of the product or description of the row. | string | If productId not supplied | |
| sku | The SKU to store on the row. If omitted for a product row, the product's SKU is used. | string of up to 32 characters | ||
| quantity | The quantity of the item on this row. | string | Yes | Must be an integer for stock-tracked product or bundle rows. Can be up to 4dp otherwise. |
| taxCode | The tax code for this row. | string | Yes | |
| net | The net value of this row. | string | If using a net value | Max precision of 4dp. |
| tax | The tax value of this row. | string | If using a net value | Max precision of 4dp. |
| nominalCode |
The nominal code for this row.
If you do not provide a nominal code, then the following rules will be used to determine which nominal code will be applied to the row
|
string | ||
| externalRef | An external reference for this sales order row. | string of up to 100 characters | ||
| productPrice | The net list price of the product at the time of sale. If omitted, it is obtained from the order's effective price list where available. | string | Max precision of 4dp. | |
| discountPercentage |
The discount percentage applied to this row. This field does not trigger price calculations; it should reflect the difference between productPrice and net. |
string | Max precision of 2dp. | |
| clonedFromId | The ID of the source order row from which this row was cloned. | int | ||
| sequence |
Used to define a sorting order (ascending) for rows. Please note that the Brightpearl back-office can be configured to display rows in a number of different sort orders other than this sequence value, including name and product SKU etc. - this is visible as a property of the account configuration. If a value is not provided, a sequence number which is greater than the highest number already on the order will be used. When sorting by sequence, the row will therefore appear as the last item on the order. |
int | ||
| rowCost.averageCost | The average cost to store for this row. If both averageCost and unshippedCost are supplied, averageCost is used when creating the row cost. | string | When rowCost.unshippedCost is omitted and productId is omitted or is 1000. | Max precision of 4dp. |
| rowCost.unshippedCost | The unshipped cost to store for this row. | string | When rowCost.averageCost is omitted and productId is omitted or is 1000. | Max precision of 4dp. |
Field summary: addresses
Where the type 'address object' appears in the table above, the following fields may be used. Fields marked as required are only required if the address object is supplied (which may or may not be required).
A supplied address is used only when addressLine1 is present. If addressLine1 is omitted, the address object is discarded and the appropriate address is populated from contact data. Supplying only countryIsoCode therefore does not create a partial address override.
| Field | Description | Data Type | Required |
|---|---|---|---|
| addressFullName | The full name of the person associated with this address. | string of up to 64 characters | |
| companyName | The name of the company associated with the address. | string of up to 64 characters | |
| addressLine1 | The first line of the address (e.g. street). This field must be present for the supplied address object to be used instead of an address populated from contact data. | string of up to 256 characters | When using the supplied address object |
| addressLine2 | The second line of the address (e.g. suburb) | string of up to 256 characters | |
| addressLine3 | The third line of the address (e.g. city) | string of up to 64 characters | |
| addressLine4 | The fourth line of the address (e.g. state / province) | string of up to 64 characters | |
| postalCode | The postal/zip code of the address | string of up to 32 characters | |
| countryIsoCode | The code for the country in the address. | string. ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 format code. | Yes |
| telephone | Telephone number associated with the address | string of up to 32 characters | |
| mobileTelephone | Mobile/cell number associated with the address | string of up to 24 characters | |
| fax | Fax number associated with the address | string of up to 32 characters | |
| Email address associated with the postal address | string of up to 96 characters |
Field summary: totals
Supply both total.net and total.tax to reconcile the order totals. If either supplied total differs from the corresponding sum of the row values, one reconciliation row is created for both differences.
| Field | Description | Data Type | Required | Values |
|---|---|---|---|---|
| total.net | The total net value of the order. | string | If total.tax is supplied | Max precision of 4dp. |
| total.tax | The total tax value of the order. | string | If total.net is supplied | Max precision of 4dp. |
Additional information
- If taxDate is omitted, it is derived from placedOn or the current date as described above.
- If paymentDueDate is omitted, it is calculated from the current date and the customer's credit terms.
- Price mode can be supplied, inherited from the order's price list or inherited from the customer's price list.
- If delivery.address is omitted, the customer's delivery or default address is used.
- Note that when adding a product which is a bundle to an order, the children are automatically added as individual order lines. This relationship can be seen in the read-only properties bundleChild, bundleParent and parentRowId on a sales order GET request.
- Offer fields are legacy and are not recommended for new integrations.
Example
Creating a new sales order.
Request URI
/sales-order/
Request body
{
"customer": {
"id": 203
},
"ref": "Created via new Sales Order POST endpoint",
"placedOn": "2016-09-29T11:12:24.000+01:00",
"taxDate": "2016-06-08T12:57:25+00:00",
"parentId": 206,
"statusId": 1,
"warehouseId": 2,
"staffOwnerId": 204,
"projectId": 1,
"channelId": 2,
"externalRef": "hsdf74-2js7-jdsfi38-73jsd8",
"leadSourceId": 4,
"teamId": 1000,
"priceListId": 2,
"priceModeCode": "INC",
"currency": {
"code": "GBP",
"fixedExchangeRate": true,
"exchangeRate": "1"
},
"paymentDueDate": "2016-10-29T00:00:00.000+01:00",
"delivery": {
"date": "2016-09-29T11:12:24.000+01:00",
"address": {
"addressFullName": "John Doe",
"companyName": "Acme",
"addressLine1": "123 Example Street",
"addressLine2": "Suburbia",
"addressLine3": "Cityville",
"addressLine4": "Countyshire",
"postalCode": "BP1 2AZ",
"countryIsoCode": "GBR",
"telephone": "01234 567890",
"mobileTelephone": "070707070707",
"email": "john.doe@email.com"
},
"shippingMethodId": 6
},
"rows": [
{
"productId": 1007,
"name": "Nerf darts",
"quantity": "1000",
"taxCode": "T20",
"net": "100",
"tax": "20",
"nominalCode": "4000",
"externalRef": "723423-234-234dsdwe3-fsfefe4f-dfse3"
},
{
"productId": 1008,
"name": "Nerf guns",
"quantity": "20",
"taxCode": "T20",
"net": "200",
"tax": "40",
"nominalCode": "4000",
"externalRef": "7hgfjksdf-234sfd-w34-sdf-w234"
},
{
"productId": 1000,
"name": "Shipping",
"quantity": "1",
"taxCode": "T20",
"net": "20",
"tax": "4",
"nominalCode": "4000",
"externalRef": "fsd639sdf-sdf7w3hsdf-2w347sdhf"
}
]
}
Response
{
"response": 42
}
