Cookest
Backend APIEndpoints

Recipes

Recipe CRUD, search, favouriting, rating, and cook tracking

Recipes

GET /api/recipes

Search and browse the recipe catalog.

MethodPathAuthTier
GET/api/recipesOptional JWTFree

Query parameters

ParameterTypeDescription
qstringFull-text search query
categorystringFilter by cuisine (e.g. italian, asian)
difficultystringeasy | medium | hard
max_timeintegerMax total time in minutes
dietarystringDietary filter (e.g. vegetarian, vegan, gluten_free)
limitintegerMax results (default: 20)
offsetintegerPagination offset

Response 200 OK

{
  "items": [
    {
      "id": "uuid",
      "title": "Pasta Carbonara",
      "description": "Classic Roman pasta dish",
      "cuisine": "italian",
      "difficulty": "medium",
      "prep_time": 10,
      "cook_time": 20,
      "servings": 4,
      "calories": 520,
      "is_favourite": false,
      "rating_avg": 4.3,
      "rating_count": 12,
      "image_url": "https://..."
    }
  ],
  "total": 150,
  "limit": 20,
  "offset": 0
}

GET /api/recipes/:id

Get full recipe details including ingredients and steps.

MethodPathAuthTier
GET/api/recipes/:idOptional JWTFree

Response 200 OK

{
  "id": "uuid",
  "title": "Pasta Carbonara",
  "description": "Classic Roman pasta dish",
  "cuisine": "italian",
  "difficulty": "medium",
  "prep_time": 10,
  "cook_time": 20,
  "servings": 4,
  "is_favourite": false,
  "rating_avg": 4.3,
  "rating_count": 12,
  "ingredients": [
    {
      "ingredient_id": 1,
      "name": "Spaghetti",
      "quantity": 400,
      "unit": "g"
    }
  ],
  "steps": [
    {
      "step_number": 1,
      "instruction": "Boil salted water and cook spaghetti until al dente."
    }
  ],
  "nutrition": {
    "calories": 520,
    "protein": 22,
    "carbs": 68,
    "fat": 18,
    "fiber": 3
  },
  "images": ["https://..."]
}

POST /api/recipes

Create a new recipe. Pro or Family tier required.

MethodPathAuthTier
POST/api/recipesJWT BearerPro

Request body

{
  "title": "My Special Pasta",
  "description": "A family favourite",
  "cuisine": "italian",
  "difficulty": "easy",
  "prep_time": 15,
  "cook_time": 30,
  "servings": 4,
  "ingredients": [
    { "ingredient_id": 1, "quantity": 400, "unit": "g" }
  ],
  "steps": [
    { "step_number": 1, "instruction": "Cook pasta." }
  ]
}

Response 201 Created

Returns the created recipe object with id.


PUT /api/recipes/:id

Update a recipe. Only the recipe's owner or an admin may update.

MethodPathAuthTier
PUT/api/recipes/:idJWT BearerPro

Same body as POST. Returns the updated recipe.


DELETE /api/recipes/:id

Delete a recipe. Only the owner or admin may delete.

MethodPathAuthTier
DELETE/api/recipes/:idJWT BearerPro

Response 204 No Content


POST /api/recipes/:id/favourite

Bookmark a recipe.

MethodPathAuthTier
POST/api/recipes/:id/favouriteJWT BearerFree

Response 200 OK

{ "is_favourite": true }

DELETE /api/recipes/:id/favourite

Remove a recipe bookmark.

MethodPathAuthTier
DELETE/api/recipes/:id/favouriteJWT BearerFree

Response 200 OK

{ "is_favourite": false }

POST /api/recipes/:id/rate

Rate a recipe (1–5 stars).

MethodPathAuthTier
POST/api/recipes/:id/rateJWT BearerFree

Request body

{
  "rating": 5,
  "notes": "Absolutely delicious!"
}

Response 200 OK

Returns the updated aggregate rating.


POST /api/recipes/:id/cook

Record that the user cooked this recipe. Triggers inventory deduction.

MethodPathAuthTier
POST/api/recipes/:id/cookJWT BearerFree

Request body

{
  "servings": 2
}

Response 200 OK

{
  "cooked_at": "2024-01-20T18:30:00Z",
  "inventory_updated": true,
  "ingredients_deducted": 4
}

On this page