<!-- Source: https://www.orderkraft.com/docs/developers/api-reference/ -->

# API reference

Every endpoint lives under `https://orderkraft.app/api/v1` and needs an API key in the `Authorization` header. `GET` requests need the key's *Read* permission. `POST`, `PATCH` and `DELETE` need *Write*. Start with [The Orderkraft API](/docs/developers/api/) if you haven't made a request yet. It covers keys, pagination, errors and rate limits.

| Endpoint | What it does |
| --- | --- |
| `GET /products` | List products |
| `GET /products/:id` | Get a product, its lead time and its variants |
| `PATCH /products/:id` | Change how a product is produced |
| `GET /product_variants` | List variants |
| `GET /product_variants/:id` | Get a variant, its lead time and its bill of materials |
| `GET /materials` | List raw materials and components |
| `GET /materials/:id` | Get a material, and for a component its lead time and bill of materials |
| `POST /materials` | Create a raw material or component |
| `PATCH /materials/:id` | Change a material |
| `GET /lead_times/:id` | Get a lead time |
| `PATCH /lead_times/:id` | Change a lead time |
| `GET /bill_of_materials/:id` | Get a bill of materials |
| `POST /bill_of_materials/:id/inputs` | Add a material to a bill of materials |
| `PATCH /bill_of_materials/:id/inputs/:input_id` | Change how much of a material goes in |
| `DELETE /bill_of_materials/:id/inputs/:input_id` | Remove a material from a bill of materials |
| `GET /manufacturing_orders` | List manufacturing orders |
| `GET /manufacturing_orders/:id` | Get a manufacturing order with its materials, work orders and holds |
| `PATCH /manufacturing_orders/:id` | Move a manufacturing order's ship-by date |
| `POST /manufacturing_orders/:id/release` | Send an order in analysis on to production |
| `POST /manufacturing_orders/:id/holds` | Put an order on hold |
| `DELETE /manufacturing_orders/:id/holds/:hold_id` | Lift a hold |
| `GET /work_orders` | List work orders |
| `GET /work_orders/:id` | Get a work order |
| `GET /webhook_subscriptions` | List webhook subscriptions |
| `GET /webhook_subscriptions/:id` | Get a webhook subscription |
| `POST /webhook_subscriptions` | Subscribe to webhooks |
| `PATCH /webhook_subscriptions/:id` | Change a subscription's URL or topics |
| `DELETE /webhook_subscriptions/:id` | Stop a subscription |
| `POST /webhook_subscriptions/:id/secret` | Rotate a subscription's signing secret |

## Products

Products come from Shopify. Orderkraft adds how each one is produced, and whether customers personalise it.

### List products

`GET /products`

| Param | What it does |
| --- | --- |
| `query` | Search the product name |
| `includeArchived` | `true` to include archived products |
| `page`, `limit` | See [pagination](/docs/developers/api/#pagination) |

```json
{
  "data": [
    {
      "id": 214,
      "shopifyId": "gid://shopify/Product/8912374651",
      "name": "Walnut dining table",
      "imageUrl": "https://cdn.shopify.com/s/files/...",
      "productionStrategy": "made_to_order",
      "customisable": false,
      "archivedAt": null,
      "createdAt": "2026-09-14T10:02:11.000+02:00",
      "updatedAt": "2026-11-20T16:45:03.000+01:00"
    }
  ],
  "pagination": { "page": 1, "pages": 1, "count": 1, "limit": 20, "nextPage": null }
}
```

`productionStrategy` is one of:

- `regular`: shipped from stock. Orderkraft leaves it alone.
- `made_to_order`: made for each order, from the [bill of materials](/docs/concepts/made-to-order/) of the variant the customer bought.
- `built_on_the_fly`: put together from parts the customer picks. See [built on the fly](/docs/concepts/built-on-the-fly/).

### Get a product

`GET /products/:id`

Returns the product with two more fields: `leadTime`, the product's lead time (see [lead times](#lead-times)), and `variants`, every variant in the same shape as [List variants](#list-variants).

### Update a product

`PATCH /products/:id`

| Field | What it does |
| --- | --- |
| `productionStrategy` | `regular`, `made_to_order` or `built_on_the_fly` |
| `customisable` | `true` when customers personalise the product, like an engraving |

Answers with the product, like [Get a product](#get-a-product).

Be careful moving a product away from `made_to_order`. It deletes the bill of materials of every variant, exactly like it does in the app, and that can't be undone. Making a product `made_to_order` gives each variant an empty bill of materials to fill in.

## Product variants

### List variants

`GET /product_variants`

| Param | What it does |
| --- | --- |
| `productId` | Only the variants of this product |
| `query` | Search the variant name, SKU and barcode |
| `includeArchived` | `true` to include archived variants |
| `page`, `limit` | See [pagination](/docs/developers/api/#pagination) |

```json
{
  "data": [
    {
      "id": 1093,
      "shopifyId": "gid://shopify/ProductVariant/46120938471",
      "productId": 214,
      "name": "180 cm / Natural oil",
      "sku": "WDT-180-NAT",
      "barcode": null,
      "archivedAt": null,
      "createdAt": "2026-09-14T10:02:11.000+02:00",
      "updatedAt": "2026-11-20T16:45:03.000+01:00"
    }
  ],
  "pagination": { "page": 1, "pages": 1, "count": 1, "limit": 20, "nextPage": null }
}
```

### Get a variant

`GET /product_variants/:id`

Returns the variant with its `leadTime` and its `billOfMaterial`. The bill of materials is `null` unless the product is made to order.

## Materials

Materials are what your products are made of. A *raw material* is bought in, like oak planks or gold paint. A *component* is made from other materials, so it has its own bill of materials and lead time, like a table top you build ahead of time.

### List materials

`GET /materials`

| Param | What it does |
| --- | --- |
| `materialType` | `raw_material` or `component` |
| `query` | Search the name and SKU |
| `includeArchived` | `true` to include archived materials |
| `page`, `limit` | See [pagination](/docs/developers/api/#pagination) |

```json
{
  "data": [
    {
      "id": 812,
      "materialType": "raw_material",
      "name": "Oak plank 2 m",
      "description": "Kiln-dried, from the Deventer supplier",
      "sku": "OAK-PLANK-2M",
      "barcode": null,
      "unitOfMeasure": "pc",
      "archivedAt": null,
      "createdAt": "2026-10-01T08:30:00.000+02:00",
      "updatedAt": "2026-11-18T11:12:40.000+01:00"
    }
  ],
  "pagination": { "page": 1, "pages": 1, "count": 1, "limit": 20, "nextPage": null }
}
```

### Get a material

`GET /materials/:id`

A raw material comes back exactly as in the list. A component also has its `leadTime` and `billOfMaterial`.

### Create a material

`POST /materials`

| Field | What it does |
| --- | --- |
| `materialType` | Required. `raw_material` or `component` |
| `name` | Required |
| `unitOfMeasure` | Required. The unit it's counted or measured in. See [units](#units-of-measure) |
| `sku` | Optional. Unique within your shop |
| `barcode` | Optional. Unique within your shop |
| `description` | Optional. A note about the material |

```sh
curl -X POST https://orderkraft.app/api/v1/materials \
  -H "Authorization: Bearer ok_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "materialType": "raw_material", "name": "Linseed oil", "unitOfMeasure": "ml", "sku": "OIL-LIN" }'
```

Answers with `201 Created` and the new material. A new component starts with an empty bill of materials.

### Update a material

`PATCH /materials/:id`

Takes `name`, `description`, `sku`, `barcode` and `unitOfMeasure`. You can't turn a raw material into a component, or the other way around.

## Lead times

A lead time is how long production takes, plus how long it then takes to get the finished item into stock (dock to stock). Each part is a range in one unit. See [ship-by dates](/docs/concepts/ship-by-dates/) for how Orderkraft uses them.

Variants and components have a lead time you set yourself. A product's lead time is calculated from its variants, so you can read it but not change it. That's what `editable` tells you.

```json
{
  "data": {
    "id": 377,
    "timeableType": "ProductVariant",
    "timeableId": 1093,
    "editable": true,
    "productionTime": { "min": 10.0, "max": 14.0, "unit": "days" },
    "dockToStockTime": { "min": 1.0, "max": 2.0, "unit": "days" },
    "updatedAt": "2026-11-20T16:45:03.000+01:00"
  }
}
```

Find a lead time's ID on the variant, product or component it belongs to.

### Get a lead time

`GET /lead_times/:id`

### Update a lead time

`PATCH /lead_times/:id`

| Field | What it does |
| --- | --- |
| `productionTimeMin` | At least 1 |
| `productionTimeMax` | At least the minimum |
| `productionTimeUnit` | `minutes`, `hours`, `days`, `weeks` or `months` |
| `dockToStockTimeMin` | At least 0. Not every brand uses dock to stock |
| `dockToStockTimeMax` | At least the minimum |
| `dockToStockTimeUnit` | `minutes`, `hours`, `days`, `weeks` or `months` |

Send only the fields you want to change. The new lead time shows on your storefront the same way it does when you change it in the app. Manufacturing orders that already exist keep the ship-by date they were given.

Updating a product's lead time answers with `404`. Update its variants instead.

## Bills of materials

A bill of materials is the recipe for one variant or component: which materials go in, and how much of each. Only variants of made-to-order products have one, and every component does.

```json
{
  "data": {
    "id": 95,
    "outputType": "ProductVariant",
    "outputId": 1093,
    "inputs": [
      {
        "id": 402,
        "material": { "id": 812, "materialType": "raw_material", "name": "Oak plank 2 m", "sku": "OAK-PLANK-2M" },
        "amount": 6.0,
        "unitOfMeasure": "pc"
      },
      {
        "id": 403,
        "material": { "id": 820, "materialType": "raw_material", "name": "Linseed oil", "sku": "OIL-LIN" },
        "amount": 250.0,
        "unitOfMeasure": "ml"
      }
    ]
  }
}
```

Find the ID as `billOfMaterial.id` on a variant or component. Every endpoint below answers with the whole bill of materials, so you always see the result of your change.

### Get a bill of materials

`GET /bill_of_materials/:id`

### Add a material

`POST /bill_of_materials/:id/inputs`

| Field | What it does |
| --- | --- |
| `materialId` | Required. The material to add |
| `amount` | Required. How much goes into making one, more than 0 |
| `unitOfMeasure` | Optional. Defaults to the material's own unit |

```js
const addInput = async (billOfMaterialId, { materialId, amount, unitOfMeasure }) => {
  const response = await fetch(`https://orderkraft.app/api/v1/bill_of_materials/${billOfMaterialId}/inputs`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.ORDERKRAFT_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ materialId, amount, unitOfMeasure }),
  });

  if (!response.ok) {
    const { error } = await response.json();
    throw new Error(`Couldn't add material ${materialId}: ${error}`);
  }

  return (await response.json()).data;
};

await addInput(95, { materialId: 820, amount: 250, unitOfMeasure: "ml" });
```

The unit has to measure the same thing as the material's own unit. You can add a material counted in `kg` in `g`, but not in `ml`. Each material goes into a bill of materials once, so to use more of it, change the amount on the existing input.

### Change an input

`PATCH /bill_of_materials/:id/inputs/:input_id`

Takes `amount` and `unitOfMeasure`. The input ID is the `id` in the `inputs` list, not the material's ID.

### Remove an input

`DELETE /bill_of_materials/:id/inputs/:input_id`

The material stays in your catalog. It just isn't used to make this variant or component anymore.

## Manufacturing orders

A manufacturing order makes a quantity of one variant or component at one location. It's either for a customer's order (`madeToOrder` is `true`) or for stock. See [manufacturing orders](/docs/concepts/manufacturing-orders/) for how they move through production.

### List manufacturing orders

`GET /manufacturing_orders`

Newest first.

| Param | What it does |
| --- | --- |
| `query` | Search the manufacturing order number, like `MO-4K2X9QZ1A`, or the customer's order number, like `#1002` |
| `locationId` | Only orders at this location |
| `filters[status]` | `draft`, `analysis`, `waiting`, `in_progress`, `on_hold`, `completed` or `cancelled`. Repeat as `filters[status][]=` for several |
| `filters[urgency]` | `overdue`, `due_today`, `due_soon`, or `upcoming` for due today or soon |
| `filters[hold]` | `held_by_merchant`, or `awaiting_manufacturing_plan` for orders waiting on a plan |
| `page`, `limit` | See [pagination](/docs/developers/api/#pagination) |

```json
{
  "data": [
    {
      "id": 5521,
      "number": "MO-4K2X9QZ1A",
      "status": "in_progress",
      "orderDate": "2026-11-12T14:20:00.000+01:00",
      "shipBy": "2026-11-26",
      "shippingUrgency": "due_soon",
      "enqueuedAt": "2026-11-12T14:21:05.000+01:00",
      "startedAt": "2026-11-17T08:03:44.000+01:00",
      "completedAt": null,
      "createdAt": "2026-11-12T14:21:02.000+01:00",
      "updatedAt": "2026-11-21T10:15:30.000+01:00",
      "madeToOrder": true,
      "salesOrder": { "id": 3310, "number": "#1002" },
      "location": { "id": 12, "name": "Workshop Enschede", "locationType": "production" },
      "output": {
        "buildableType": "ProductVariant",
        "buildableId": 1093,
        "name": "180 cm / Natural oil",
        "sku": "WDT-180-NAT",
        "productName": "Walnut dining table",
        "requestedQuantity": 1.0,
        "producedQuantity": null,
        "unitOfMeasure": "pc"
      }
    }
  ],
  "pagination": { "page": 1, "pages": 1, "count": 1, "limit": 20, "nextPage": null }
}
```

`shippingUrgency` is `overdue`, `due_today` or `due_soon` (within two days) while the order still has to ship, and `null` when it's on track, finished, or built for stock. Build-to-stock orders have no `shipBy` and no `salesOrder`.

### Get a manufacturing order

`GET /manufacturing_orders/:id`

Returns the manufacturing order with three more lists:

- `inputs`: the materials going in, with `name`, `sku`, `requestedQuantity`, `consumedQuantity` and `unitOfMeasure`.
- `workOrders`: its production steps, with `id`, `number`, `name`, `status`, `startedAt` and `completedAt`.
- `holds`: every time it was put on hold, with the `note`, when it started (`createdAt`) and when it was released (`releasedAt`, `null` while it's still on hold).

### Update a manufacturing order

`PATCH /manufacturing_orders/:id`

| Field | What it does |
| --- | --- |
| `shipBy` | The date the order has to ship by, like `2026-12-15` |

Answers with the manufacturing order, like [Get a manufacturing order](#get-a-manufacturing-order). A made-to-order order always keeps a ship-by date, and a completed or cancelled order can't be moved anymore. Both answer with `422`. To change an order's status, use the release and hold actions below.

### Release a manufacturing order

`POST /manufacturing_orders/:id/release`

When the merchant turns on **ERP** under **Settings → Integrations**, every new manufacturing order starts in `analysis`: it waits for the ERP to confirm the materials are there. Releasing it sends it on to production, so its status becomes `waiting`.

Answers with the manufacturing order, like [Get a manufacturing order](#get-a-manufacturing-order). An order that isn't in analysis can't be released and answers with `422`. That includes an order you put on hold while it was in analysis: lift the hold instead, and the order goes on to production once nothing holds it.

### Put a manufacturing order on hold

`POST /manufacturing_orders/:id/holds`

| Field | What it does |
| --- | --- |
| `note` | Required. Why production is paused, like `Waiting on oak planks`. Merchants see it on the order |

You can hold any order that isn't a draft, completed or cancelled. Holding one in analysis is how an ERP says the materials aren't there yet. Holds add up: an order that's already on hold gets another one, and production only resumes once every hold is lifted.

Answers with `201 Created` and the manufacturing order, with the new hold in `holds`. A hold from the API is the same as one a merchant places in Orderkraft, so the merchant can lift it too.

### Lift a hold

`DELETE /manufacturing_orders/:id/holds/:hold_id`

Releases the hold and answers with the manufacturing order. Once nothing else holds the order, its status goes to `waiting`, also when you held it while it was in analysis. Holds Orderkraft places itself, like the one for an order that matches more than one [manufacturing plan](/docs/concepts/manufacturing-plans/), can't be lifted over the API.

Completing and cancelling still happen in Orderkraft, on the [manufacturing board](/docs/concepts/manufacturing-board/) or the order itself.

## Work orders

A manufacturing order that follows a [manufacturing plan](/docs/concepts/manufacturing-plans/) gets a work order for each step, like cutting, engraving or quality check.

### List work orders

`GET /work_orders`

Newest first.

| Param | What it does |
| --- | --- |
| `query` | Search the work order number or its manufacturing order's number |
| `manufacturingOrderId` | Only the work orders of this manufacturing order |
| `filters[status]` | `draft`, `waiting`, `in_progress`, `completed`, `cancelled` or `skipped`. Repeat as `filters[status][]=` for several |
| `filters[workStationId]` | Only work orders at this work station |
| `filters[workOrderTemplateId]` | Only work orders made from this step of a plan |
| `page`, `limit` | See [pagination](/docs/developers/api/#pagination) |

```json
{
  "data": [
    {
      "id": 9120,
      "number": "WO-7HZ3QK2M",
      "name": "Engraving",
      "status": "waiting",
      "workOrderTemplateId": 44,
      "startedAt": null,
      "completedAt": null,
      "createdAt": "2026-11-12T14:21:02.000+01:00",
      "updatedAt": "2026-11-21T10:15:30.000+01:00",
      "manufacturingOrder": { "id": 5521, "number": "MO-4K2X9QZ1A", "status": "in_progress" },
      "workStation": { "id": 3, "name": "Laser bench" }
    }
  ],
  "pagination": { "page": 1, "pages": 1, "count": 1, "limit": 20, "nextPage": null }
}
```

`workStation` is `null` when the step isn't assigned to a station.

### Get a work order

`GET /work_orders/:id`

Returns one work order, in the same shape as the list.

## Webhook subscriptions

A webhook subscription is a URL of yours that Orderkraft sends [webhooks](/docs/developers/webhooks/) to, for the topics you picked.

### List webhook subscriptions

`GET /webhook_subscriptions`

| Param | What it does |
| --- | --- |
| `includeArchived` | `true` to include subscriptions you stopped |
| `page`, `limit` | See [pagination](/docs/developers/api/#pagination) |

```json
{
  "data": [
    {
      "id": 7,
      "url": "https://erp.example.com/orderkraft/webhooks",
      "topics": ["manufacturing_order.held", "manufacturing_order.completed"],
      "archivedAt": null,
      "createdAt": "2026-11-26T09:12:40.000+01:00",
      "updatedAt": "2026-11-26T09:12:40.000+01:00"
    }
  ],
  "pagination": { "page": 1, "pages": 1, "count": 1, "limit": 20, "nextPage": null }
}
```

### Get a webhook subscription

`GET /webhook_subscriptions/:id`

Returns one subscription, in the same shape as the list.

### Create a webhook subscription

`POST /webhook_subscriptions`

| Field | What it does |
| --- | --- |
| `url` | Required. An `https` URL on the public internet, not on Orderkraft itself |
| `topics` | Required. The [topics](/docs/developers/webhooks/#topics) to send |

Answers with `201 Created` and the subscription, plus its `secret`. This is the only response that includes the secret, so store it right away. You use it to [verify webhooks](/docs/developers/webhooks/#verify-a-webhook).

### Update a webhook subscription

`PATCH /webhook_subscriptions/:id`

Takes `url` and `topics`. A subscription you stopped can't be changed.

### Rotate a signing secret

`POST /webhook_subscriptions/:id/secret`

Gives the subscription a new signing secret and answers with `201 Created` and the subscription, plus its new `secret`. This is the only response that includes it. The old secret stops working right away. See [rotate the signing secret](/docs/developers/webhooks/#rotate-the-signing-secret).

### Delete a webhook subscription

`DELETE /webhook_subscriptions/:id`

Stops the subscription and answers with it, with `archivedAt` set. Webhooks still waiting to be retried for it are dropped.

## Units of measure

Materials and bill of materials inputs use these units:

| Measures | Units |
| --- | --- |
| Count | `pc`, `pieces`, `pr`, `dz`, `set`, `rl`, `rolls`, `sh`, `sheets` |
| Weight | `mg`, `g`, `kg`, `oz`, `lb` |
| Volume | `ml`, `cl`, `l`, `fl_oz`, `cup`, `pt`, `qt`, `gal`, `imp_fl_oz`, `imp_pt`, `imp_gal` |
| Length | `mm`, `cm`, `m`, `in`, `ft`, `yd` |
| Area | `sq_mm`, `sq_cm`, `sq_m`, `sq_in`, `sq_ft`, `sq_yd` |
