Skip to content

    API reference

    Stock

    Stock changes made through the API take the same path as changes made in the app: each one is recorded in the item's history, checked against the item's low stock level, and sent on to WooCommerce and OrbisX if you have them connected (see WooCommerce and OrbisX). In the history they show as made through the API (or through Zapier, for requests the Zapier app sends), under the person who created the API key.

    Both endpoints on this page keep working while the organization is past due (see Subscription status).

    Change stock

    PATCH /items/{identifier}/quantity — needs write

    Sets, adds to or removes from one item's stock.

    Query parameters

    Parameter Type Description
    by string How to read {identifier}: auto (default), id or sku. See Identifying an item.

    Headers

    Header Type Description
    Idempotency-Key string, up to 255 characters Optional. Makes a retry safe. See Idempotency keys.

    JSON body

    Field Type Required Description
    quantity integer, 0–1,000,000,000 Yes The amount. Must be a JSON number, not a string. Stock can't go above 2,147,483,647: an increment that would take it past that returns 400 validation_error and changes nothing.
    operation string No set (default): make stock exactly quantity. increment: add quantity. decrement: remove quantity; stock stops at 0 rather than going negative.
    reason string, up to 500 characters No Saved as the note on the history entry. Default API update via <key name>.

    A change that leaves stock where it was (setting the current value, or removing from 0) records nothing and sends no event. The response then has equal previousQuantity and newQuantity.

    Example

    bash
    curl -X PATCH https://app.simpleinventory.io/api/v1/items/MUG-BLU/quantity \
      -H "Authorization: Bearer $SIMPLE_INVENTORY_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: order-1042-mug-blu" \
      -d '{"operation": "decrement", "quantity": 3, "reason": "Order #1042"}'
    
    json
    {
      "data": {
        "id": 123,
        "name": "Blue Mug",
        "sku": "MUG-BLU",
        "quantity": 14,
        "unitCost": 4.5,
        "salePrice": 12,
        "lowStockThreshold": 5,
        "description": "12 oz ceramic mug",
        "barcode": "0123456789012",
        "folderId": 7,
        "folderName": "Kitchen",
        "parentItemId": null,
        "variantValues": null,
        "isVariantGroup": false,
        "archived": false,
        "createdAt": "2026-10-01T14:03:11.000Z",
        "updatedAt": "2026-10-12T09:41:27.000Z",
        "url": "https://app.simpleinventory.io/item/123"
      },
      "previousQuantity": 17,
      "newQuantity": 14
    }
    

    data is the item after the change (for a repeat, the item as it is now; see Idempotency keys), in the shape described in The item object.

    Errors

    Status Code When
    400 validation_error quantity, operation or reason is invalid (the body includes details), an increment would take stock above 2,147,483,647, the body isn't valid JSON, an unknown by value, or by=id with an identifier that isn't a number.
    404 not_found No item in this organization matches.
    409 ambiguous_identifier The identifier matches more than one item.
    409 item_archived The item is archived.
    409 variant_parent_not_stockable The item is a variant group, which holds no stock of its own. Change one of its variations.

    Bulk update

    POST /items/bulk-update — needs write

    Changes stock on up to 100 items in one request. Each change is applied on its own, in order, so one failure doesn't stop the rest.

    Headers

    Header Type Description
    Idempotency-Key string, up to 255 characters Optional. One key covers the request; the change at position i (counting from 0) is recorded under <key>:<i>. See Idempotency keys.

    JSON body

    Field Type Required Description
    items array Yes 1–100 changes. Each one takes the fields below.
    items[].id or items[].sku integer or string One of them Which item. Give one or the other; a SKU here is never read as an ID. If you give both, they must name the same item. SKUs match as in Identifying an item.
    items[].quantity integer, 0–1,000,000,000 Yes The amount. Must be a JSON number.
    items[].operation string No set (default), increment or decrement, as in Change stock.
    items[].reason string, up to 500 characters No Saved as the note on the history entry. Default API bulk update via <key name>.

    Response

    A body that fails validation (no items, more than 100, a bad field) returns 400 validation_error with details and changes nothing.

    Otherwise the response is 200:

    Field Description
    success true only when every change was applied.
    processed How many changes were applied.
    failed How many weren't.
    results One entry per applied change: the item's id and sku, previousQuantity and newQuantity.
    errors One entry per failed change: item (the change as received, with operation filled in), error (the reason) and, for some failures, a code: ambiguous_identifier, item_archived, variant_parent_not_stockable, or validation_error for an increment that would take stock above 2,147,483,647.

    A change that names no item gets the error "Either 'sku' or 'id' is required", and one that matches nothing gets "Item not found"; neither has a code. Archived items are found but not changed (item_archived).

    Example

    bash
    curl -X POST https://app.simpleinventory.io/api/v1/items/bulk-update \
      -H "Authorization: Bearer $SIMPLE_INVENTORY_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"items": [
        {"sku": "MUG-BLU", "operation": "decrement", "quantity": 3},
        {"sku": "MUG-RED", "quantity": 24},
        {"sku": "MUG-GRN", "quantity": 5}
      ]}'
    
    json
    {
      "success": false,
      "processed": 2,
      "failed": 1,
      "results": [
        { "id": 123, "sku": "MUG-BLU", "previousQuantity": 17, "newQuantity": 14 },
        { "id": 124, "sku": "MUG-RED", "previousQuantity": 0, "newQuantity": 24 }
      ],
      "errors": [
        { "item": { "sku": "MUG-GRN", "quantity": 5, "operation": "set" }, "error": "Item not found" }
      ]
    }
    

    Errors

    Status Code When
    400 validation_error The body has no items, more than 100, or a field of the wrong type or out of range. Nothing is changed.

    Per-item failures don't change the status; they're listed in errors.

    Idempotency keys

    A request that timed out may still have been applied. Send an Idempotency-Key header with stock changes so a retry can't apply the change twice. The summary for every endpoint is in Retries and idempotency.

    • What a repeat does. A request whose key was already applied to the same item changes nothing and answers 200. data shows the item as it is now; previousQuantity and newQuantity are what the original change did. A repeat isn't pushed to WooCommerce again, raises no alert, sends no event and sends no live update to open screens.
    • Scope. A key is matched within your organization and the one item, for as long as the item's history entry exists; it doesn't expire. The same key on a different item is a different change.
    • One key per change. Use a new key, such as a UUID or your own order line ID, for every change you mean to make. Reusing a key on the same item, even with a different body, is treated as a repeat.
    • Bulk updates. The change at position i is recorded under <key>:<i>, so resend the same list in the same order.
    • Length. Keys longer than 255 characters are cut to 255.
    • No-op changes. A change that left stock where it was records no history entry, so it stores no key.
    • Shared with inbound webhooks. Inbound webhooks store their keys the same way, so a key used there and here on the same item counts as one change.

    Without a key, a retried increment or decrement moves stock again.