Your first request
Five steps that work on any product: get a token, read a list, send a change, read its outcome and receive the event.
On this page
This page reserves 24 bags of flour for a sales order with the Inventory API, in five requests that work the same way on every product.
Step 1: get a token
Ask the sign-in service for a token, then keep it in $RDC_TOKEN. API authentication has the request in full.
Token request
curl -X POST "$RDC_TOKEN_URL" \
-d "grant_type=client_credentials" \
-d "client_id=$RDC_CLIENT_ID" \
-d "client_secret=$RDC_CLIENT_SECRET" \
-d "scope=inventory.access" Answer 200
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.e30.c2lnbmF0dXJl",
"token_type": "Bearer",
"expires_in": 300
} Step 2: read a list
Read the movements of the flour. A list answers items and nextCursor. The resultingRevision of the newest movement, 7, is the revision of the balance now: the change you send next carries it as expectedRevision.
Read the movements
curl
curl "$RDC_BASE_URL/inventory/v1/items/7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40/movements?limit=2" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/items/7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40/movements?limit=2`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/inventory/v1/items/7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40/movements?limit=2',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/items/7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40/movements?limit=2');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/items/7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40/movements?limit=2");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Answer 200
{
"items": [
{
"movementId": "0d6f3c91-8a25-4b47-b1e0-4c7a9e2d5f18",
"kind": "receipt",
"onHandDelta": "120",
"reservedDelta": "0",
"resultingRevision": 6
},
{
"movementId": "6a1e8d52-3c07-4f94-a2b8-e5d0c71f9a36",
"kind": "receipt",
"onHandDelta": "60",
"reservedDelta": "0",
"resultingRevision": 7
}
],
"nextCursor": null
} Step 3: send a change
A change carries an operationId that you choose, a UUID, and the revision you read as expectedRevision. The answer is a 202 with the result of the operation.
Reserve the flour
curl
curl -X POST "$RDC_BASE_URL/inventory/v1/reservations" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"customerOrgId": "a3f1d7c2-64be-4b09-9d58-2c0e7f1a8b34",
"legalCompanyId": "c8b25e90-1d47-4f3a-a6d2-93e0b51f7c68",
"occurredAt": "2026-11-20T09:41:05Z",
"source": {
"service": "erp",
"documentId": "4c8a1f72-e6b9-4d35-a0c8-5b2e9d7f1a63",
"documentType": "sales-order",
"documentRevision": 1
},
"actor": {
"serviceId": "erp",
"userId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25"
},
"lines": [
{
"productId": "7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40",
"locationId": "1b9e6a35-d4c7-4082-b5f3-9e0a7c2d8164",
"quantity": "24",
"expectedRevision": 7
}
]
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/reservations`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"customerOrgId": "a3f1d7c2-64be-4b09-9d58-2c0e7f1a8b34",
"legalCompanyId": "c8b25e90-1d47-4f3a-a6d2-93e0b51f7c68",
"occurredAt": "2026-11-20T09:41:05Z",
"source": {
"service": "erp",
"documentId": "4c8a1f72-e6b9-4d35-a0c8-5b2e9d7f1a63",
"documentType": "sales-order",
"documentRevision": 1
},
"actor": {
"serviceId": "erp",
"userId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25"
},
"lines": [
{
"productId": "7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40",
"locationId": "1b9e6a35-d4c7-4082-b5f3-9e0a7c2d8164",
"quantity": "24",
"expectedRevision": 7
}
]
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/inventory/v1/reservations',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94',
'customerOrgId': 'a3f1d7c2-64be-4b09-9d58-2c0e7f1a8b34',
'legalCompanyId': 'c8b25e90-1d47-4f3a-a6d2-93e0b51f7c68',
'occurredAt': '2026-11-20T09:41:05Z',
'source': {
'service': 'erp',
'documentId': '4c8a1f72-e6b9-4d35-a0c8-5b2e9d7f1a63',
'documentType': 'sales-order',
'documentRevision': 1,
},
'actor': {
'serviceId': 'erp',
'userId': '9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25',
},
'lines': [
{
'productId': '7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40',
'locationId': '1b9e6a35-d4c7-4082-b5f3-9e0a7c2d8164',
'quantity': '24',
'expectedRevision': 7,
},
],
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"customerOrgId": "a3f1d7c2-64be-4b09-9d58-2c0e7f1a8b34",
"legalCompanyId": "c8b25e90-1d47-4f3a-a6d2-93e0b51f7c68",
"occurredAt": "2026-11-20T09:41:05Z",
"source": {
"service": "erp",
"documentId": "4c8a1f72-e6b9-4d35-a0c8-5b2e9d7f1a63",
"documentType": "sales-order",
"documentRevision": 1
},
"actor": {
"serviceId": "erp",
"userId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25"
},
"lines": [
{
"productId": "7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40",
"locationId": "1b9e6a35-d4c7-4082-b5f3-9e0a7c2d8164",
"quantity": "24",
"expectedRevision": 7
}
]
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/reservations');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/reservations");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"customerOrgId": "a3f1d7c2-64be-4b09-9d58-2c0e7f1a8b34",
"legalCompanyId": "c8b25e90-1d47-4f3a-a6d2-93e0b51f7c68",
"occurredAt": "2026-11-20T09:41:05Z",
"source": {
"service": "erp",
"documentId": "4c8a1f72-e6b9-4d35-a0c8-5b2e9d7f1a63",
"documentType": "sales-order",
"documentRevision": 1
},
"actor": {
"serviceId": "erp",
"userId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25"
},
"lines": [
{
"productId": "7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40",
"locationId": "1b9e6a35-d4c7-4082-b5f3-9e0a7c2d8164",
"quantity": "24",
"expectedRevision": 7
}
]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Answer 202
{
"operationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"status": "completed",
"aggregateRevision": 8,
"movementIds": [
"f2a95c08-6d41-4e7b-83a0-b7d14e92c5a6"
]
} Step 4: read the outcome
Ask for the operation by the operationId you sent. You get the outcome each time you ask. After completed or rejected it no longer changes.
Read the operation
curl
curl "$RDC_BASE_URL/inventory/v1/operations/3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/operations/3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/inventory/v1/operations/3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/operations/3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/operations/3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Answer 200
{
"operationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"status": "completed",
"aggregateRevision": 8,
"movementIds": [
"f2a95c08-6d41-4e7b-83a0-b7d14e92c5a6"
]
} Step 5: receive the event
The reservation is a movement, and a movement is an event. If your account has a subscription for the type, your endpoint receives this delivery. Webhooks shows how to register the endpoint, and Verify signatures how to check the delivery.
The event
{
"specversion": "1.0",
"id": "5e2b9c47-8d13-4a6f-b0e5-71c4a2d93f68",
"type": "com.rdcopilot.inventory.movement.v1",
"source": "urn:rdcopilot:service:inventory-runtime",
"time": "2026-11-20T09:41:07Z",
"customerOrgId": "a3f1d7c2-64be-4b09-9d58-2c0e7f1a8b34",
"legalCompanyId": "c8b25e90-1d47-4f3a-a6d2-93e0b51f7c68",
"aggregateType": "inventory-balance",
"aggregateId": "e17d3b60-4a98-4c25-9f02-6b8a1d5c7e39",
"aggregateRevision": 8,
"correlationId": "3b7e41a8-9c25-4d60-b8f3-1a05e6d27c94",
"causationId": "4c8a1f72-e6b9-4d35-a0c8-5b2e9d7f1a63",
"actor": {
"serviceId": "erp",
"userId": "9a4e7b10-2c6d-4f38-b5a1-0d3e8c7f6b25"
},
"data": {
"movementId": "f2a95c08-6d41-4e7b-83a0-b7d14e92c5a6",
"productId": "7d0c4e19-b3a2-4f65-8e91-2a6f5c8d3b40",
"locationId": "1b9e6a35-d4c7-4082-b5f3-9e0a7c2d8164",
"onHandDelta": "0",
"reservedDelta": "24"
}
} | Step | Request | What you keep |
|---|---|---|
| 1 | POST to the token address | access_token, until expires_in has passed |
| 2 | GET /items/{productId}/movements | The revision of the balance, 7 |
| 3 | POST /reservations | The operationId and aggregateRevision, 8 |
| 4 | GET /operations/{operationId} | The outcome |
| 5 | A POST of the event to your endpoint | The id of the event, so a repeat is skipped |
Now in your product
Every product has the same five steps with its own resources. The Quickstart of each live product repeats them with its own requests.
In the product docs
- ERP: Quickstart
- Inventory: Quickstart
- WMS: Quickstart
- POS: Quickstart
- Self-Checkout: Quickstart
- Accounting: Quickstart
- Treasury: Quickstart
- HR: Quickstart
- Payroll: Quickstart
- eLearning: Quickstart
- CRM: Quickstart
- AI Assistant: Quickstart
- Private AI Workspace: Quickstart
- DMS: Quickstart
- BI: Quickstart
- IoT: Quickstart
- e-Factura Gateway: Quickstart
- e-TVA Check: Quickstart
- e-Transport Gateway: Quickstart
- Tax Filing: Quickstart
- REGES Gateway: Quickstart
- Integrations: Quickstart
Related pages
- Requests and responses: addresses, headers and formats.
- Idempotency and retries: what to do when an answer is lost.