---
title: "Import items and partners | Docs | ERP by R&D Copilot"
description: "Load items and partners from your own system with changes that are safe to repeat, and check what arrived."
canonical: "https://erp.rdcopilot.com/docs/guides/import-items-and-partners/"
language: en
updated: 2026-11-22
---

# Import items and partners

Load items and partners from your own system with changes that are safe to repeat, and check what arrived.

There is no bulk call. An import is a loop of `createItem` and `createPartner` calls, one per record. The loop is safe to stop and to run again if every call carries an `operationId` that you derive from your own key for the record.

## Items

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/items" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
  "code": "DT-0450",
  "name": "Floor cleaner, 5 l",
  "unit": "canister",
  "unitPrice": "21.50",
  "vatClass": "standard"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/items`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
    "code": "DT-0450",
    "name": "Floor cleaner, 5 l",
    "unit": "canister",
    "unitPrice": "21.50",
    "vatClass": "standard"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/items',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '165ff430-37fd-46db-8215-bdb803f7fa8d',
        'code': 'DT-0450',
        'name': 'Floor cleaner, 5 l',
        'unit': 'canister',
        'unitPrice': '21.50',
        'vatClass': 'standard',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
  "code": "DT-0450",
  "name": "Floor cleaner, 5 l",
  "unit": "canister",
  "unitPrice": "21.50",
  "vatClass": "standard"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/items');
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")}/erp/v1/items");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
  "code": "DT-0450",
  "name": "Floor cleaner, 5 l",
  "unit": "canister",
  "unitPrice": "21.50",
  "vatClass": "standard"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "165ff430-37fd-46db-8215-bdb803f7fa8d",
  "status": "accepted",
  "aggregateId": "99c92e8e-31cd-4090-ad40-ac0ad9e8f317",
  "aggregateRevision": 1
}
```

-   The `code` is unique in the company. Creating `DT-0450` a second time with a new `operationId` is refused with `item_code_taken` and changes nothing.
-   Repeating the very same call, with the same `operationId` and the same body, is not an error: you get the result of the first call. Reusing an `operationId` with a different body is refused with `operation_reused`.
-   `unitPrice` is a net amount with at most two decimals and `vatClass` is `standard` or `reduced`. The stock of a new item is 0; goods enter with a receipt.

A repeatable import

```javascript
// Import items from your own list. The operationId is derived from your own key,
// so running the import again repeats the same changes instead of making new ones.
import {createHash} from 'node:crypto';

const base = process.env.RDC_BASE_URL;
const headers = {Authorization: `Bearer ${process.env.RDC_TOKEN}`, 'Content-Type': 'application/json'};

// A stable UUID for one change: the same code always gives the same operationId.
const operationIdFor = (kind, key) => {
  const h = createHash('sha256').update(`${kind}:${key}`).digest('hex');
  return `${h.slice(0, 8)}-${h.slice(8, 12)}-4${h.slice(13, 16)}-8${h.slice(17, 20)}-${h.slice(20, 32)}`;
};

async function createItem(item) {
  const response = await fetch(`${base}/erp/v1/items`, {
    method: 'POST', headers,
    body: JSON.stringify(Object.assign({operationId: operationIdFor('item', item.code)}, item)),
  });
  if (response.status === 202) return 'created';
  const error = await response.json();
  if (error.code === 'item_code_taken') return 'exists';
  throw new Error(`${item.code}: ${response.status} ${error.code}`);
}

for (const item of items) console.log(item.code, await createItem(item));
```

## Partners

`createPartner` takes the name, the `roles` (`customer`, `supplier` or both), the town and the country, and the VAT identifier if the partner has one. Import customers and suppliers before the orders that name them: an order that names a partner that does not exist is refused with `partner_not_found`.

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/partners" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "198aa2c7-7aa6-4ef8-91b6-2655bcdfce2f",
  "name": "Băuturi Trotuș SRL",
  "roles": [
    "supplier"
  ],
  "city": "Onești",
  "country": "RO",
  "vatId": "RO51603783"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/partners`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "198aa2c7-7aa6-4ef8-91b6-2655bcdfce2f",
    "name": "Băuturi Trotuș SRL",
    "roles": [
      "supplier"
    ],
    "city": "Onești",
    "country": "RO",
    "vatId": "RO51603783"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/partners',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '198aa2c7-7aa6-4ef8-91b6-2655bcdfce2f',
        'name': 'Băuturi Trotuș SRL',
        'roles': [
            'supplier',
        ],
        'city': 'Onești',
        'country': 'RO',
        'vatId': 'RO51603783',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "198aa2c7-7aa6-4ef8-91b6-2655bcdfce2f",
  "name": "Băuturi Trotuș SRL",
  "roles": [
    "supplier"
  ],
  "city": "Onești",
  "country": "RO",
  "vatId": "RO51603783"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/partners');
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")}/erp/v1/partners");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "198aa2c7-7aa6-4ef8-91b6-2655bcdfce2f",
  "name": "Băuturi Trotuș SRL",
  "roles": [
    "supplier"
  ],
  "city": "Onești",
  "country": "RO",
  "vatId": "RO51603783"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "198aa2c7-7aa6-4ef8-91b6-2655bcdfce2f",
  "status": "accepted",
  "aggregateId": "6c530bd6-7a0b-45d5-ab13-c97963e33d0a",
  "aggregateRevision": 1
}
```

## Check what arrived

Walk the list with `limit` and `cursor` and compare it with your source. A change is answered with 202 before it is applied; read the operation, or list the items, before you rely on a record. See [Pagination](https://erp.rdcopilot.com/docs/reference/pagination/) and [Operations](https://erp.rdcopilot.com/docs/api-reference/operations/).

curl

```bash
curl "$RDC_BASE_URL/erp/v1/items?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/items?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")}/erp/v1/items?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
{
  "items": [
    {
      "id": "1f30c60b-f896-443e-9086-2e72ab3dcc3c",
      "code": "FA-0010",
      "name": "White flour, 10 kg bag",
      "unit": "bag",
      "unitPrice": "38.90",
      "vatClass": "reduced",
      "vatRate": "11",
      "cost": "32.50",
      "made": false,
      "onHand": "36",
      "reserved": "0",
      "available": "36",
      "incoming": "0"
    },
    {
      "id": "42c7977f-e96f-4243-b6fe-f133d52b1f18",
      "code": "UL-0101",
      "name": "Sunflower oil, 1 l",
      "unit": "bottle",
      "unitPrice": "7.84",
      "vatClass": "reduced",
      "vatRate": "11",
      "cost": "6.40",
      "made": false,
      "onHand": "140",
      "reserved": "48",
      "available": "92",
      "incoming": "0"
    },
    {
      "id": "4a929b04-42fc-4df8-9784-852fdd270787",
      "code": "ZA-0201",
      "name": "Sugar, 1 kg",
      "unit": "bag",
      "unitPrice": "4.29",
      "vatClass": "reduced",
      "vatRate": "11",
      "cost": "3.50",
      "made": false,
      "onHand": "210",
      "reserved": "0",
      "available": "210",
      "incoming": "0"
    }
  ],
  "nextCursor": null
}
```
