API reference
Inventory
On this page
Stock levels for each size, and the permanent stock history. The only way to change stock through the API is adjusting it with a reason, which is written to the stock history with the key as its author.
The stock row#
| Field | Type | Meaning |
|---|---|---|
variant_id | integer | The size id. |
product_id | integer | The product id. |
product | string | The product name. |
size | string | The size label. |
sku | string or null | The SKU of the size (or of the product when it has one size). |
on_hand | integer | Units counted on the shelf. |
reserved | integer | Units held for orders. |
available | integer | Units the shop can sell from. |
reorder_level | integer or null | The level at which the size counts as low. null means the store's default level applies. |
status | string | in_stock, low or out. |
counted_at | string or null | When the size was last counted (ISO 8601, UTC). |
updated_at | string or null | When the stock level last changed (ISO 8601, UTC). |
The stock history line#
| Field | Type | Meaning |
|---|---|---|
id | integer | The movement id. |
variant_id | integer | The size id. |
product_id | integer or null | The product id. |
sku | string or null | The SKU of the size. |
reason | string | A reason code, for example sale, damaged or adjustment_add. |
reason_label | string | The reason in words. |
change | integer | The change in units: positive when stock was added, negative when it was removed. |
balance_after | integer | Units on hand after the change. |
reference | object or null | Where the change came from: an object with type and id, or null. |
reference.type | string | The kind of source, for example api_key. |
reference.id | integer | The id of the source. |
note | string or null | The note saved with the change. |
by | string | api_key, staff or system. |
created_at | string | When the change was recorded (ISO 8601, UTC). |
The answer to an adjustment#
| Field | Type | Meaning |
|---|---|---|
movement_id | integer | The id of the stock history line that was written. |
variant_id | integer | The size that was changed. |
mode | string | add, remove or set, as you sent it. |
before | integer | Units on hand before the change. |
after | integer | Units on hand after the change. |
change | integer | The change in units (positive or negative). |
inventory | object | The new stock row of the size (the same fields as GET /inventory). |
List stock levels#
GET/api/v1/inventoryread:inventory
One row per size: on_hand, reserved, available (what the shop sells from), reorder_level and a status (in_stock, low, out).
Query parameters
| Name | Type | Meaning |
|---|---|---|
product_id | integer | Only the sizes of this product. |
variant_id | integer | Only this size. |
sku | string | The SKU of a size (or of a product that has one size). |
status | string | in_stock, low or out. One of: in_stock, low, out |
q | string | Words in the product name, SKU or size. |
limit | integer | Rows per page, 1 to 100 (default 25). per_page works too. |
page | integer | Page number, starting at 1. |
updated_since | string | Only rows changed at or after this time (ISO 8601, for example 2026-11-21T10:00:00Z, or a date). |
Example request
curl -s "https://yourstore.example.com/api/v1/inventory?status=low&limit=50" \
-H "Authorization: Bearer YOUR_API_KEY"<?php
$ch = curl_init('https://yourstore.example.com/api/v1/inventory?status=low&limit=50');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
const res = await fetch('https://yourstore.example.com/api/v1/inventory?status=low&limit=50', {
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import requests
res = requests.get(
"https://yourstore.example.com/api/v1/inventory?status=low&limit=50",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (200 OK)
{
"data": [
{
"variant_id": 31,
"product_id": 7,
"product": "Sample Product",
"size": "250 g",
"sku": "SAMPLE-001-250",
"on_hand": 8,
"reserved": 0,
"available": 8,
"reorder_level": 10,
"status": "low",
"counted_at": "2026-11-01T09:00:00Z",
"updated_at": "2026-11-21T10:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1,
"last_page": 1
},
"links": {
"first": "https://yourstore.example.com/api/v1/inventory?page=1",
"last": "https://yourstore.example.com/api/v1/inventory?page=1",
"prev": null,
"next": null
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the read:inventory scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 422 | validation_failed | updated_since could not be read as a date or time. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (403):
{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the \"read:inventory\" scope. Add it to the key in the admin (API & webhooks > API keys), or use a key that has it.",
"required_scope": "read:inventory"
}
}List stock history#
GET/api/v1/inventory/movementsread:inventory
The permanent stock history, newest first: every change with its reason, the balance after it and where it came from.
from and to are dates (YYYY-MM-DD) and include the whole day.
Query parameters
| Name | Type | Meaning |
|---|---|---|
product_id | integer | Only this product. |
variant_id | integer | Only this size. |
sku | string | The SKU of a size. |
reason | string | A reason code, for example sale, damaged, adjustment_add. One of: opening, sale, order_cancelled, payment_failed_restock, return, return_restock, return_writeoff, adjustment_add, adjustment_remove, damaged, expired, found, count_correction, import, manual_edit, transfer_out, transfer_in, admin_reinstate, late_payment_oversold, resync |
from | string | From this date (YYYY-MM-DD). |
to | string | Up to this date (YYYY-MM-DD). |
limit | integer | Rows per page, 1 to 100 (default 25). per_page works too. |
page | integer | Page number, starting at 1. |
Example request
curl -s "https://yourstore.example.com/api/v1/inventory/movements?sku=SAMPLE-001-250&limit=50" \
-H "Authorization: Bearer YOUR_API_KEY"<?php
$ch = curl_init('https://yourstore.example.com/api/v1/inventory/movements?sku=SAMPLE-001-250&limit=50');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
const res = await fetch('https://yourstore.example.com/api/v1/inventory/movements?sku=SAMPLE-001-250&limit=50', {
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import requests
res = requests.get(
"https://yourstore.example.com/api/v1/inventory/movements?sku=SAMPLE-001-250&limit=50",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (200 OK)
{
"data": [
{
"id": 9012,
"variant_id": 31,
"product_id": 7,
"sku": "SAMPLE-001-250",
"reason": "adjustment_add",
"reason_label": "Stock added",
"change": 24,
"balance_after": 32,
"reference": {
"type": "api_key",
"id": 2
},
"note": "Received: Delivery from the supplier",
"by": "api_key",
"created_at": "2026-11-21T10:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1,
"last_page": 1
},
"links": {
"first": "https://yourstore.example.com/api/v1/inventory/movements?page=1",
"last": "https://yourstore.example.com/api/v1/inventory/movements?page=1",
"prev": null,
"next": null
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the read:inventory scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 422 | validation_failed | from or to is not a date like 2026-11-21. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (403):
{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the \"read:inventory\" scope. Add it to the key in the admin (API & webhooks > API keys), or use a key that has it.",
"required_scope": "read:inventory"
}
}Add, remove or set stock#
POST/api/v1/inventory/adjustmentswrite:inventory
The only way to change stock through the API. The same rules as the Adjust box on the Inventory page: a reason from the same list is required, you cannot remove more than is available, and "set" means a counted number (reason correction or other). It is recorded in the stock history with this key as the author. Send expected to refuse the change if the stock is not what you last saw. Returns the movement and the new stock row.
Send variant_id or sku to say which size to change.
The answer is 201 when the stock changed and 200 when the adjustment changed nothing. It contains the stock history line (movement_id) and the new stock row.
Send expected (the available stock you last saw) to make the change safe against another change in between: if the stock is different, nothing is changed and you get 409 stock_changed.
Request body (JSON)
| Field | Type | Required | Limits | Meaning |
|---|---|---|---|---|
variant_id | integer | No | The size to change. Send this or sku. Example: 31 | |
sku | string | No | at most 100 characters | The SKU of the size (or of a product that has exactly one size). Send this or variant_id. Example: SAMPLE-001-250 |
mode | string | Yes | add or remove: change by quantity. set: make the stock exactly quantity (a counted number). One of: add, remove, setExample: add | |
quantity | integer | Yes | 0 to 1000000 | Units to add or remove (1 or more), or the counted number for set. Example: 24 |
reason | string | Yes | received or found (add only), damaged or expired (remove only), correction or other (any; set needs one of these). other needs a note. One of: received, found, damaged, expired, correction, otherExample: received | |
note | string or null | No | at most 500 characters | A note for the stock history (required when the reason is other). Example: Delivery from the supplier, invoice 4471 |
expected | integer or null | No | at least 0 | The available stock you last saw. If it has changed, nothing is changed and you get 409. Example: 96 |
Any field not listed here is refused with 422. Send an Idempotency-Key header so a retry is safe (see Requests).
Example request
curl -s -X POST "https://yourstore.example.com/api/v1/inventory/adjustments" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
-d '{
"sku": "SAMPLE-001-250",
"mode": "add",
"quantity": 24,
"reason": "received",
"note": "Delivery from the supplier, invoice 4471"
}'<?php
$ch = curl_init('https://yourstore.example.com/api/v1/inventory/adjustments');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode([
'sku' => 'SAMPLE-001-250',
'mode' => 'add',
'quantity' => 24,
'reason' => 'received',
'note' => 'Delivery from the supplier, invoice 4471',
]),
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
import { randomUUID } from 'node:crypto';
const res = await fetch('https://yourstore.example.com/api/v1/inventory/adjustments', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
'Idempotency-Key': randomUUID(),
},
body: JSON.stringify({
sku: 'SAMPLE-001-250',
mode: 'add',
quantity: 24,
reason: 'received',
note: 'Delivery from the supplier, invoice 4471',
}),
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import uuid
import requests
res = requests.post(
"https://yourstore.example.com/api/v1/inventory/adjustments",
headers={"Authorization": "Bearer YOUR_API_KEY", "Idempotency-Key": str(uuid.uuid4())},
json={
"sku": "SAMPLE-001-250",
"mode": "add",
"quantity": 24,
"reason": "received",
"note": "Delivery from the supplier, invoice 4471",
},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (201 Created)
{
"data": {
"movement_id": 9012,
"variant_id": 31,
"mode": "add",
"before": 8,
"after": 32,
"change": 24,
"inventory": {
"variant_id": 31,
"product_id": 7,
"product": "Sample Product",
"size": "250 g",
"sku": "SAMPLE-001-250",
"on_hand": 32,
"reserved": 0,
"available": 32,
"reorder_level": 10,
"status": "in_stock",
"counted_at": "2026-11-01T09:00:00Z",
"updated_at": "2026-11-21T10:00:00Z"
}
},
"meta": {}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the write:inventory scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 404 | not_found | The size named by variant_id or sku does not exist. |
| 422 | validation_failed | A field is missing or wrong. error.fields says which and why. |
| 422 | insufficient_stock | You tried to remove more stock than is available. |
| 409 | stock_changed | You sent expected and the stock is no longer that number. Nothing was changed. |
| 409 | idempotency_key_reuse, idempotency_in_progress | The Idempotency-Key was used for a different request, or the first request with it is still running. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (422):
{
"error": {
"code": "validation_failed",
"message": "The request could not be accepted. See \"fields\" for what to fix.",
"fields": {
"mode": [
"The mode field is required."
]
}
}
}