Skip to main content

Create Inventory Item

Add a new item to your inventory.

Endpoint

POST /inventory/items

Request Body

name
string
required
Item name (1-255 characters)
unit
string
required
Unit of measurement (1-50 characters). Examples: “kg”, “L”, “unidades”, “cajas”
currentStock
number
default:"0"
Initial stock level (minimum: 0)
minStock
number
default:"0"
Minimum stock threshold for alerts (minimum: 0)
costPerUnit
number
default:"0"
Cost per unit in cents (minimum: 0)
categoryId
string
UUID of inventory category (optional)

Example Request

curl -X POST https://api.restai.app/v1/inventory/items \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tomate",
    "unit": "kg",
    "currentStock": 50,
    "minStock": 10,
    "costPerUnit": 350
  }'

List Inventory Items

Get all inventory items for the current branch.

Endpoint

GET /inventory/items

Response

success
boolean
Request success status
data
array
Array of inventory items
id
string
Item UUID
branch_id
string
Branch UUID
organization_id
string
Organization UUID
category_id
string
Category UUID (nullable)
name
string
Item name
unit
string
Unit of measurement
current_stock
string
Current stock level (decimal string)
min_stock
string
Minimum stock threshold (decimal string)
cost_per_unit
number
Cost per unit in cents
created_at
string
Creation timestamp

Example Request

curl https://api.restai.app/v1/inventory/items \
  -H "Authorization: Bearer YOUR_TOKEN"

Update Inventory Item

Update item details (not stock levels - use movements for that).

Endpoint

PATCH /inventory/items/:id

Path Parameters

id
string
required
Item UUID

Request Body

All fields are optional:
name
string
Item name (1-255 characters)
unit
string
Unit of measurement (1-50 characters)
minStock
number
Minimum stock threshold
costPerUnit
number
Cost per unit in cents
categoryId
string
Category UUID (nullable)

Example Request

curl -X PATCH https://api.restai.app/v1/inventory/items/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "minStock": 15,
    "costPerUnit": 400
  }'

Record Stock Movement

Create a movement to adjust stock levels.

Endpoint

POST /inventory/movements

Request Body

itemId
string
required
UUID of the inventory item
type
string
required
Movement type: purchase, consumption, waste, or adjustment
quantity
number
required
Quantity to add (positive) or subtract (negative)
reference
string
Reference number or description (max 255 characters)
notes
string
Additional notes (max 500 characters)

Response

Returns the created movement record.

Example Request

curl -X POST https://api.restai.app/v1/inventory/movements \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "itemId": "550e8400-e29b-41d4-a716-446655440000",
    "type": "purchase",
    "quantity": 25,
    "reference": "INV-2024-001",
    "notes": "Compra mensual"
  }'

Get Movement History

Retrieve stock movement history.

Endpoint

GET /inventory/movements

Query Parameters

itemId
string
Filter movements for a specific item UUID

Response

Returns up to 50 most recent movements.
success
boolean
Request success status
data
array
Array of movements
id
string
Movement UUID
item_id
string
Item UUID
item_name
string
Item name
type
string
Movement type
quantity
string
Quantity changed (decimal string)
reference
string
Reference
notes
string
Notes
created_at
string
Movement timestamp

Example Request

curl https://api.restai.app/v1/inventory/movements?itemId=550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Low Stock Alerts

Retrieve items where current stock is below minimum threshold.

Endpoint

GET /inventory/alerts

Response

success
boolean
Request success status
data
array
Array of items with low stock
id
string
Item UUID
name
string
Item name
unit
string
Unit of measurement
current_stock
string
Current stock level
min_stock
string
Minimum stock threshold
cost_per_unit
number
Cost per unit

Example Request

curl https://api.restai.app/v1/inventory/alerts \
  -H "Authorization: Bearer YOUR_TOKEN"

Manage Categories

List Categories

GET /inventory/categories
Returns all inventory categories for the branch.

Create Category

POST /inventory/categories
Request Body:
name
string
required
Category name (1-255 characters)

Example Request

curl -X POST https://api.restai.app/v1/inventory/categories \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Vegetales"}'

Build docs developers (and LLMs) love