Identify a command#
An idempotency key identifies one intended command. Use a durable ID from your source system, or generate one and store it before sending the request.
For customer, product, vendor, and purchase-order mutations, the field lives
under metadata.idempotencyKey. Inventory-location mutations use
operationMetadata.idempotencyKey. Work-item creation requires its metadata
key. Key administration uses a different request shape and cannot be called
using a workspace API key.
Retry the same command with the same key and payload.
A new business action needs a new key.
Do not assume every endpoint supports an Idempotency-Key HTTP header.
Check the current version#
Optimistic concurrency fields prevent an update from silently overwriting newer changes.
Read the current record, use its current occVersion or occToken where the operation accepts it, then submit the update.
Customer identity, contact, and address updates require both an idempotency key and an OCC version.
The value 1 in an example is illustrative. Replace it with the version you just read.
After a conclusive concurrency rejection, fetch current state, reconcile the user's intended change, and issue a new command. Resolve any earlier attempt with an unknown outcome first. Do not hide conflicts by repeatedly submitting an old version.
Inventory-location updates and archiving use the current record's updatedAt
value in the required If-Match header. A missing precondition returns 428,
and a stale value is rejected. Keep the operation metadata idempotency key
stable when retrying.
Records retire; they are not deleted#
The published API has no hard-delete operation. A record leaves active use through a lifecycle transition instead: products and inventory locations archive, while purchase orders and purchasing returns expose state transitions or receiving actions. Archived records stay readable so dependent history keeps working; list operations document whether they include archived records by default.
To clear test data, delete the sandbox workspace in Settings and recreate it; see testing integrations.
Recover from a 409#
A 409 names the conflict in its code or message. The recovery depends on which kind you received:
- Idempotency conflict: you reused an idempotency key with a different command payload. Keep one key per intended command: retry the same command with the same field values, and mint a new key for a new command. Changing JSON whitespace or object-key order does not create a new command.
- Concurrency conflict: the OCC version or token you sent is older than the current record. After confirming the original command was rejected, read the record again, reconcile the user's intended change against current state, and submit a new command with the fresh version. Do not resubmit the old version in a loop.
- Business conflict: the requested change is not valid from the record's current state, such as updating a cancelled order or archiving a location with active dependent records. Read the record, resolve the state problem first, then decide whether the command still applies.
When the kind is unclear, read current state before doing anything else. Never generate a fresh idempotency key just to force a conflicted write through.
Purchase-order receiving after an unknown outcome#
Persist the exact receiving request before sending it, including receipt.receiptId,
receipt.receivedAt, metadata.idempotencyKey, the original metadata.occVersion,
and the receipt lines. After a timeout or lost response, retry that same request.
Do not refresh the version, timestamp, quantity, or command identity during recovery.
A purchase_order_receipt_version_rejected response confirms that the order has
advanced beyond the submitted version and the exact receipt is absent. Reload
the order, review the remaining quantities, and create a new receiving command
only if it is still needed.
A purchase_order_receipt_not_recorded response can release a first submission
that has never had an uncertain outcome. It does not clear an earlier uncertain
attempt. Keep that original request until its receipt is confirmed or the
conclusive version-rejection response is returned. If neither is available,
resolve the source issue before recording another receipt.
Work and process state#
Creating a work item validates its tags and workflow stage against the workspace
configuration. Use a configured work type and, when selecting a process explicitly,
an exact released startProcessRef. Without an explicit process, matching continues
asynchronously under the workspace's released rules.
Creation success means the work record was created. A process can still be running, waiting, or deferred. Read the work item's process context before reporting process completion to your users.
Structural validation and business rules#
The downloadable schema describes types, required fields, enums, and bounds. Additional checks depend on current business state or relationships between fields. Read the operation's Behavior section as well as its schema.