API reference
Receive stock updates
An inbound webhook lets another system set or move stock without an API key: it signs each request with the webhook's secret instead.
To create one, click Add Webhook in Settings → Integrations → Webhooks and choose Receive stock updates from another app (Owners and Admins only; see Webhooks). The settings page shows its address and, once, its secret.
Send an update
POST /webhooks/inbound/{webhookId} — no API key; signed
The full address, as shown on the settings page, is:
POST https://app.simpleinventory.io/api/v1/webhooks/inbound/{webhookId}
Headers
| Header | Required | Description |
|---|---|---|
Content-Type |
Yes | application/json |
X-SI-Timestamp |
Yes | The current time in Unix seconds. Refused if more than 5 minutes off. |
X-SI-Signature |
Yes | v1= and the hex HMAC-SHA256 of <timestamp>.<raw body>, keyed with the whole secret: the same scheme as outbound signatures. |
Idempotency-Key |
No | Identifies the update across retries you sign again. |
JSON body
| Field | Type | Required | Description |
|---|---|---|---|
event |
string | Yes | What happened; see the table below. |
data.sku |
string | Yes | The item's SKU, matched as in Identifying an item. An archived item is matched but not changed; see below. |
data.quantity |
integer, 0–1,000,000,000 | Yes | The amount. Must be a JSON number. A larger value changes nothing and answers processed: false with reason: "Quantity is too large". |
event |
Effect |
|---|---|
inventory.updated |
Sets the item's stock to quantity. |
order.completed |
Removes quantity; stock stops at 0. |
order.refunded |
Adds quantity back. Stock can't go above 2,147,483,647: a refund that would take it past that changes nothing (see Responses). |
An update whose SKU belongs to an archived item changes nothing. The response is 200 with processed: false and reason: "Item is archived", and the update shows in the webhook's log as Accepted, with the Result {"reason":"Item is archived"}. Restore the item in the app for later updates to apply.
An applied update shows in the item's history with the note Inbound webhook: <event>, made through the API, under the person who set up the inbound webhook (or the person who created the item, if the webhook's creator has left the organization), and fires the same events as any other stock change.
Example
Set SIMPLE_INVENTORY_INBOUND_SECRET to the webhook's secret (it starts with whsec_) and replace 42 with your webhook's ID from its address.
BODY='{"event": "order.completed", "data": {"sku": "MUG-BLU", "quantity": 2}}'
TS=$(date +%s)
SIG=$(printf '%s.%s' "$TS" "$BODY" \
| openssl dgst -sha256 -hmac "$SIMPLE_INVENTORY_INBOUND_SECRET" -hex | sed 's/^.* //')
curl -X POST https://app.simpleinventory.io/api/v1/webhooks/inbound/42 \
-H "Content-Type: application/json" \
-H "X-SI-Timestamp: $TS" \
-H "X-SI-Signature: v1=$SIG" \
-d "$BODY"
The signature must cover the exact bytes you send. Sign the body string itself, not a re-serialized copy of it.
{
"received": true,
"processed": true,
"result": { "itemId": 123, "newQuantity": 12 }
}
Responses
| Response | When |
|---|---|
200, processed: true |
Applied. result has the item's ID and its stock afterwards; for a repeat (see Retries), the stock the original update left. |
200, processed: false |
Nothing applied: no item has that SKU, the event isn't one of the three, or data is missing or invalid; result is then null. With reason: "Item is archived", the SKU belongs to an archived item. With reason: "Quantity is too large", quantity is over 1,000,000,000. With reason: "This change would take the stock above 2,147,483,647.", a refund would take the item's stock past that. With reason: "Event type not configured", the webhook isn't set to accept that event. With reason: "subscription_inactive", the organization's integrations are paused and the update won't be applied later either. Responses with a reason have no result. |
400 validation_error |
The body isn't valid JSON. |
401 unauthorized |
The signature or timestamp is missing, the timestamp is more than 5 minutes off, or the signature is wrong. |
404 not_found |
No inbound webhook with that ID is switched on. A paused inbound webhook answers this until you resume it. |
409 ambiguous_identifier |
The SKU matches more than one item once letter case is ignored. |
409 variant_parent_not_stockable |
The SKU belongs to a variant group. |
413 payload_too_large |
The body is over 1 MB. |
429 rate_limited |
Over 120 requests a minute from your IP address, counted per server like the API's limit. The response has a Retry-After header. |
500 processing_error |
The update couldn't be applied. Retry it. |
When the organization is paused, the response is:
{
"received": true,
"processed": false,
"reason": "subscription_inactive"
}
Retries
Sending exactly the same signed request twice (same timestamp and body) applies it once. If you sign a retry again with a new timestamp, send the same Idempotency-Key to get the same protection. Keys are matched per item, as described in Idempotency keys.
