Cookest
Backend APIEndpoints

Meal Plans

Weekly meal plan generation, slot management, and nutrition summaries

Meal Plans

GET /api/meal-plans

List the user's meal plans.

MethodPathAuthTier
GET/api/meal-plansJWT BearerFree

Response 200 OK

[
  {
    "id": "uuid",
    "week_start": "2024-01-15",
    "created_at": "2024-01-14T10:00:00Z",
    "slot_count": 21
  }
]

POST /api/meal-plans/generate

Generate a new AI-scored weekly meal plan. Pro or Family tier required.

MethodPathAuthTier
POST/api/meal-plans/generateJWT BearerPro

Request body

{
  "week_start": "2024-01-15",
  "preferences": {
    "max_prep_time": 30,
    "cuisines": ["italian", "mediterranean"],
    "avoid_repeated": true
  }
}

Response 201 Created

{
  "id": "uuid",
  "week_start": "2024-01-15",
  "slots": [
    {
      "id": "uuid",
      "day": 0,
      "meal_type": "breakfast",
      "recipe_id": "uuid",
      "recipe_title": "Oat Porridge",
      "servings": 2,
      "is_flex": false,
      "flex_type": null,
      "is_completed": false
    }
  ]
}

day values: 0 = Monday … 6 = Sunday
meal_type values: breakfast | lunch | dinner | snack
flex_type values: effort | nutrition | mental | social | null


GET /api/meal-plans/:id

Get a meal plan with all slots.

MethodPathAuthTier
GET/api/meal-plans/:idJWT BearerFree

Returns the same structure as the generate response.


PUT /api/meal-plans/:id/slots/:slotId

Update a meal plan slot (swap recipe, toggle completion, set flex).

MethodPathAuthTier
PUT/api/meal-plans/:id/slots/:slotIdJWT BearerFree

Request body (all fields optional)

{
  "recipe_id": "uuid",
  "servings": 3,
  "is_flex": true,
  "flex_type": "effort",
  "is_completed": true
}

Response 200 OK

Returns the updated slot object.


DELETE /api/meal-plans/:id

Delete a meal plan.

MethodPathAuthTier
DELETE/api/meal-plans/:idJWT BearerFree

Response 204 No Content


GET /api/meal-plans/:id/nutrition

Get a day-by-day nutrition summary for the meal plan.

MethodPathAuthTier
GET/api/meal-plans/:id/nutritionJWT BearerFree

Response 200 OK

{
  "days": [
    {
      "day": 0,
      "day_name": "Monday",
      "total_calories": 1820,
      "total_protein": 92,
      "total_carbs": 210,
      "total_fat": 58,
      "meals": [
        {
          "meal_type": "breakfast",
          "calories": 380,
          "protein": 18
        }
      ]
    }
  ],
  "week_totals": {
    "avg_daily_calories": 1900,
    "avg_daily_protein": 88
  }
}

On this page