Saltar al contenido
tablezio

Inventario

Inventario y movimientos de stock

Los artículos de inventario tienen el nivel de stock actual; stock_movements es un libro mayor solo-append de cambios. Cada movimiento actualiza el artículo enlazado atómicamente — no hay una segunda fuente de verdad.

List inventory items

GET /v1/inventory_items Permiso: inventory:read

Returns inventory items for the restaurant.

Parámetros de consulta

limitintegerOpcional

Page size.

starting_afterstringOpcional

Cursor.

categorystringOpcional

Filter by free-form category.

low_stockbooleanOpcional

true returns only items at or below min_stock.

is_activebooleanOpcional

false includes soft-deleted items.

Solicitud

curl 'https://api.tablezio.com/v1/inventory_items?low_stock=true' -H 'X-API-Key: tbz_…'

Respuesta

application/json
{ "object": "list", "data": [ /* inventory_item */ ], "has_more": false, "next_cursor": null, "previous_cursor": null, "url": "/v1/inventory_items" }

Retrieve an inventory item

GET /v1/inventory_items/{id} Permiso: inventory:read

Fetch a single inventory item.

Parámetros de ruta

idstringObligatorio

Item ID (inv_…).

Solicitud

curl https://api.tablezio.com/v1/inventory_items/inv_… -H 'X-API-Key: tbz_…'

Respuesta

application/json
{
  "id": "inv_8b2c3d4e5f6a7b8c9d0e1f20",
  "object": "inventory_item",
  "created": 1716730000,
  "updated": 1716730000,
  "name": "Beef patties (8oz)",
  "category": "meat",
  "sku": "BEEF-8OZ",
  "unit": "kg",
  "current_stock": 12.5,
  "min_stock": 5,
  "max_stock": 30,
  "cost_per_unit": 1350,
  "storage_location": "Walk-in cooler A",
  "expires_at": 1717340000,
  "is_active": true,
  "is_low_stock": false,
  "supplier": null
}

Create an inventory item

POST /v1/inventory_items Permiso: inventory:write

Adds a new tracked item to the storeroom.

Parámetros del cuerpo

namestringObligatorio

Display name.

unitstringObligatorio

Unit of measurement (kg, l, pcs…).

categorystringOpcional

Free-form category.

skustringOpcional

Optional SKU.

current_stocknumberOpcional

Current on-hand quantity.

min_stocknumberOpcional

Triggers low_stock once reached.

max_stocknumberOpcional

Cap for auto-reorder logic.

cost_per_unitinteger (cents)Opcional

Latest unit cost.

storage_locationstringOpcional

Free-form location string.

expires_atstring (ISO 8601)Opcional

Expiration date if applicable.

Solicitud

curl -X POST https://api.tablezio.com/v1/inventory_items \
  -H 'X-API-Key: tbz_…' -H 'Content-Type: application/json' \
  -d '{ "name": "Beef patties (8oz)", "unit": "kg", "min_stock": 5, "cost_per_unit": 1350 }'

Respuesta

application/json
{
  "id": "inv_8b2c3d4e5f6a7b8c9d0e1f20",
  "object": "inventory_item",
  "created": 1716730000,
  "updated": 1716730000,
  "name": "Beef patties (8oz)",
  "category": "meat",
  "sku": "BEEF-8OZ",
  "unit": "kg",
  "current_stock": 12.5,
  "min_stock": 5,
  "max_stock": 30,
  "cost_per_unit": 1350,
  "storage_location": "Walk-in cooler A",
  "expires_at": 1717340000,
  "is_active": true,
  "is_low_stock": false,
  "supplier": null
}

List stock movements

GET /v1/stock_movements Permiso: inventory:read

Returns the full audit trail of stock changes (purchases, usage, waste, adjustments, transfers, returns).

Parámetros de consulta

inventory_itemstringOpcional

Filter to a specific item (inv_…).

typestringOpcional

Filter by movement type.

purchaseusagewasteadjustmenttransferreturn

Solicitud

curl 'https://api.tablezio.com/v1/stock_movements?type=waste' -H 'X-API-Key: tbz_…'

Respuesta

application/json
{ "object": "list", "data": [ /* stock_movement */ ], "has_more": false, "next_cursor": null, "previous_cursor": null, "url": "/v1/stock_movements" }

Record a stock movement

POST /v1/stock_movements Permiso: inventory:write

Atomically adjusts the linked inventory item and records the movement. Use a positive quantity for purchases and returns; negative for usage and waste.

Parámetros del cuerpo

inventory_itemstringObligatorio

Linked inventory item id (inv_…).

typestringObligatorio

Movement type.

purchaseusagewasteadjustmenttransferreturn
quantitynumberObligatorio

Signed quantity, in the item's unit.

unit_costinteger (cents)Opcional

Per-unit cost; used to compute total_cost.

reasonstringOpcional

Free-form reason.

referencestringOpcional

External reference id (PO number, invoice ref…).

Solicitud

curl -X POST https://api.tablezio.com/v1/stock_movements \
  -H 'X-API-Key: tbz_…' -H 'Content-Type: application/json' \
  -d '{ "inventory_item": "inv_…", "type": "purchase", "quantity": 10, "unit_cost": 1350 }'

Respuesta

application/json
{
  "id": "sm_8b2c3d4e5f6a7b8c9d0e1f20",
  "object": "stock_movement",
  "created": 1716730000,
  "inventory_item": "inv_…",
  "type": "purchase",
  "quantity": 10,
  "unit_cost": 1350,
  "total_cost": 13500,
  "reason": "Weekly delivery",
  "reference": "PO-0123",
  "performed_at": 1716730000
}

Update an inventory item

PATCH /v1/inventory_items/{id} Permiso: inventory:write

Updates the fields you send. Use it for par levels, unit costs and supplier links; to change the quantity on hand, post a stock movement instead so the change keeps its reason and its audit trail.

Parámetros de ruta

idstringObligatorio

Inventory item id (inv_…).

Parámetros del cuerpo

namestringOpcional

Optional. Same meaning as on create.

categorystringOpcional

Optional. Same meaning as on create.

skustringOpcional

Optional. Same meaning as on create.

unitstringOpcional

Optional. Same meaning as on create.

current_stocknumberOpcional

Optional. Same meaning as on create.

min_stocknumberOpcional

Optional. Same meaning as on create.

max_stocknumberOpcional

Optional. Same meaning as on create.

cost_per_unitinteger (cents)Opcional

Optional. Same meaning as on create.

storage_locationstringOpcional

Optional. Same meaning as on create.

expires_atstring (ISO 8601)Opcional

Optional. Same meaning as on create.

is_activebooleanOpcional

Optional. Same meaning as on create.

Solicitud

curl -X PATCH 'https://api.tablezio.com/v1/inventory_items/inv_5a1b2c3d4e5f6a7b8c9d0e1f' \
  -H 'X-API-Key: tbz_…' \
  -H 'Content-Type: application/json' \
  -d '{"par_level": 24}'

Delete an inventory item

DELETE /v1/inventory_items/{id} Permiso: inventory:write

Removes the item from the active inventory. Its past stock movements remain, so historical cost and waste reporting does not develop a hole.

Parámetros de ruta

idstringObligatorio

Inventory item id (inv_…).

Solicitud

curl -X DELETE 'https://api.tablezio.com/v1/inventory_items/inv_5a1b2c3d4e5f6a7b8c9d0e1f' \
  -H 'X-API-Key: tbz_…'

Retrieve a stock movement

GET /v1/stock_movements/{id} Permiso: inventory:read

Returns a single movement — one recorded change in quantity, with its reason. Movements are the append-only log behind the current stock level; this is how you audit a specific one.

Parámetros de ruta

idstringObligatorio

Stock movement id (stkmv_…).

Solicitud

curl 'https://api.tablezio.com/v1/stock_movements/stkmv_5a1b2c3d4e5f6a7b8c9d0e1f' \
  -H 'X-API-Key: tbz_…'