Create a sales order
POST/api/service/sales-orders
Creates a sales order for a customer. Needs a read-write API key. Prices, tax and totals are worked out by the server: leave unitPrice off a line to use the catalogue price. A price you send can be refused, depending on the workspace's pricing settings and the permissions of the user who created the key. The order starts as DRAFT, which reserves no stock, unless you send status: CONFIRMED, which confirms it and reserves stock. A confirmed order is refused if the customer's credit limit does not allow it or, when the workspace does not allow negative stock, stock does not cover it; with negative stock allowed it is confirmed and the shortfall is a backorder. Send an Idempotency-Key so a retry never creates a second order.
Request
Responses
- 201
- 400
- 401
- 403
- 409
- 429
The sales order that was created.
Response Headers
Requests per minute this API key is allowed.
Requests left in the current one-minute window.
Seconds until the current window ends and the count resets.
Identifier of this request. Send your own x-request-id to have it echoed back; otherwise one is generated. Quote it when contacting support.
The request is invalid: a field failed validation, an id is malformed, or the request is not allowed in the current state. message says which.
Response Headers
Requests per minute this API key is allowed.
Requests left in the current one-minute window.
Seconds until the current window ends and the count resets.
Identifier of this request. Send your own x-request-id to have it echoed back; otherwise one is generated. Quote it when contacting support.
The API key is missing, malformed, revoked or expired, the user who created the key is no longer active, the request comes from an address the key does not allow, or the key is read-only and the route writes. The rate-limit headers are not sent.
Response Headers
Identifier of this request. Send your own x-request-id to have it echoed back; otherwise one is generated. Quote it when contacting support.
The key is valid but not allowed to do this: the workspace's plan does not include API access, or the user who created the key lacks the permission this route needs. The rate-limit headers are not sent when the plan is the reason.
Response Headers
Identifier of this request. Send your own x-request-id to have it echoed back; otherwise one is generated. Quote it when contacting support.
The Idempotency-Key cannot be used for this request. code says why: IDEMPOTENCY_KEY_CONFLICT — the key was already used with a different request body (send the original body again, or use a new key for a new request); IDEMPOTENCY_IN_PROGRESS — the first request with this key is still running (retry the same request shortly); IDEMPOTENCY_OUTCOME_UNKNOWN — the earlier attempt may have created the document (look for it before trying again; a new key does not resolve this).
Response Headers
Requests per minute this API key is allowed.
Requests left in the current one-minute window.
Seconds until the current window ends and the count resets.
Identifier of this request. Send your own x-request-id to have it echoed back; otherwise one is generated. Quote it when contacting support.
The API key exceeded its requests-per-minute limit; wait Retry-After seconds. A 429 can also come from the separate per-address limit (600 requests a minute), which sends X-RateLimit-* headers instead of the X-ApiKey-RateLimit-* ones.
Response Headers
Requests per minute this API key is allowed.
Requests left in the current one-minute window.
Seconds until the current window ends and the count resets.
Identifier of this request. Send your own x-request-id to have it echoed back; otherwise one is generated. Quote it when contacting support.
Seconds to wait before retrying.