Cookest
Backend APIEndpoints

Inventory

Pantry management — items, quantities, expiry dates, and deductions

Inventory

GET /api/inventory

List the user's pantry items.

MethodPathAuthTier
GET/api/inventoryJWT BearerFree

Query parameters

ParameterTypeDescription
expiring_soonbooleanFilter items expiring within 3 days
locationstringFilter by storage location (fridge, freezer, pantry)

Response 200 OK

{
  "items": [
    {
      "id": "uuid",
      "ingredient_id": 1,
      "name": "Chicken Breast",
      "quantity": 500,
      "unit": "g",
      "location": "fridge",
      "expiry_date": "2024-01-22",
      "is_expiring_soon": true,
      "added_at": "2024-01-18T09:00:00Z"
    }
  ],
  "expiring_count": 2
}

POST /api/inventory

Add an item to the pantry.

MethodPathAuthTier
POST/api/inventoryJWT BearerFree

Request body

{
  "ingredient_id": 1,
  "quantity": 500,
  "unit": "g",
  "location": "fridge",
  "expiry_date": "2024-01-22"
}

location values: fridge | freezer | pantry | other

Response 201 Created

Returns the created inventory item.


PUT /api/inventory/:id

Update an inventory item (quantity, expiry date, location).

MethodPathAuthTier
PUT/api/inventory/:idJWT BearerFree

Request body (all fields optional)

{
  "quantity": 300,
  "unit": "g",
  "location": "freezer",
  "expiry_date": "2024-02-15"
}

Response 200 OK

Returns the updated inventory item.


DELETE /api/inventory/:id

Remove an item from the pantry.

MethodPathAuthTier
DELETE/api/inventory/:idJWT BearerFree

Response 204 No Content


POST /api/inventory/sync

Sync the inventory after cooking — deducts ingredient quantities based on a recipe's ingredient list.

MethodPathAuthTier
POST/api/inventory/syncJWT BearerFree

Request body

{
  "recipe_id": "uuid",
  "servings": 2
}

Response 200 OK

{
  "updated_items": 4,
  "depleted_items": ["Olive Oil", "Garlic"]
}

depleted_items contains the names of ingredients that reached zero quantity and were automatically removed.

On this page