# REST API

A plain RESTful HTTP API to read your Assemblified materials, bills of materials, and inventory — and update your virtual materials.

import { Aside, LinkCard, CardGrid } from '@astrojs/starlight/components';
import Term from '~/components/Term.astro';
import DocUpdated from '~/components/DocUpdated.astro';

The **REST API** lets you work with your Assemblified data over plain HTTP: `GET` or `PATCH` a URL, get JSON back, without speaking MCP or writing code-mode programs. It's the same data and the same `asmk_` keys as [AI / Agent access](/features/agent-access/overview/), exposed as ordinary REST resources.

v1 serves:

- <Term def="raw-material">materials</Term> — read every material, update your <Term def="virtual-material">virtual</Term> ones;
- **inventory** per location — stock levels, <Term def="pre-assembled">pre-assembled</Term> units, fractional remainders, what is committed to orders and reservations, what is allocated in shelf stock, and what open work orders have tied up;
- <Term def="bom">bills of materials</Term> — the fully hydrated BOM, the computed buildable, and the per-location rules configured on a bill;
- **per-order BOM breakdowns** — what a warehouse has to pack;
- <Term def="work-order">work orders</Term> — the list, one whole work order, its material plan and its build runs, plus **three writes**: edit the header, move it to another state, and start a build run;
- the supporting lists — your locations, your assignees, and the index of a bill's saved versions.

<Aside type="note" title="Material writes are virtual-only">
You can **read** every material — Shopify-linked and <Term def="virtual-material">virtual</Term> alike, including live per-location inventory. You can **write** (edit fields, set per-location stock) only **virtual materials** (`VMAT-*` ids). A `PATCH` against a Shopify-managed material returns `400 INVALID_INPUT` — those fields are owned by Shopify and would be overwritten by the next product sync. This rule applies to the `/raw-materials` endpoints; the work-order writes are governed by their own rules below. See [Errors](/features/rest-api/errors/).
</Aside>

<Aside type="caution" title="One write moves real stock">
`PATCH /work-orders/{id}/build-runs` **starts a build run**: it commits a pick against the work order's plan and pushes the consumption to Shopify. Preview it first with `GET /work-orders/{id}/material-plan`, send your own run id so a retry cannot start a second run, and note that it additionally requires the Enhanced plan. The other two work-order writes — editing the header and moving it to another state — move no stock.
</Aside>

<Aside type="caution">
**The REST API requires the Enhanced plan.** API keys can be created and used for AI / Agent access on other plans, but the REST surface is Enhanced-only — see [Authentication](/features/rest-api/authentication/).
</Aside>

## Base URL

```
https://assemblified.com/api/v1
```

## A first request

Authenticate with an `asmk_` API key (see [Authentication](/features/rest-api/authentication/)):

```bash
curl -s -H "Authorization: Bearer $ASMK_TOKEN" \
  "https://assemblified.com/api/v1/raw-materials?pageSize=5"
```

Every successful response is wrapped in a small envelope:

```json
{
  "data": { "items": [ /* … */ ], "totalCount": 42, "page": 1, "pageSize": 5, "totalPages": 9, "availableVendors": [ /* … */ ] },
  "meta": { "requestId": "…", "apiVersion": "1.2" }
}
```

## What you can do

<CardGrid>
  <LinkCard title="Read materials" href="/features/rest-api/reference/" description="List with filters + pagination, get one (with its BOM / assembly BOM connections), both Shopify-linked and virtual." />
  <LinkCard title="Read inventory levels" href="/features/rest-api/reference/" description="Real per-location stock for any material — live from Shopify for Shopify-linked, app-local for virtual." />
  <LinkCard title="Update virtual materials" href="/features/rest-api/reference/" description="PATCH fields (name, sku, cost, unit, …) and set per-location stock — for VMAT-* materials only." />
  <LinkCard title="Read bills of materials" href="/features/rest-api/reference/#bills-of-materials-read-only" description="List BOMs, get one with its fully hydrated BOM (recursive assembly BOMs + cost rates), and compute the per-location buildable." />
  <LinkCard title="Read order BOM breakdowns" href="/features/rest-api/reference/#order-bom-breakdown-read-only" description="What a warehouse must pack per order — the metafield-parity breakdown for 1–50 orders per call, computed live." />
  <LinkCard title="Read pre-assembled stock" href="/features/rest-api/reference/#pre-assembled-stock-vs-residual-remainders" description="Units already built and on the shelf, per location — for a finished good or an assembly BOM." />
  <LinkCard title="Resolve your locations" href="/features/rest-api/reference/#location-ids" description="The id → name list every per-location filter keys on, plus the fractional-remainder read for materials." />
  <LinkCard title="Read work orders" href="/features/rest-api/reference/#work-orders" description="The list with its facets, one whole work order, its material plan and its build-run history." />
  <LinkCard title="Update a work order" href="/features/rest-api/reference/#work-orders" description="Edit the header, move it to another state, or start a build run — each with an optimistic-lock token." />
  <LinkCard title="Read what stock is spoken for" href="/features/rest-api/reference/#per-location-commitment-and-allocation-reads" description="Per location: committed to orders and reservations, embedded in shelf stock, and tied up in open work orders." />
  <LinkCard title="Read a bill's version index" href="/features/rest-api/reference/#bill-versions" description="Every saved version of one bill with its change summary — and your assignee list." />
</CardGrid>

## How it relates to AI / Agent access

The REST API and the [Agent access](/features/agent-access/overview/) surface share the **same `asmk_` API keys, the same read/write scopes, and the same per-store rate limit**, and are backed by the same operations — a change made over REST is exactly the change the app UI or an AI assistant would make. If you already use Agent access, your keys work here unchanged (REST additionally requires the Enhanced plan).

## Where to next

<LinkCard title="Interactive API explorer →" href="/features/rest-api/explorer" description="Browse and try every endpoint — live schemas, parameters, and copy-paste code samples." />
<LinkCard title="Authentication →" href="/features/rest-api/authentication/" />
<LinkCard title="Conventions (envelope, pagination, PATCH semantics) →" href="/features/rest-api/conventions/" />
<LinkCard title="Errors →" href="/features/rest-api/errors/" />
<LinkCard title="Rate limits →" href="/features/rest-api/rate-limits/" />
<LinkCard title="Endpoint reference (quick tables) →" href="/features/rest-api/reference/" />

<DocUpdated date="2026-10-19" />