Documentation
Guides, API reference and events for Inventory.
On this page
Rules shared by every R&D Copilot API are in the Developer guide.
Get started
- Overview: What the Inventory API does, how a call is built and where to go next.
- Quickstart: Reserve flour for an order on the test company: read the balance, send the reservation, read the outcome and see the movement.
- Authentication: Get client credentials, request a token and call the Inventory API with it.
- Sandbox and live: Build and test against a test company, then move the same calls to your live company.
- Go-live checklist: What to have in place before your software sends commands for the live company.
Concepts
- Items and locations: A balance is one item at one location. Items come from your catalogue, locations from the setup of your account.
- On hand, reserved, available: The three quantities of a balance, which command moves which, and the rule that keeps them honest.
- Movements are immutable: Every change is a movement that is recorded once and never edited or deleted. A mistake is corrected by a reversal.
- Revisions and concurrency: Each balance has a revision that grows with every movement. A command carries the revision it read and is refused if the balance has moved on.
- Idempotent commands: A command carries an operationId. Sent again, it returns the first outcome and changes nothing; a refused command leaves no record.
Guides
- Reserve for an order: Promise stock to a sales order, deal with a shortage, release a reservation and deliver from it.
- Receive goods: Post a goods receipt, and what to do when a balance moved while the receipt was waiting.
- Transfer between locations: Move stock from one location to another as two linked movements, from what is available at the source.
- Count and adjust: Set a balance to what was counted: the movement carries the difference and the history shows when it happened.
- Reverse a movement: Correct a mistake, release a reservation or undo a transfer with a new movement that is linked to the old one.
- Rebuild your stock view from movements: Keep your own copy of the balances in step with the ledger: read the history once, then follow the events.
Reference
- Errors: The error object of the Inventory API and the codes that say what went wrong.
- Idempotency and concurrency: Repeat a request without applying it twice, and refuse a change made on an out-of-date record.
- Pagination: Lists come in pages. Follow the cursor until it is empty.
- Limits: The limits of the Inventory API, with their values and what happens over them.
- Versioning: The version is in the path. Additions keep it; a change that could break a caller gets a new one.
- Changelog: Every version of the Inventory contract, with its day and what it contains.
API reference
- Availability: What is on hand, what is reserved and what is available for one item at one location, with the revision of that balance.
- Movements: The stock card of an item: every movement ever recorded for it, oldest first. A movement is never edited or deleted.
- Reservations: Promise stock to an order. A reservation lowers what is available and leaves what is on hand as it is.
- Receipts: Record goods received into a location.
- Transfers: Move stock from one location to another as two linked movements.
- Sales: Record goods leaving a location, taking the reserved part from the reservation in the same step.
- Returns: Record goods coming back into a location.
- Counts: Set the quantity on hand to what was counted. The movement carries the difference.
- Reversals: Correct a movement, or release a reservation, with a new movement that undoes it and is linked to it.
- Events and subscriptions: Register an endpoint for events, read the events and their delivery state, and replay a parked event.
- Operations: A request that changes data is accepted once and answered with an operation result you can read again.
Events
- Event envelope: Every Inventory event has the same envelope; only
datachanges with the type of the event. - Event catalogue: The one event Inventory sends, once per movement, and what its fields hold.
- Subscriptions: Register an HTTPS endpoint and Inventory sends your events to it, each one signed.
- Verify signatures: Every delivery is signed. Check the signature on the raw body before you trust the event.
- Delivery and retries: An event is sent again when your endpoint does not confirm it, and is kept for replay after the last attempt.
- Replay: Send a parked event again once your endpoint is ready to take it.