Inventory

Stock records. One record is one product in one warehouse, carrying a quantity, a reserved quantity and stock thresholds.

Use cases: Use this to read live stock levels, set reorder thresholds, and reconcile counts against your own system.
GET/inventory

List stock records.

`sortBy` accepts "id", "quantity", "reservedQuantity", "location" or "createdAt"; anything else falls back to "createdAt". Available stock is `quantity - reservedQuantity` — the API does not return it as its own field on this list.

Query Parameters

NameTypeDescription
search
stringFree-text search across the joined product.
warehouseId
numberOnly records in this warehouse.
productId
numberOnly records for this product (numeric id).
location
stringPartial match on the location within the warehouse.
sortBy
stringColumn to sort by.
sortOrder
string"asc" or "desc".
limit
numberItems per page. Default 50, clamped to 1-200.
offset
numberRow offset to start from (default 0).
page
number1-based page number (default 1). Converted to an offset; an explicit `offset` wins over it.
pageSize
numberAlias of `limit`. Wins over `limit` when both are sent.

Request

curl -X GET "https://api.glance.co.il/inventory" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "data": [
    {
      "id": 771,
      "visibleId": "b7e1c3a4-2f5d-4c8b-9a0e-1d2c3b4a5f60",
      "productId": 4102,
      "warehouseId": 1,
      "quantity": 42,
      "reservedQuantity": 4,
      "minStockLevel": 10,
      "maxStockLevel": 200,
      "location": "A-3-2",
      "createdAt": "2026-02-11T07:00:00.000Z",
      "updatedAt": "2026-08-20T13:45:00.000Z",
      "product": {
        "id": 4102,
        "name": "Widget Pro",
        "sku": "WDG-001"
      },
      "warehouse": {
        "id": 1,
        "name": "מחסן ראשי"
      },
      "file": null,
      "vendor": null
    }
  ],
  "pagination": {
    "total": 87,
    "limit": 50,
    "offset": 0,
    "hasMore": true,
    "page": 1,
    "pageSize": 50,
    "totalPages": 2
  }
}
GET/inventory/:id

Get a single stock record.

Returned flat. A record that does not exist answers `200` with a body of `null` rather than a 404 — check for null, not for the status code.

Path Parameters

NameTypeDescription
id
stringrequiredThe record's `visibleId` (a UUID).

Request

curl -X GET "https://api.glance.co.il/inventory/:id" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "id": 771,
  "visibleId": "b7e1c3a4-2f5d-4c8b-9a0e-1d2c3b4a5f60",
  "productId": 4102,
  "warehouseId": 1,
  "quantity": 42,
  "reservedQuantity": 4,
  "minStockLevel": 10,
  "maxStockLevel": 200,
  "location": "A-3-2",
  "product": {
    "id": 4102,
    "name": "Widget Pro",
    "sku": "WDG-001"
  },
  "warehouse": {
    "id": 1,
    "name": "מחסן ראשי"
  }
}
GET/inventory/product/:productId

Get one product's stock across every warehouse, with totals.

This is the one endpoint that gives you `availableQuantity` directly.

Path Parameters

NameTypeDescription
productId
numberrequiredThe product's numeric `id`.

Request

curl -X GET "https://api.glance.co.il/inventory/product/:productId" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "productId": 4102,
  "warehouses": [
    {
      "id": 771,
      "warehouseId": 1,
      "quantity": 42,
      "reservedQuantity": 4,
      "location": "A-3-2",
      "warehouse": {
        "id": 1,
        "name": "מחסן ראשי"
      }
    }
  ],
  "totals": {
    "quantity": 42,
    "reservedQuantity": 4,
    "availableQuantity": 38
  }
}
POST/inventory/create

Open a stock record for a product in a warehouse. Usually unnecessary — creating a product with `isWithInventory` opens one for you.

One record per product per warehouse — a second attempt answers 400 INVENTORY_ALREADY_EXISTS.

Body Parameters

NameTypeDescription
productId
numberrequiredThe product's numeric `id`.
warehouseId
numberrequiredThe warehouse's numeric `id`.
quantity
numberOpening quantity. Defaults to 0.
reservedQuantity
numberOpening reserved quantity. Defaults to 0.
minStockLevel
numberReorder threshold. Defaults to 0.
maxStockLevel
numberUpper stock threshold.
location
stringFree-text location within the warehouse.

Request

curl -X POST "https://api.glance.co.il/inventory/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "productId": 0,
  "warehouseId": 0,
  "quantity": 0,
  "reservedQuantity": 0,
  "minStockLevel": 0,
  "maxStockLevel": 0,
  "location": "example_location"
}'

Response

Response
{
  "success": true,
  "inventoryId": 771
}
PUT/inventory/:id/edit

Update a stock record's quantities, thresholds or location. All fields are optional.

Path Parameters

NameTypeDescription
id
numberrequiredThe record's numeric `id` — this endpoint takes the numeric id, while `GET /inventory/:id` takes the `visibleId`.

Body Parameters

NameTypeDescription
quantity
numberSets the quantity outright. This is a correction, not a movement — it writes no row to the movement log. Use `POST /inventory/adjust` when you want the change recorded.
reservedQuantity
numberSets the reserved quantity outright.
minStockLevel
numberReorder threshold.
maxStockLevel
numberUpper stock threshold.
location
stringLocation within the warehouse.

Request

curl -X PUT "https://api.glance.co.il/inventory/:id/edit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "quantity": 0,
  "reservedQuantity": 0,
  "minStockLevel": 0,
  "maxStockLevel": 0,
  "location": "example_location"
}'

Response

Response
{
  "success": true
}
DELETE/inventory/:id/delete

Delete a stock record.

Path Parameters

NameTypeDescription
id
numberrequiredThe record's numeric `id`.

Request

curl -X DELETE "https://api.glance.co.il/inventory/:id/delete" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

Response
{
  "success": true
}
POST/inventory/adjust

Apply one or more relative stock adjustments, each recorded as a movement.

`errors` is present only when at least one action failed. This is the endpoint to use for stock changes you want in the audit trail — each action writes an ADJUST movement.

Body Parameters

NameTypeDescription
actions
object[]requiredAt least one adjustment. Each is applied on its own; the ones that fail come back in `errors` while the rest are applied.
productId
numberrequiredThe product's numeric `id`.
warehouseId
numberrequiredThe warehouse's numeric `id`.
amount
numberrequiredRelative change — positive adds, negative subtracts. Not a target quantity.
reason
stringWhy, e.g. "ספירת מלאי" or "שבר".
notes
stringFree-text note stored on the movement.

Request

curl -X POST "https://api.glance.co.il/inventory/adjust" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "actions": "example_actions"
}'

Response

Response
{
  "success": true,
  "results": [
    {
      "productId": 4102,
      "warehouseId": 1,
      "previousQuantity": 42,
      "adjustment": -2,
      "newQuantity": 40,
      "success": true
    }
  ]
}

Last updated