---
title: "Quickstart | Docs | Inventory by R&D Copilot"
description: "Reserve flour for an order on the test company: read the balance, send the reservation, read the outcome and see the movement."
canonical: "https://inventory.rdcopilot.com/docs/get-started/quickstart/"
language: en
updated: 2026-11-22
---

# Quickstart

Reserve flour for an order on the test company: read the balance, send the reservation, read the outcome and see the movement.

You need the client credentials and the base address of your test company. The requests below read them from the environment: `$RDC_BASE_URL` and `$RDC_TOKEN`. See [Authentication](https://inventory.rdcopilot.com/docs/get-started/authentication/) for the token and [Sandbox and live](https://inventory.rdcopilot.com/docs/get-started/sandbox-and-live/) for the test company.

## Read the balance

Name the item and the location. The answer shows what is on hand, what is reserved and what is available, and the `revision` of the balance. Keep the revision: the next command sends it back.

curl

```bash
curl "$RDC_BASE_URL/inventory/v1/availability?productId=6cbfcba3-55fd-4cf0-9709-6e75c9717bb3&locationId=b006344d-2fae-4970-bb6f-c32877084b4f" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/availability?productId=6cbfcba3-55fd-4cf0-9709-6e75c9717bb3&locationId=b006344d-2fae-4970-bb6f-c32877084b4f`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/availability?productId=6cbfcba3-55fd-4cf0-9709-6e75c9717bb3&locationId=b006344d-2fae-4970-bb6f-c32877084b4f',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/availability?productId=6cbfcba3-55fd-4cf0-9709-6e75c9717bb3&locationId=b006344d-2fae-4970-bb6f-c32877084b4f');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/availability?productId=6cbfcba3-55fd-4cf0-9709-6e75c9717bb3&locationId=b006344d-2fae-4970-bb6f-c32877084b4f");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
  "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
  "onHand": "68",
  "reserved": "10",
  "available": "58",
  "revision": 5
}
```

## Reserve

Choose a new `operationId`, name the order as the `source` document, and send the line with the revision you read as `expectedRevision`. The quantity is a decimal string, never a number.

curl

```bash
curl -X POST "$RDC_BASE_URL/inventory/v1/reservations" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "90aebca5-208b-47dd-9e6d-c9159d4aab06",
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "occurredAt": "2026-11-23T07:12:00Z",
  "source": {
    "service": "erp",
    "documentId": "46091949-3c11-414b-9157-994f3048e568",
    "documentType": "sales-order",
    "documentRevision": 1
  },
  "actor": {
    "serviceId": "brumar-erp",
    "userId": "4e2f591e-3df0-4f36-8741-3e49134249b0"
  },
  "lines": [
    {
      "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
      "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "quantity": "24",
      "expectedRevision": 5
    }
  ]
}'
```

JavaScript

```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": "90aebca5-208b-47dd-9e6d-c9159d4aab06",
    "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
    "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
    "occurredAt": "2026-11-23T07:12:00Z",
    "source": {
      "service": "erp",
      "documentId": "46091949-3c11-414b-9157-994f3048e568",
      "documentType": "sales-order",
      "documentRevision": 1
    },
    "actor": {
      "serviceId": "brumar-erp",
      "userId": "4e2f591e-3df0-4f36-8741-3e49134249b0"
    },
    "lines": [
      {
        "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
        "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
        "quantity": "24",
        "expectedRevision": 5
      }
    ]
  }),
});
const result = await response.json();
```

Python

```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': '90aebca5-208b-47dd-9e6d-c9159d4aab06',
        'customerOrgId': '690fa0e3-547f-4f93-96b7-824475cc3d7c',
        'legalCompanyId': 'd84ba982-ca9a-4e91-9566-21bd23f7227b',
        'occurredAt': '2026-11-23T07:12:00Z',
        'source': {
            'service': 'erp',
            'documentId': '46091949-3c11-414b-9157-994f3048e568',
            'documentType': 'sales-order',
            'documentRevision': 1,
        },
        'actor': {
            'serviceId': 'brumar-erp',
            'userId': '4e2f591e-3df0-4f36-8741-3e49134249b0',
        },
        'lines': [
            {
                'productId': '6cbfcba3-55fd-4cf0-9709-6e75c9717bb3',
                'locationId': 'b006344d-2fae-4970-bb6f-c32877084b4f',
                'quantity': '24',
                'expectedRevision': 5,
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "90aebca5-208b-47dd-9e6d-c9159d4aab06",
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "occurredAt": "2026-11-23T07:12:00Z",
  "source": {
    "service": "erp",
    "documentId": "46091949-3c11-414b-9157-994f3048e568",
    "documentType": "sales-order",
    "documentRevision": 1
  },
  "actor": {
    "serviceId": "brumar-erp",
    "userId": "4e2f591e-3df0-4f36-8741-3e49134249b0"
  },
  "lines": [
    {
      "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
      "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "quantity": "24",
      "expectedRevision": 5
    }
  ]
}
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#

```csharp
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": "90aebca5-208b-47dd-9e6d-c9159d4aab06",
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "occurredAt": "2026-11-23T07:12:00Z",
  "source": {
    "service": "erp",
    "documentId": "46091949-3c11-414b-9157-994f3048e568",
    "documentType": "sales-order",
    "documentRevision": 1
  },
  "actor": {
    "serviceId": "brumar-erp",
    "userId": "4e2f591e-3df0-4f36-8741-3e49134249b0"
  },
  "lines": [
    {
      "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
      "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "quantity": "24",
      "expectedRevision": 5
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "90aebca5-208b-47dd-9e6d-c9159d4aab06",
  "status": "completed",
  "aggregateRevision": 6,
  "movementIds": [
    "771d53db-5d2c-4a12-b9a6-bb3c86e5eeea"
  ]
}
```

The 202 says the command was applied once. `aggregateRevision` is the revision the balance reached, and `movementIds` lists the movement it recorded. The available quantity of the flour is now 24 lower and the on-hand quantity has not changed.

## Read the outcome

Look the operation up by the `operationId` you sent. You get the first outcome, however often you ask.

curl

```bash
curl "$RDC_BASE_URL/inventory/v1/operations/90aebca5-208b-47dd-9e6d-c9159d4aab06" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/operations/90aebca5-208b-47dd-9e6d-c9159d4aab06`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/operations/90aebca5-208b-47dd-9e6d-c9159d4aab06',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/operations/90aebca5-208b-47dd-9e6d-c9159d4aab06');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/operations/90aebca5-208b-47dd-9e6d-c9159d4aab06");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "operationId": "90aebca5-208b-47dd-9e6d-c9159d4aab06",
  "status": "completed",
  "aggregateRevision": 6,
  "movementIds": [
    "771d53db-5d2c-4a12-b9a6-bb3c86e5eeea"
  ]
}
```

## See the movement

The stock card of the item lists every movement, oldest first, in pages.

curl

```bash
curl "$RDC_BASE_URL/inventory/v1/items/6cbfcba3-55fd-4cf0-9709-6e75c9717bb3/movements?limit=3" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/items/6cbfcba3-55fd-4cf0-9709-6e75c9717bb3/movements?limit=3`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/items/6cbfcba3-55fd-4cf0-9709-6e75c9717bb3/movements?limit=3',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/items/6cbfcba3-55fd-4cf0-9709-6e75c9717bb3/movements?limit=3');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/items/6cbfcba3-55fd-4cf0-9709-6e75c9717bb3/movements?limit=3");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "items": [
    {
      "movementId": "5a7860f1-47a5-4776-aebf-4fbf944ef2af",
      "operationId": "f1f072e7-4458-4c2c-a281-e84f3006dbb8",
      "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
      "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "kind": "receipt",
      "onHandDelta": "120",
      "reservedDelta": "0",
      "resultingRevision": 1,
      "transferGroupId": null,
      "reversesMovementId": null,
      "source": {
        "service": "erp",
        "documentId": "afc939a3-3c46-4053-be3f-ac381dbf0c89",
        "documentType": "goods-receipt",
        "documentRevision": 1
      },
      "actor": {
        "serviceId": "brumar-erp",
        "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
      },
      "occurredAt": "2026-11-03T08:10:00.000Z",
      "recordedAt": "2026-11-03T08:10:02.000Z"
    },
    {
      "movementId": "b393ab9a-6995-455f-bf73-14c89efad593",
      "operationId": "7b6acf8c-98d1-4c8f-a924-f30e250943e6",
      "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
      "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "kind": "reservation",
      "onHandDelta": "0",
      "reservedDelta": "40",
      "resultingRevision": 2,
      "transferGroupId": null,
      "reversesMovementId": null,
      "source": {
        "service": "erp",
        "documentId": "3de5311c-5547-4f7a-a25f-6834c2a864b4",
        "documentType": "sales-order",
        "documentRevision": 1
      },
      "actor": {
        "serviceId": "brumar-erp",
        "userId": "4e2f591e-3df0-4f36-8741-3e49134249b0"
      },
      "occurredAt": "2026-11-05T10:00:00.000Z",
      "recordedAt": "2026-11-05T10:00:02.000Z"
    },
    {
      "movementId": "8d003107-95b0-46dd-aab5-c92b8c0d549a",
      "operationId": "816161c0-0005-42ef-a755-4ceb265be8cc",
      "productId": "6cbfcba3-55fd-4cf0-9709-6e75c9717bb3",
      "locationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "kind": "reservation",
      "onHandDelta": "0",
      "reservedDelta": "10",
      "resultingRevision": 3,
      "transferGroupId": null,
      "reversesMovementId": null,
      "source": {
        "service": "erp",
        "documentId": "073d3799-c505-41b1-959f-2289f31f4509",
        "documentType": "sales-order",
        "documentRevision": 1
      },
      "actor": {
        "serviceId": "brumar-erp",
        "userId": "4e2f591e-3df0-4f36-8741-3e49134249b0"
      },
      "occurredAt": "2026-11-06T11:15:00.000Z",
      "recordedAt": "2026-11-06T11:15:02.000Z"
    }
  ],
  "nextCursor": "WyIyMDI2LTExLTA2VDExOjE1OjAyLjAwMDAwMFoiLCI4ZDAwMzEwNy05NWIwLTQ2ZGQtYWFiNS1jOTJiOGMwZDU0OWEiXQ"
}
```

After a timeout, a 429 or a 503, send the same command again with the same `operationId`. It is applied once. After a 409 with `revision_conflict`, read the balance again and send the command with the new revision and a new `operationId`.
