---
title: Import
description: The Import API bulk-loads your machine fleet and cutting-tool library from a file, with a preview call that validates every row before anything is written.
---

# Import

The Import API bulk-loads your machine fleet and cutting-tool library from a file, with a preview call that validates every row before anything is written.

> **Auto-generated** from the public OpenAPI spec — this page never
> drifts from the running API. Base URL `https://api.arcnm.io`. Authenticate with
> the `X-API-Key` header (see [Authentication](../authentication.md)).

## Import Machines

`POST /api/v1/import/machines`

Import your machine park from CSV text or a CSV / Excel upload. Machines are created with their
class's standard capabilities, your capability columns over them (or,
with as_library_instance, as instances of the class's standard type
holding only what your columns state), with your make, model and the
rate you state, and attached to the target environment. Re-uploading
the same file is safe: existing machines are recognised by name and
never duplicated.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `as_library_instance` | boolean | no | true creates each new machine as an instance of the platform's standard machine type for its class, holding only the capabilities your columns state; the type supplies the rest. false (the default) creates a machine of your own with its class's full standard capabilities and your columns over them. Machines you already have are attached as they are either way. |
| `csv` | string | no | The machine list as CSV text (headered; comma, semicolon or tab separated). Columns: name, class, hourly_rate_eur — plus optional operator_eur_per_h, envelope_x_mm / envelope_y_mm / envelope_z_mm, spindle_power_kw, priority, vendor, model_no, qty, and every machine capability as a column of its own under its field name (max_spindle_rpm, max_tool_diameter_mm, tool_interface, axes_simultaneous, axes_indexable, max_table_load_kg, tool_magazine_capacity, rapid_traverse_m_per_min, max_bar_diameter_mm, turret_stations, counter_spindle, bar_feeder, …). Header spellings are matched tolerantly, German ones and a unit after the name included (Drehzahl [1/min], max. Werkzeug-Ø, Werkzeugaufnahme, Stangendurchlass, Revolverplätze, Gegenspindel, Hersteller, Anzahl); a title above the header is skipped. Numbers are plain, with the list's decimal mark (see decimal_mark); ja / nein and x are read as written. qty is read and shown, and each row is still one machine. At most 500 data rows. An upload (data_source_id) takes the same columns. |
| `data_source_id` | string | no | A confirmed upload holding the list as a .csv or .xlsx file (presign_upload, then confirm_upload). Send this or csv, not both. An API key or an agent's grant needs the uploads:read scope to name one. |
| `decimal_mark` | `auto` \| `point` \| `comma` | no | The decimal mark of a CSV list. 'auto' (the default) is the one its delimiter implies: the comma for a semicolon-separated list, the point for a comma- or tab-separated one. 'point' or 'comma' states it. An Excel file's numbers are numbers, and its text cells are read with the point. A number is an optional sign, digits, and optionally the decimal mark and digits; a cell with anything else (a thousands separator, a currency sign or unit, the other mark) is an error on its row that says what was found. |
| `env_id` | string | no | Costing environment the machines join; omit for your default environment. |
| `expected_plan_digest` | string | no | The plan_digest of the preview you are confirming. When the import would now do something else (a row or the environment changed since), nothing is written and the answer is 409 plan_changed: preview again. |
| `sheet` | string | no | Worksheet of an Excel upload to read, by name; the first one when omitted. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/import/machines \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "as_library_instance": false,
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "expected_plan_digest": "string",
    "sheet": "string"
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/import/machines",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "as_library_instance": False,
        "csv": "string",
        "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "decimal_mark": "auto",
        "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "expected_plan_digest": "string",
        "sheet": "string"
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/machines", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "as_library_instance": false,
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "expected_plan_digest": "string",
    "sheet": "string"
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | Validation Error |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `applied` | boolean | False for a preview (nothing written); true for a commit. |
| `attached` | integer | Rows that attach (or would attach) an existing item. |
| `created` | integer | Rows that create (or would create) a new item. |
| `env_id` | string | The costing environment the import targets; null in a preview when your organization has no default environment yet. |
| `errored` | integer | Rows with errors; nothing happens for them. |
| `plan_digest` | string | Fingerprint of what the preview plans, row by row. Send it as expected_plan_digest with the import to write exactly this plan. |
| `rows` | ImportRowPublic[] | Per-row detail, in file order. |
| `skipped` | integer | Rows skipped as already present. |
| `total_rows` | integer | Data rows read from the file. |
| `unmapped_columns` | string[] | Header cells this import does not read, as written; their values are ignored. |

**Example response**

```json
{
  "applied": true,
  "attached": 0,
  "created": 0,
  "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "errored": 0,
  "plan_digest": "string",
  "rows": [
    {
      "action": "create+attach",
      "errors": [
        "string"
      ],
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "library_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "string",
      "parsed": {},
      "row": 0
    }
  ],
  "skipped": 0,
  "total_rows": 0,
  "unmapped_columns": [
    "string"
  ]
}
```

## Preview Machine Import

`POST /api/v1/import/machines/preview`

Preview a machine-park import: per row, the values as read, any
errors, and what the import would do — create the machine and attach
it, attach a machine you already have under that name, or skip one
already in the environment — and the columns it does not read.
Nothing is written.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `as_library_instance` | boolean | no | true creates each new machine as an instance of the platform's standard machine type for its class, holding only the capabilities your columns state; the type supplies the rest. false (the default) creates a machine of your own with its class's full standard capabilities and your columns over them. Machines you already have are attached as they are either way. |
| `csv` | string | no | The machine list as CSV text (headered; comma, semicolon or tab separated). Columns: name, class, hourly_rate_eur — plus optional operator_eur_per_h, envelope_x_mm / envelope_y_mm / envelope_z_mm, spindle_power_kw, priority, vendor, model_no, qty, and every machine capability as a column of its own under its field name (max_spindle_rpm, max_tool_diameter_mm, tool_interface, axes_simultaneous, axes_indexable, max_table_load_kg, tool_magazine_capacity, rapid_traverse_m_per_min, max_bar_diameter_mm, turret_stations, counter_spindle, bar_feeder, …). Header spellings are matched tolerantly, German ones and a unit after the name included (Drehzahl [1/min], max. Werkzeug-Ø, Werkzeugaufnahme, Stangendurchlass, Revolverplätze, Gegenspindel, Hersteller, Anzahl); a title above the header is skipped. Numbers are plain, with the list's decimal mark (see decimal_mark); ja / nein and x are read as written. qty is read and shown, and each row is still one machine. At most 500 data rows. An upload (data_source_id) takes the same columns. |
| `data_source_id` | string | no | A confirmed upload holding the list as a .csv or .xlsx file (presign_upload, then confirm_upload). Send this or csv, not both. An API key or an agent's grant needs the uploads:read scope to name one. |
| `decimal_mark` | `auto` \| `point` \| `comma` | no | The decimal mark of a CSV list. 'auto' (the default) is the one its delimiter implies: the comma for a semicolon-separated list, the point for a comma- or tab-separated one. 'point' or 'comma' states it. An Excel file's numbers are numbers, and its text cells are read with the point. A number is an optional sign, digits, and optionally the decimal mark and digits; a cell with anything else (a thousands separator, a currency sign or unit, the other mark) is an error on its row that says what was found. |
| `env_id` | string | no | Costing environment the machines join; omit for your default environment. |
| `sheet` | string | no | Worksheet of an Excel upload to read, by name; the first one when omitted. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/import/machines/preview \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "as_library_instance": false,
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "sheet": "string"
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/import/machines/preview",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "as_library_instance": False,
        "csv": "string",
        "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "decimal_mark": "auto",
        "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "sheet": "string"
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/machines/preview", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "as_library_instance": false,
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "sheet": "string"
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | Validation Error |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `applied` | boolean | False for a preview (nothing written); true for a commit. |
| `attached` | integer | Rows that attach (or would attach) an existing item. |
| `created` | integer | Rows that create (or would create) a new item. |
| `env_id` | string | The costing environment the import targets; null in a preview when your organization has no default environment yet. |
| `errored` | integer | Rows with errors; nothing happens for them. |
| `plan_digest` | string | Fingerprint of what the preview plans, row by row. Send it as expected_plan_digest with the import to write exactly this plan. |
| `rows` | ImportRowPublic[] | Per-row detail, in file order. |
| `skipped` | integer | Rows skipped as already present. |
| `total_rows` | integer | Data rows read from the file. |
| `unmapped_columns` | string[] | Header cells this import does not read, as written; their values are ignored. |

**Example response**

```json
{
  "applied": true,
  "attached": 0,
  "created": 0,
  "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "errored": 0,
  "plan_digest": "string",
  "rows": [
    {
      "action": "create+attach",
      "errors": [
        "string"
      ],
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "library_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "string",
      "parsed": {},
      "row": 0
    }
  ],
  "skipped": 0,
  "total_rows": 0,
  "unmapped_columns": [
    "string"
  ]
}
```

## Import Stock Items

`POST /api/v1/import/stock-items`

Import your article list of raw materials from CSV text or a CSV /
Excel upload. A row that names a standard item (by its designation, else
by its dims) states your override on it — article number, your
supplier's reference, stocked, lead time, the lengths you buy — without
copying it; any other row adds an item of your own, checked by the shape
registry. A row with a problem is reported and costs no other row.
Importing the same file again changes nothing.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `csv` | string | no | Your article list of raw materials as CSV text (headered; comma, semicolon or tab separated). Each row names an item by its designation (e.g. Fl 60x8 EN 10058 warmgewalzt), or by family and dims — the dims as columns of their own (d, b, t, h, s, od, wt, a, …) or as one dims cell (60x8, or b=60;t=8) — plus optional material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked (ja / nein), lead_time_days, delivery_lengths_mm (separated by |, e.g. 6000|3000) and kg_per_m_printed. German header spellings are matched too (Bezeichnung, Abmessung, Durchmesser, Breite, Dicke, Lieferzustand, Artikelnummer, Lieferzeit, Lieferlänge); a title above the header is skipped. At most 2000 data rows. An upload (data_source_id) takes the same columns. |
| `data_source_id` | string | no | A confirmed upload holding the list as a .csv or .xlsx file (presign_upload, then confirm_upload). Send this or csv, not both. An API key or an agent's grant needs the uploads:read scope to name one. |
| `decimal_mark` | `auto` \| `point` \| `comma` | no | The decimal mark of a CSV list. 'auto' (the default) is the one its delimiter implies: the comma for a semicolon-separated list, the point for a comma- or tab-separated one. 'point' or 'comma' states it. An Excel file's numbers are numbers, and its text cells are read with the point. A number is an optional sign, digits, and optionally the decimal mark and digits; a cell with anything else (a thousands separator, a currency sign or unit, the other mark) is an error on its row that says what was found. |
| `expected_plan_digest` | string | no | The plan_digest of the preview you are confirming. When the import would now do something else (a row or the environment changed since), nothing is written and the answer is 409 plan_changed: preview again. |
| `header_map` | object | no | Your column names, each mapped to the field it holds: header as your file writes it → designation, family, dims, material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked, lead_time_days, delivery_lengths_mm, kg_per_m_printed, or a dimension (d, b, t, h, s, od, wt, a, …). Headers are matched ignoring case, spaces and punctuation, and a mapped header wins over the spellings the import knows by itself. Omit it to use your organization's saved header map. |
| `material_group` | string | no | The material group of rows that state none: steel, stainless or aluminium. |
| `save_header_map` | boolean | no | true saves header_map as your organization's header map when the import is written (never on a preview). |
| `sheet` | string | no | Worksheet of an Excel upload to read, by name; the first one when omitted. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/import/stock-items \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "expected_plan_digest": "string",
    "header_map": {},
    "material_group": "string",
    "save_header_map": false,
    "sheet": "string"
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/import/stock-items",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "csv": "string",
        "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "decimal_mark": "auto",
        "expected_plan_digest": "string",
        "header_map": {},
        "material_group": "string",
        "save_header_map": False,
        "sheet": "string"
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/stock-items", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "expected_plan_digest": "string",
    "header_map": {},
    "material_group": "string",
    "save_header_map": false,
    "sheet": "string"
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `409` | The import would no longer do what the preview you confirmed showed (`plan_changed`). |
| `422` | The file has no usable header, or too many rows. |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `applied` | boolean | False for a preview (nothing written); true for a commit. |
| `attached` | integer | Rows that attach (or would attach) an existing item. |
| `created` | integer | Rows that create (or would create) a new item. |
| `env_id` | string | The costing environment the import targets; null in a preview when your organization has no default environment yet. |
| `errored` | integer | Rows with errors; nothing happens for them. |
| `matched` | integer | Rows that overlay (or would overlay) a standard item. |
| `plan_digest` | string | Fingerprint of what the preview plans, row by row. Send it as expected_plan_digest with the import to write exactly this plan. |
| `rows` | StockItemImportRowPublic[] | Per-row detail, in file order: every data row, none dropped. |
| `skipped` | integer | Rows skipped as already present. |
| `total_rows` | integer | Data rows read from the file. |
| `unmapped_columns` | string[] | Header cells this import does not read, as written; their values are ignored. |

**Example response**

```json
{
  "applied": true,
  "attached": 0,
  "created": 0,
  "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "errored": 0,
  "matched": 0,
  "plan_digest": "string",
  "rows": [
    {
      "action": "matched",
      "errors": [
        "string"
      ],
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "library_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "string",
      "parsed": {},
      "reason": "empty",
      "row": 0
    }
  ],
  "skipped": 0,
  "total_rows": 0,
  "unmapped_columns": [
    "string"
  ]
}
```

## Get Stock Item Header Map

`GET /api/v1/import/stock-items/header-map`

Your organization's header map for the article-list import: your
column names and the field each holds. Empty until you state one.

**Request**

<CodeTabs>

```bash title="cURL"
curl -X GET https://api.arcnm.io/api/v1/import/stock-items/header-map \
  -H "X-API-Key: $ARCNM_API_KEY"
```

```python title="Python"
import requests

resp = requests.get(
    "https://api.arcnm.io/api/v1/import/stock-items/header-map",
    headers={"X-API-Key": "YOUR_API_KEY"},
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/stock-items/header-map", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
  },
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | Validation Error |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `header_map` | object | Your column names, each mapped to the field it holds: header as your file writes it → designation, family, dims, material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked, lead_time_days, delivery_lengths_mm, kg_per_m_printed, or a dimension (d, b, t, h, s, od, wt, a, …). Headers are matched ignoring case, spaces and punctuation, and a mapped header wins over the spellings the import knows by itself. |

**Example response**

```json
{
  "header_map": {}
}
```

## Put Stock Item Header Map

`PUT /api/v1/import/stock-items/header-map`

State your organization's header map once: every later import that
sends none reads your columns with it. The map is whole: it replaces the
one you had, and an empty map removes it.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `header_map` | object | yes | Your column names, each mapped to the field it holds: header as your file writes it → designation, family, dims, material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked, lead_time_days, delivery_lengths_mm, kg_per_m_printed, or a dimension (d, b, t, h, s, od, wt, a, …). Headers are matched ignoring case, spaces and punctuation, and a mapped header wins over the spellings the import knows by itself. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X PUT https://api.arcnm.io/api/v1/import/stock-items/header-map \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "header_map": {}
  }'
```

```python title="Python"
import requests

resp = requests.put(
    "https://api.arcnm.io/api/v1/import/stock-items/header-map",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "header_map": {}
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/stock-items/header-map", {
  method: "PUT",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "header_map": {}
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | Validation Error |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `header_map` | object | Your column names, each mapped to the field it holds: header as your file writes it → designation, family, dims, material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked, lead_time_days, delivery_lengths_mm, kg_per_m_printed, or a dimension (d, b, t, h, s, od, wt, a, …). Headers are matched ignoring case, spaces and punctuation, and a mapped header wins over the spellings the import knows by itself. |

**Example response**

```json
{
  "header_map": {}
}
```

## Preview Stock Item Import

`POST /api/v1/import/stock-items/preview`

Preview an import of your article list of raw materials: per row, the
values as read and what the import would do — overlay a standard item
(matched), add an item of your own (created), nothing because it is
already so (unchanged), or nothing because the row has a problem
(reported, with its reason) — and the columns it does not read. Nothing
is written.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `csv` | string | no | Your article list of raw materials as CSV text (headered; comma, semicolon or tab separated). Each row names an item by its designation (e.g. Fl 60x8 EN 10058 warmgewalzt), or by family and dims — the dims as columns of their own (d, b, t, h, s, od, wt, a, …) or as one dims cell (60x8, or b=60;t=8) — plus optional material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked (ja / nein), lead_time_days, delivery_lengths_mm (separated by |, e.g. 6000|3000) and kg_per_m_printed. German header spellings are matched too (Bezeichnung, Abmessung, Durchmesser, Breite, Dicke, Lieferzustand, Artikelnummer, Lieferzeit, Lieferlänge); a title above the header is skipped. At most 2000 data rows. An upload (data_source_id) takes the same columns. |
| `data_source_id` | string | no | A confirmed upload holding the list as a .csv or .xlsx file (presign_upload, then confirm_upload). Send this or csv, not both. An API key or an agent's grant needs the uploads:read scope to name one. |
| `decimal_mark` | `auto` \| `point` \| `comma` | no | The decimal mark of a CSV list. 'auto' (the default) is the one its delimiter implies: the comma for a semicolon-separated list, the point for a comma- or tab-separated one. 'point' or 'comma' states it. An Excel file's numbers are numbers, and its text cells are read with the point. A number is an optional sign, digits, and optionally the decimal mark and digits; a cell with anything else (a thousands separator, a currency sign or unit, the other mark) is an error on its row that says what was found. |
| `header_map` | object | no | Your column names, each mapped to the field it holds: header as your file writes it → designation, family, dims, material_group, dimension_standard, delivery_condition, article_no, supplier_ref, stocked, lead_time_days, delivery_lengths_mm, kg_per_m_printed, or a dimension (d, b, t, h, s, od, wt, a, …). Headers are matched ignoring case, spaces and punctuation, and a mapped header wins over the spellings the import knows by itself. Omit it to use your organization's saved header map. |
| `material_group` | string | no | The material group of rows that state none: steel, stainless or aluminium. |
| `save_header_map` | boolean | no | true saves header_map as your organization's header map when the import is written (never on a preview). |
| `sheet` | string | no | Worksheet of an Excel upload to read, by name; the first one when omitted. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/import/stock-items/preview \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "header_map": {},
    "material_group": "string",
    "save_header_map": false,
    "sheet": "string"
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/import/stock-items/preview",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "csv": "string",
        "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "decimal_mark": "auto",
        "header_map": {},
        "material_group": "string",
        "save_header_map": False,
        "sheet": "string"
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/stock-items/preview", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "header_map": {},
    "material_group": "string",
    "save_header_map": false,
    "sheet": "string"
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | The file has no usable header, or too many rows. |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `applied` | boolean | False for a preview (nothing written); true for a commit. |
| `attached` | integer | Rows that attach (or would attach) an existing item. |
| `created` | integer | Rows that create (or would create) a new item. |
| `env_id` | string | The costing environment the import targets; null in a preview when your organization has no default environment yet. |
| `errored` | integer | Rows with errors; nothing happens for them. |
| `matched` | integer | Rows that overlay (or would overlay) a standard item. |
| `plan_digest` | string | Fingerprint of what the preview plans, row by row. Send it as expected_plan_digest with the import to write exactly this plan. |
| `rows` | StockItemImportRowPublic[] | Per-row detail, in file order: every data row, none dropped. |
| `skipped` | integer | Rows skipped as already present. |
| `total_rows` | integer | Data rows read from the file. |
| `unmapped_columns` | string[] | Header cells this import does not read, as written; their values are ignored. |

**Example response**

```json
{
  "applied": true,
  "attached": 0,
  "created": 0,
  "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "errored": 0,
  "matched": 0,
  "plan_digest": "string",
  "rows": [
    {
      "action": "matched",
      "errors": [
        "string"
      ],
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "library_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "string",
      "parsed": {},
      "reason": "empty",
      "row": 0
    }
  ],
  "skipped": 0,
  "total_rows": 0,
  "unmapped_columns": [
    "string"
  ]
}
```

## Import Tools

`POST /api/v1/import/tools`

Import your tool crib from CSV text or a CSV / Excel upload. Tools are created with their
kind-specific properties validated (a saw blade needs its kerf and
construction; rotating cutters need nothing extra) and attached to
the target environment (your default one unless `env_id` names
another). Re-uploading the same file is safe:
existing tools are recognised by name and kind, never duplicated.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `csv` | string | no | The tool list as CSV text (headered). Columns: name, kind — plus optional diameter_mm, teeth, cutting_material, price_eur, tool_life_min, vendor, item_no, coating, notes, and any kind-specific property as its own column (e.g. kerf_mm, blade_type and format for a saw blade, life_quantity for non-rotating tools). An empty cutting_material is read as carbide for every kind, saw blades included — state it (e.g. hss_e) for a tool that is not carbide. At most 1000 data rows. An upload (data_source_id) takes the same columns. |
| `data_source_id` | string | no | A confirmed upload holding the list as a .csv or .xlsx file (presign_upload, then confirm_upload). Send this or csv, not both. An API key or an agent's grant needs the uploads:read scope to name one. |
| `decimal_mark` | `auto` \| `point` \| `comma` | no | The decimal mark of a CSV list. 'auto' (the default) is the one its delimiter implies: the comma for a semicolon-separated list, the point for a comma- or tab-separated one. 'point' or 'comma' states it. An Excel file's numbers are numbers, and its text cells are read with the point. A number is an optional sign, digits, and optionally the decimal mark and digits; a cell with anything else (a thousands separator, a currency sign or unit, the other mark) is an error on its row that says what was found. |
| `env_id` | string | no | Costing environment the tools join; omit for your default environment. |
| `expected_plan_digest` | string | no | The plan_digest of the preview you are confirming. When the import would now do something else (a row or the environment changed since), nothing is written and the answer is 409 plan_changed: preview again. |
| `sheet` | string | no | Worksheet of an Excel upload to read, by name; the first one when omitted. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/import/tools \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "expected_plan_digest": "string",
    "sheet": "string"
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/import/tools",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "csv": "string",
        "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "decimal_mark": "auto",
        "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "expected_plan_digest": "string",
        "sheet": "string"
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/tools", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "expected_plan_digest": "string",
    "sheet": "string"
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | Validation Error |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `applied` | boolean | False for a preview (nothing written); true for a commit. |
| `attached` | integer | Rows that attach (or would attach) an existing item. |
| `created` | integer | Rows that create (or would create) a new item. |
| `env_id` | string | The costing environment the import targets; null in a preview when your organization has no default environment yet. |
| `errored` | integer | Rows with errors; nothing happens for them. |
| `plan_digest` | string | Fingerprint of what the preview plans, row by row. Send it as expected_plan_digest with the import to write exactly this plan. |
| `rows` | ImportRowPublic[] | Per-row detail, in file order. |
| `skipped` | integer | Rows skipped as already present. |
| `total_rows` | integer | Data rows read from the file. |
| `unmapped_columns` | string[] | Header cells this import does not read, as written; their values are ignored. |

**Example response**

```json
{
  "applied": true,
  "attached": 0,
  "created": 0,
  "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "errored": 0,
  "plan_digest": "string",
  "rows": [
    {
      "action": "create+attach",
      "errors": [
        "string"
      ],
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "library_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "string",
      "parsed": {},
      "row": 0
    }
  ],
  "skipped": 0,
  "total_rows": 0,
  "unmapped_columns": [
    "string"
  ]
}
```

## Preview Tool Import

`POST /api/v1/import/tools/preview`

Preview a tool-crib import: per row, the values as read (including
the kind-specific properties), any errors, and what the import would
do. Nothing is written.

**Request body** (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `csv` | string | no | The tool list as CSV text (headered). Columns: name, kind — plus optional diameter_mm, teeth, cutting_material, price_eur, tool_life_min, vendor, item_no, coating, notes, and any kind-specific property as its own column (e.g. kerf_mm, blade_type and format for a saw blade, life_quantity for non-rotating tools). An empty cutting_material is read as carbide for every kind, saw blades included — state it (e.g. hss_e) for a tool that is not carbide. At most 1000 data rows. An upload (data_source_id) takes the same columns. |
| `data_source_id` | string | no | A confirmed upload holding the list as a .csv or .xlsx file (presign_upload, then confirm_upload). Send this or csv, not both. An API key or an agent's grant needs the uploads:read scope to name one. |
| `decimal_mark` | `auto` \| `point` \| `comma` | no | The decimal mark of a CSV list. 'auto' (the default) is the one its delimiter implies: the comma for a semicolon-separated list, the point for a comma- or tab-separated one. 'point' or 'comma' states it. An Excel file's numbers are numbers, and its text cells are read with the point. A number is an optional sign, digits, and optionally the decimal mark and digits; a cell with anything else (a thousands separator, a currency sign or unit, the other mark) is an error on its row that says what was found. |
| `env_id` | string | no | Costing environment the tools join; omit for your default environment. |
| `sheet` | string | no | Worksheet of an Excel upload to read, by name; the first one when omitted. |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/import/tools/preview \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "sheet": "string"
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/import/tools/preview",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "csv": "string",
        "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "decimal_mark": "auto",
        "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "sheet": "string"
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/import/tools/preview", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "csv": "string",
    "data_source_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "decimal_mark": "auto",
    "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "sheet": "string"
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `422` | Validation Error |
| `default` | Error — the error envelope; branch on `error.code`. |

**Errors**

Standard error responses — see the [Errors catalog](../errors.md) for the full envelope, `request_id`, and retry-safety table.

| Status | Code | When |
| --- | --- | --- |
| `401` | `invalid_api_key` | Missing, malformed, or revoked API key. |
| `403` | `insufficient_scope` | The key is valid but lacks a scope this endpoint requires. |
| `409` | `conflict` | A conflicting change, or an `Idempotency-Key` reused with a different body. |
| `429` | `rate_limited` | Per-key or per-org rate limit exceeded — back off with jitter and retry. |


**Response body** `200`

| Field | Type | Description |
| --- | --- | --- |
| `applied` | boolean | False for a preview (nothing written); true for a commit. |
| `attached` | integer | Rows that attach (or would attach) an existing item. |
| `created` | integer | Rows that create (or would create) a new item. |
| `env_id` | string | The costing environment the import targets; null in a preview when your organization has no default environment yet. |
| `errored` | integer | Rows with errors; nothing happens for them. |
| `plan_digest` | string | Fingerprint of what the preview plans, row by row. Send it as expected_plan_digest with the import to write exactly this plan. |
| `rows` | ImportRowPublic[] | Per-row detail, in file order. |
| `skipped` | integer | Rows skipped as already present. |
| `total_rows` | integer | Data rows read from the file. |
| `unmapped_columns` | string[] | Header cells this import does not read, as written; their values are ignored. |

**Example response**

```json
{
  "applied": true,
  "attached": 0,
  "created": 0,
  "env_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "errored": 0,
  "plan_digest": "string",
  "rows": [
    {
      "action": "create+attach",
      "errors": [
        "string"
      ],
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "library_entry_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "string",
      "parsed": {},
      "row": 0
    }
  ],
  "skipped": 0,
  "total_rows": 0,
  "unmapped_columns": [
    "string"
  ]
}
```
