---
title: Raw Material
description: The Raw Material API adds stock items and formats to several of your environments in one call: all of them or none, with a dry run that shows what each gains.
---

# Raw Material

The Raw Material API adds stock items and formats to several of your environments in one call: all of them or none, with a dry run that shows what each gains.

> **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)).

## Add stock items and formats to several environments at once.

`POST /api/v1/raw-material/add`

Add one selection of raw material to several of your environments:
all of them, or — if one is not yours, or a selected row is not usable —
none. `dry_run` answers with what each environment would gain.

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dry_run` | boolean | no | Count what the write would change, and change nothing. |
| `environment_ids` | string[] | yes | The costing environments to add the selection to. |
| `formats` | StockFormatSelection | no |  |
| `items` | StockItemSelection | no |  |

**Request**

<CodeTabs>

```bash title="cURL"
curl -X POST https://api.arcnm.io/api/v1/raw-material/add \
  -H "X-API-Key: $ARCNM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "environment_ids": [
      "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    ]
  }'
```

```python title="Python"
import requests

resp = requests.post(
    "https://api.arcnm.io/api/v1/raw-material/add",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "environment_ids": [
            "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        ]
    },
)
resp.raise_for_status()
print(resp.json())
```

```typescript title="TypeScript"
const resp = await fetch("https://api.arcnm.io/api/v1/raw-material/add", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.ARCNM_API_KEY!,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "environment_ids": [
      "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    ]
  }),
})
const data = await resp.json()
```

</CodeTabs>

**Responses**

| Status | Description |
| --- | --- |
| `200` | Successful Response |
| `404` | No costing environment of your organization has this id (`environment_not_found`); or a selection names a stock item or stock format your organization cannot use today (`stock_item_not_found`, `stock_format_not_found`) — nothing was changed. |
| `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 |
| --- | --- | --- |
| `dry_run` | boolean |  |
| `environments` | RawMaterialChange[] |  |
| `formats` | integer | Stock formats added, across the environments. |
| `items` | integer | Stock items added, across the environments. |

**Example response**

```json
{
  "dry_run": false,
  "environments": [
    {
      "dry_run": false,
      "environment_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "formats": 0,
      "items": 0,
      "items_sharing_section": 0
    }
  ],
  "formats": 0,
  "items": 0
}
```
