---
title: "Inbound deliveries | Docs | WMS by R&D Copilot"
description: "Announce a delivery, receive it line by line with its lot and expiry, flag differences, put it away and close it."
canonical: "https://warehouse.rdcopilot.com/docs/api-reference/inbound-deliveries/"
language: en
updated: 2026-11-22
---

# Inbound deliveries

Announce a delivery, receive it line by line with its lot and expiry, flag differences, put it away and close it.

## List inbound deliveries

GET `/warehouse/v1/inbound-deliveries`

Returns deliveries in pages, by expected time.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `status` | query | `string` | Nooptional | Only deliveries in this status. One of `scheduled`, `arrived`, `receiving`, `put-away`, `closed`, `difference` |
| `limit` | query | `integer` | Nooptional | Records per page. Default `100` Range `1` – `500` |
| `cursor` | query | `string` | Nooptional | The `nextCursor` of the previous page. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | A page of records. | `InboundDeliveryPage` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/warehouse/v1/inbound-deliveries?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries?limit=20`, {
  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"]}/warehouse/v1/inbound-deliveries?limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries?limit=20');
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")}/warehouse/v1/inbound-deliveries?limit=20");
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

```json
{
  "items": [
    {
      "id": "a2000000-0000-4000-8000-000000000407",
      "number": "IN-2026-0407",
      "kind": "supplier",
      "supplier": "Moara Vadului SRL",
      "reference": "CA-2026-0309",
      "carrier": "own vehicle",
      "expectedAt": "2026-11-23T05:30:00Z",
      "arrivedAt": "2026-11-23T05:40:00Z",
      "dock": "DOCK-1",
      "status": "arrived",
      "lines": [
        {
          "sku": "FA-0010",
          "expected": "120",
          "received": "0",
          "damaged": "0",
          "lot": null,
          "expiry": null,
          "putAway": "0",
          "suggestedLocation": "R-01-01"
        }
      ],
      "differences": [],
      "revision": 2
    },
    {
      "id": "a2000000-0000-4000-8000-000000000408",
      "number": "IN-2026-0408",
      "kind": "supplier",
      "supplier": "Brânzeturi Obcina SRL",
      "reference": "CA-2026-0310",
      "carrier": "Transbistrița Logistic SRL",
      "expectedAt": "2026-11-23T05:45:00Z",
      "arrivedAt": "2026-11-23T05:58:00Z",
      "dock": "DOCK-2",
      "status": "receiving",
      "lines": [
        {
          "sku": "LA-0307",
          "expected": "48",
          "received": "48",
          "damaged": "0",
          "lot": "L26-1120",
          "expiry": "2026-12-30",
          "putAway": "0",
          "suggestedLocation": "C-01-02"
        }
      ],
      "differences": [],
      "revision": 3
    }
  ],
  "nextCursor": null
}
```

## Announce a delivery

POST `/warehouse/v1/inbound-deliveries`

Schedules a delivery with the items and quantities that are expected. Each line is suggested the shelf its item lives on.

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `kind` | `string` | Yesrequired | `supplier` or `return`. One of `supplier`, `return` |
| `supplier` | `string` | Yesrequired | The supplier, or the customer of a return, up to 200 characters. |
| `reference` | `string` | Yesrequired | The purchase order or, for a return, the sales order, up to 200 characters. |
| `carrier` | `string` | Nooptional | Who brings the goods. Own vehicle of the supplier by default. |
| `expectedAt` | `string (date-time)` | Yesrequired | When the delivery is expected, today or later. |
| `lines` | `object[]` | Yesrequired | The lines: each item once. |
| `lines[].sku` | `string` | Yesrequired | The item. |
| `lines[].expected` | `string` | Yesrequired | Units expected, at least 1. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `item_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `operation_reused`. | `Error` |
| `422` | The request was refused. The `code` is `kind_not_valid`, `text_not_valid`, `date_not_valid`, `lines_required`, `line_repeated` or `quantity_not_valid`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/warehouse/v1/inbound-deliveries" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "bb6a1b3c-6b4d-48e6-81d9-4c442021d746",
  "kind": "supplier",
  "supplier": "Moara Vadului SRL",
  "reference": "CA-2026-0320",
  "expectedAt": "2026-11-24T06:00:00Z",
  "lines": [
    {
      "sku": "FA-0010",
      "expected": "80"
    },
    {
      "sku": "ZA-0201",
      "expected": "120"
    }
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "bb6a1b3c-6b4d-48e6-81d9-4c442021d746",
    "kind": "supplier",
    "supplier": "Moara Vadului SRL",
    "reference": "CA-2026-0320",
    "expectedAt": "2026-11-24T06:00:00Z",
    "lines": [
      {
        "sku": "FA-0010",
        "expected": "80"
      },
      {
        "sku": "ZA-0201",
        "expected": "120"
      }
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/warehouse/v1/inbound-deliveries',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'bb6a1b3c-6b4d-48e6-81d9-4c442021d746',
        'kind': 'supplier',
        'supplier': 'Moara Vadului SRL',
        'reference': 'CA-2026-0320',
        'expectedAt': '2026-11-24T06:00:00Z',
        'lines': [
            {
                'sku': 'FA-0010',
                'expected': '80',
            },
            {
                'sku': 'ZA-0201',
                'expected': '120',
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "bb6a1b3c-6b4d-48e6-81d9-4c442021d746",
  "kind": "supplier",
  "supplier": "Moara Vadului SRL",
  "reference": "CA-2026-0320",
  "expectedAt": "2026-11-24T06:00:00Z",
  "lines": [
    {
      "sku": "FA-0010",
      "expected": "80"
    },
    {
      "sku": "ZA-0201",
      "expected": "120"
    }
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries');
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")}/warehouse/v1/inbound-deliveries");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "bb6a1b3c-6b4d-48e6-81d9-4c442021d746",
  "kind": "supplier",
  "supplier": "Moara Vadului SRL",
  "reference": "CA-2026-0320",
  "expectedAt": "2026-11-24T06:00:00Z",
  "lines": [
    {
      "sku": "FA-0010",
      "expected": "80"
    },
    {
      "sku": "ZA-0201",
      "expected": "120"
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "bb6a1b3c-6b4d-48e6-81d9-4c442021d746",
  "status": "accepted",
  "aggregateRevision": 1
}
```

## Get an inbound delivery

GET `/warehouse/v1/inbound-deliveries/{deliveryId}`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The inbound delivery. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | The record at its current revision. | `InboundDelivery` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `inbound_delivery_not_found`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408`, {
  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"]}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408');
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")}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408");
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

```json
{
  "id": "a2000000-0000-4000-8000-000000000408",
  "number": "IN-2026-0408",
  "kind": "supplier",
  "supplier": "Brânzeturi Obcina SRL",
  "reference": "CA-2026-0310",
  "carrier": "Transbistrița Logistic SRL",
  "expectedAt": "2026-11-23T05:45:00Z",
  "arrivedAt": "2026-11-23T05:58:00Z",
  "dock": "DOCK-2",
  "status": "receiving",
  "lines": [
    {
      "sku": "LA-0307",
      "expected": "48",
      "received": "48",
      "damaged": "0",
      "lot": "L26-1120",
      "expiry": "2026-12-30",
      "putAway": "0",
      "suggestedLocation": "C-01-02"
    }
  ],
  "differences": [],
  "revision": 3
}
```

## Record the arrival

POST `/warehouse/v1/inbound-deliveries/{deliveryId}/arrive`

Records that a scheduled delivery stands at a dock. A dock holds one delivery at a time.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The inbound delivery. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the delivery you read. |
| `dock` | `string` | Yesrequired | The dock the delivery stands at, for example `DOCK-1`. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `inbound_delivery_not_found` or `dock_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `revision_conflict` or `operation_reused`. | `Error` |
| `422` | The request was refused. The `code` is `delivery_not_scheduled` or `dock_busy`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000409/arrive" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "ccf715e9-baee-4005-81eb-a73769ce0055",
  "expectedRevision": 1,
  "dock": "DOCK-2"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000409/arrive`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "ccf715e9-baee-4005-81eb-a73769ce0055",
    "expectedRevision": 1,
    "dock": "DOCK-2"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000409/arrive',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'ccf715e9-baee-4005-81eb-a73769ce0055',
        'expectedRevision': 1,
        'dock': 'DOCK-2',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "ccf715e9-baee-4005-81eb-a73769ce0055",
  "expectedRevision": 1,
  "dock": "DOCK-2"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000409/arrive');
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")}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000409/arrive");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "ccf715e9-baee-4005-81eb-a73769ce0055",
  "expectedRevision": 1,
  "dock": "DOCK-2"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "ccf715e9-baee-4005-81eb-a73769ce0055",
  "status": "accepted",
  "aggregateRevision": 2
}
```

## Receive a line

POST `/warehouse/v1/inbound-deliveries/{deliveryId}/receive`

Counts a line at the dock: the good units, which enter the stock, and the damaged ones, which do not. An item with a date needs its lot and expiry; a lot that has already passed its date is not received.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The inbound delivery. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the delivery you read. |
| `sku` | `string` | Yesrequired | The item of the line. |
| `received` | `string` | Yesrequired | Good units, 0 or more. Together with the damaged units at least 1 and at most what was expected. |
| `damaged` | `string` | Yesrequired | Units refused at the dock, 0 or more. |
| `lot` | `string` | Nooptional | The lot: capital letters, digits and hyphens, from 3 to 20 characters. Required for an item with a date. |
| `expiry` | `string (date)` | Nooptional | The last day of the lot, today or later. Required for an item with a date. |
| `by` | `string` | Yesrequired | Identifier of the person who counted. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `inbound_delivery_not_found`, `delivery_line_not_found` or `worker_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `revision_conflict` or `operation_reused`. | `Error` |
| `422` | The request was refused. The `code` is `delivery_not_open`, `line_already_received`, `quantity_not_valid`, `quantity_over_expected`, `lot_not_valid`, `expiry_not_valid`, `lot_ended` or `lot_not_allowed`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/receive" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "5940993b-2e4d-45e3-8ed2-8e251326f413",
  "expectedRevision": 2,
  "sku": "FA-0010",
  "received": "100",
  "damaged": "4",
  "lot": "L26-1160",
  "expiry": "2027-06-30",
  "by": "dan-ilie"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/receive`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "5940993b-2e4d-45e3-8ed2-8e251326f413",
    "expectedRevision": 2,
    "sku": "FA-0010",
    "received": "100",
    "damaged": "4",
    "lot": "L26-1160",
    "expiry": "2027-06-30",
    "by": "dan-ilie"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/receive',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '5940993b-2e4d-45e3-8ed2-8e251326f413',
        'expectedRevision': 2,
        'sku': 'FA-0010',
        'received': '100',
        'damaged': '4',
        'lot': 'L26-1160',
        'expiry': '2027-06-30',
        'by': 'dan-ilie',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "5940993b-2e4d-45e3-8ed2-8e251326f413",
  "expectedRevision": 2,
  "sku": "FA-0010",
  "received": "100",
  "damaged": "4",
  "lot": "L26-1160",
  "expiry": "2027-06-30",
  "by": "dan-ilie"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/receive');
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")}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/receive");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "5940993b-2e4d-45e3-8ed2-8e251326f413",
  "expectedRevision": 2,
  "sku": "FA-0010",
  "received": "100",
  "damaged": "4",
  "lot": "L26-1160",
  "expiry": "2027-06-30",
  "by": "dan-ilie"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "5940993b-2e4d-45e3-8ed2-8e251326f413",
  "status": "accepted",
  "aggregateRevision": 3
}
```

## Flag a difference

POST `/warehouse/v1/inbound-deliveries/{deliveryId}/differences`

Flags for the supplier a gap against what was expected (`short`), the damaged units of a line (`damaged`) or units beyond what was expected (`surplus`). A gap and damaged units have to be flagged before the delivery can close.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The inbound delivery. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the delivery you read. |
| `sku` | `string` | Yesrequired | The item of the line. |
| `kind` | `string` | Yesrequired | `short`: the gap against what was expected, the whole gap. `damaged`: all the damaged units of the line. `surplus`: units beyond what was expected, once the line is counted. One of `short`, `surplus`, `damaged` |
| `quantity` | `string` | Yesrequired | Units the difference is about, at least 1. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `inbound_delivery_not_found` or `delivery_line_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `revision_conflict` or `operation_reused`. | `Error` |
| `422` | The request was refused. The `code` is `delivery_not_open`, `kind_not_valid`, `quantity_not_valid`, `difference_flagged` or `no_difference`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/differences" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "ee9cef99-87c5-4239-8501-03870420d5c9",
  "expectedRevision": 3,
  "sku": "FA-0010",
  "kind": "short",
  "quantity": "16"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/differences`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "ee9cef99-87c5-4239-8501-03870420d5c9",
    "expectedRevision": 3,
    "sku": "FA-0010",
    "kind": "short",
    "quantity": "16"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/differences',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'ee9cef99-87c5-4239-8501-03870420d5c9',
        'expectedRevision': 3,
        'sku': 'FA-0010',
        'kind': 'short',
        'quantity': '16',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "ee9cef99-87c5-4239-8501-03870420d5c9",
  "expectedRevision": 3,
  "sku": "FA-0010",
  "kind": "short",
  "quantity": "16"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/differences');
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")}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/differences");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "ee9cef99-87c5-4239-8501-03870420d5c9",
  "expectedRevision": 3,
  "sku": "FA-0010",
  "kind": "short",
  "quantity": "16"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "ee9cef99-87c5-4239-8501-03870420d5c9",
  "status": "accepted",
  "aggregateRevision": 4
}
```

## Put a line away

POST `/warehouse/v1/inbound-deliveries/{deliveryId}/put-away`

Moves the received units of a line from the dock to a shelf. The cold items go to the cold room and the others do not.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The inbound delivery. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the delivery you read. |
| `sku` | `string` | Yesrequired | The item of the line. |
| `locationCode` | `string` | Yesrequired | The shelf to put the received units away to. |
| `by` | `string` | Yesrequired | Identifier of the person who put the goods away. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `inbound_delivery_not_found`, `delivery_line_not_found` or `location_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `revision_conflict` or `operation_reused`. | `Error` |
| `422` | The request was refused. The `code` is `delivery_not_open`, `location_not_storage`, `nothing_to_put_away` or `wrong_zone`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/put-away" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "ff237eb5-659b-4221-854c-57ebbf4e5431",
  "expectedRevision": 3,
  "sku": "FA-0010",
  "locationCode": "R-02-01",
  "by": "dan-ilie"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/put-away`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "ff237eb5-659b-4221-854c-57ebbf4e5431",
    "expectedRevision": 3,
    "sku": "FA-0010",
    "locationCode": "R-02-01",
    "by": "dan-ilie"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/put-away',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'ff237eb5-659b-4221-854c-57ebbf4e5431',
        'expectedRevision': 3,
        'sku': 'FA-0010',
        'locationCode': 'R-02-01',
        'by': 'dan-ilie',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "ff237eb5-659b-4221-854c-57ebbf4e5431",
  "expectedRevision": 3,
  "sku": "FA-0010",
  "locationCode": "R-02-01",
  "by": "dan-ilie"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/put-away');
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")}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000407/put-away");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "ff237eb5-659b-4221-854c-57ebbf4e5431",
  "expectedRevision": 3,
  "sku": "FA-0010",
  "locationCode": "R-02-01",
  "by": "dan-ilie"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "ff237eb5-659b-4221-854c-57ebbf4e5431",
  "status": "accepted",
  "aggregateRevision": 4
}
```

## Close a delivery

POST `/warehouse/v1/inbound-deliveries/{deliveryId}/close`

Closes a delivery whose every counted unit is put away and whose differences are flagged. Its status becomes `closed`, or `difference` when a difference was flagged.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The inbound delivery. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the delivery you read. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The request was refused. The `code` is `inbound_delivery_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `revision_conflict` or `operation_reused`. | `Error` |
| `422` | The request was refused. The `code` is `delivery_not_open`, `not_put_away` or `difference_not_flagged`. | `Error` |
| `429` | The request was refused. The `code` is `rate_limited`. | `Error` |
| `503` | The request was refused. The `code` is `unavailable`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408/close" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "4f0aaaa6-1816-4cfc-824a-aa1a99806cbc",
  "expectedRevision": 4
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408/close`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "4f0aaaa6-1816-4cfc-824a-aa1a99806cbc",
    "expectedRevision": 4
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408/close',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '4f0aaaa6-1816-4cfc-824a-aa1a99806cbc',
        'expectedRevision': 4,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "4f0aaaa6-1816-4cfc-824a-aa1a99806cbc",
  "expectedRevision": 4
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408/close');
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")}/warehouse/v1/inbound-deliveries/a2000000-0000-4000-8000-000000000408/close");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "4f0aaaa6-1816-4cfc-824a-aa1a99806cbc",
  "expectedRevision": 4
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "4f0aaaa6-1816-4cfc-824a-aa1a99806cbc",
  "status": "accepted",
  "aggregateRevision": 5
}
```
