Create sales orders via the API
How it works
Section titled “How it works”- Register your integration — BUZ Support turns on API integrations for the organisation, then an administrator registers it under MyOrg › Settings › Integrations › API integrations and receives a Client ID and secret.
- Connect once — someone from the organisation signs in, approves the integration, and selects an organisation. You receive an access token, a refresh token and the organisation id.
- Create orders —
POSTto the Sales API with two headers on every call. By default an order is created as a quote: visible in BUZ, priced, but not committed — nobody is notified and nothing goes to production until it’s accepted.
Before you start
Section titled “Before you start”Registering an integration is two steps:
- Ask BUZ Support (support@buzsoftware.com.au) to turn on API integrations for the organisation.
- An administrator registers it in BUZ, under MyOrg › Settings › Integrations › API
integrations, using New integration. They need Settings › Organisation Details access.
They give it a name and your redirect (callback) URL (it must start with
https://), then tick Read and/or Change for each area it needs — for Sales, see Scopes below.
BUZ then shows:
- a Client ID and Client secret — the secret is shown only once, so copy it and keep it server-side. If it is lost, the administrator can generate a new one
- the login the integration authenticates as is whoever from the organisation signs in to approve it — see How the customer is resolved, because which kind of login that is determines how orders are tied to customers
The integration works only with the organisation that registered it.
Authentication is OAuth 2.0 authorization code + PKCE.
1. Send the user to the authorization URL
Section titled “1. Send the user to the authorization URL”Generate a PKCE code_verifier / code_challenge (S256) and keep the verifier for step 3.
GET https://login.buzmanager.com/connect/authorize ?client_id={your_client_id} &response_type=code &redirect_uri={your_redirect_uri} &scope=openid profile offline_access buz.sales.read buz.sales.write &state={random_csrf_value} &code_challenge={pkce_challenge} &code_challenge_method=S256| Parameter | Required | Notes |
|---|---|---|
client_id |
Yes | Issued by BUZ |
response_type |
Yes | Must be code |
redirect_uri |
Yes | Must match the redirect URL registered for the integration |
scope |
Yes | Space-separated — see Scopes |
state |
Yes | Random value, echoed back — verify it to prevent CSRF |
code_challenge |
Yes | PKCE challenge derived from your verifier |
code_challenge_method |
Yes | Must be S256 |
2. Sign in, consent, select an organisation
Section titled “2. Sign in, consent, select an organisation”BUZ presents the login page, a consent screen, and an organisation selection. Sign in as the
user set up for the integration. The organisation selected here determines the organization_id
you receive in step 4. After consent, BUZ redirects to your callback with a code:
{your_redirect_uri}?code=ABC123XYZ&state={your_state}3. Exchange the code for tokens
Section titled “3. Exchange the code for tokens”curl -X POST https://api.buzmanager.com/identity/tokens \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "client_id={your_client_id}" \ -d "client_secret={your_client_secret}" \ -d "code={code}" \ -d "redirect_uri={your_redirect_uri}" \ -d "code_verifier={pkce_verifier}"Two hosts, one service: login.buzmanager.com and api.buzmanager.com are the same BUZ
identity service. Use login.buzmanager.com for the interactive, browser-based authorize step,
and api.buzmanager.com/identity/tokens for the server-to-server token exchange and refresh.
4. Token response
Section titled “4. Token response”{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...", "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...", "token_type": "Bearer", "refresh_token": "D263A51D08A6C2F6C2E1E17188AE2EE2...", "expires_in": 3600, "organization_id": 12345, "organization_name": "Your organisation", "userName": "user@example.com"}| Field | Use |
|---|---|
access_token |
Send as Authorization: Bearer {access_token} on every API call |
refresh_token |
Store securely server-side; use to renew the access token (step 6) |
expires_in |
Access token lifetime in seconds (default 3600) |
organization_id |
Integer — send as the Selected-Organization header on every API call |
organization_name / userName |
For display only |
5. Create an order
Section titled “5. Create an order”| Property | Value |
|---|---|
| URL | https://api.buzmanager.com/sales/Orders |
| Method | POST (also supports GET, PUT) |
| Headers | Authorization: Bearer {access_token} · Selected-Organization: {organization_id} (integer) · Content-Type: application/json |
The token must carry your granted Sales scopes, and the user it was issued for must have the Sales › Quoting & Ordering › Access permission in BUZ.
Draft first, commit later
Section titled “Draft first, commit later”| Call | What happens |
|---|---|
POST /sales/Orders (no flags) |
Creates the order in Quoted status — visible and priced in BUZ, not committed. No supplier notification, nothing to production. The customer reviews and accepts it inside BUZ. |
POST /sales/Orders?Accept=true |
Creates and commits the order in one call |
POST /sales/Orders?IsPriceCheckOnly=true |
Prices the payload without creating anything |
How the customer is resolved
Section titled “How the customer is resolved”Every order is linked to a customer, determined by the BUZ login your token represents:
| Pattern | customerContactId |
How the customer is set | Best when… |
|---|---|---|---|
| 1. Single customer user | Do not send | Resolved automatically from the login’s own account | The integration only ever acts for one customer. Simplest payload. |
| 2. One customer user per customer | Do not send | Resolved from whichever customer login you authenticate with | The integration serves multiple customers and each should only reach its own data (least privilege). This is how BUZ runs B2B. Store one credential per customer. |
| 3. Single standard user | Required | Taken from the contact you supply in the payload | One login must span many customers and per-customer isolation isn’t required. This login can create orders against any customer in the organisation. |
A customer user can only edit an order while it is still at quote stage; a standard user can edit beyond that. Everything else — pricing, discounts, status, branch, rep, tax — is driven by the customer on the order and the login’s group permissions, not the user type.
Request fields
Section titled “Request fields”“Required” means the order will not create without it; omitted optional fields are defaulted.
| Field | Type | Required | Notes |
|---|---|---|---|
orderItems |
array | Yes | At least one item; each inventoryCode must resolve to an active inventory item |
customerContactId |
GUID | Pattern 3: yes · Patterns 1–2: omit | A customer contact id (not the customer id) — see below |
orderReference |
string | Recommended | Your external reference; stored as the order description |
orderDate |
date/datetime | Optional | ISO 8601; defaults to server date |
notes |
string | Optional | Free-text order notes |
extras |
array | Optional | Order-level option answers ({ "code", "value" }) |
branchId / salesRepId / taxRateId |
GUID | Optional | Default from the organisation if omitted |
followUpDate |
date | Optional | |
discount |
decimal | Optional | Ignored unless the login’s group has discount-approval permission; an over-limit discount forces an approval-needed status |
Each entry in orderItems:
| Field | Type | Required | Notes |
|---|---|---|---|
inventoryCode |
string | Yes | Must match an active inventory item whose group is also active |
orderOptions |
array | Per product | The product’s configuration answers as { "code", "value" } pairs |
The same option code must not appear twice within one item or within extras.
Worked example
Section titled “Worked example”For a customer-user login (patterns 1–2 — no customerContactId). Replace the inventory and
option codes with your product’s own.
POST https://api.buzmanager.com/sales/OrdersAuthorization: Bearer {access_token}Selected-Organization: 12345Content-Type: application/json
{ "orderDate": "2026-11-12T00:00:00+10:00", "orderReference": "CRM-ORDER-0042", "notes": "Created from our CRM via the Sales API", "orderItems": [ { "inventoryCode": "RETBGEN2FO", "orderOptions": [ { "code": "FRAMEDESCN", "value": "Satin Black" }, { "code": "DESCN", "value": "Lounge" }, { "code": "ITEMWIDTH", "value": "1500" }, { "code": "ITEMHEIGHT", "value": "1500" }, { "code": "SIZES", "value": "Make" }, { "code": "CONTROLS", "value": "Left Cord Pulleys" }, { "code": "FIT", "value": "Face" }, { "code": "FIXING", "value": "Timber" } ] } ], "extras": [ { "code": "DELMETHOD", "value": "Delivery" }, { "code": "CHECKMEAS", "value": "No" }, { "code": "DISCOUNT", "value": "0" } ]}For the single-standard-user pattern (3), add one top-level field:
"customerContactId": "<contact PkId — see below>",Obtaining a customerContactId (pattern 3 only)
Section titled “Obtaining a customerContactId (pattern 3 only)”A contact is a child record of a customer; an order uses the customer’s billing contact. Fetch it via the Contacts API (same host, same bearer token):
- Find the customer:
GET https://api.buzmanager.com/contacts/customers?term={search}— each match has aPkId. - Get its contacts:
GET https://api.buzmanager.com/contacts/customers/{customerId}?getContactDetails=true— useContacts[0].PkId.
6. Refreshing tokens
Section titled “6. Refreshing tokens”Renew against the same /identity/tokens endpoint so the organisation fields keep coming back:
curl -X POST https://api.buzmanager.com/identity/tokens \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=refresh_token" \ -d "client_id={your_client_id}" \ -d "client_secret={your_client_secret}" \ -d "refresh_token={refresh_token}"Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause & fix |
|---|---|
Token response has no organization_id |
You’re calling /connect/token — switch to /identity/tokens (step 3) |
organization_id is 0 or missing |
No organisation selected during consent — re-run the authorize flow and pick one |
400 — No organization id |
Selected-Organization header missing or non-numeric — send the integer from step 4 |
401 Unauthorized |
Token missing/expired — refresh or re-authenticate |
403 Forbidden |
Token lacks the scope for that operation (e.g. only buz.sales.read on a write), or the user lacks Sales › Quoting & Ordering › Access |
500 — Nullable object must have a value |
A standard user (pattern 3) omitted customerContactId — supply one, or authenticate as a customer user and omit it |
500 — Inventory Item '…' not found! / inactive! |
The inventoryCode doesn’t exist, or the item or its group is inactive in this organisation |
500 — duplicate option code |
The same option code twice in one item or in extras — de-duplicate |
200, but an answer is missing from the saved line |
Its option code isn’t one the product group has, so it was ignored — check the group’s codes with GET https://api.buzmanager.com/sales/GroupOptions/{inventoryGroupCode}/{yyyy-MM-dd} and send only those |
200 but empty Contacts array |
Contact lookup without flags returns install-address contacts only — use ?getContactDetails=true |
Scopes
Section titled “Scopes”| Scope | Grants |
|---|---|
openid profile |
Sign-in / identity |
offline_access |
A refresh token (required for connect-once) |
buz.sales.read |
Read access to Sales API endpoints (GET) |
buz.sales.write |
Create/update access to Sales API endpoints (POST/PUT/PATCH/DELETE) |
Endpoint reference
Section titled “Endpoint reference”The full, always-current list of Sales endpoints, parameters and response shapes is generated from the running service: api.buzmanager.com/sales/scalar. The customer/contact lookups used above are under api.buzmanager.com/contacts/scalar.
Support
Section titled “Support”For access requests or integration questions: support@buzsoftware.com.au. See also Capture website leads via the API and Webhooks for getting events out of BUZ.