Skip to main content
POST
/
plan
Create Plan
curl --request POST \
  --url https://api.example.com/plan/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "daily_menus": [
    {
      "day_of_week": 123,
      "plan_id": 123,
      "meal_details": [
        {
          "recipe_id": 123,
          "schedule": 123,
          "status": 123,
          "meal_type": "<string>"
        }
      ]
    }
  ]
}
'
{
  "id": 123,
  "user_id": 123,
  "active": true,
  "created_at": {},
  "updated_at": {},
  "daily_menus": [
    {
      "id": 123,
      "day_of_week": 123,
      "meal_details": [
        {
          "id": 123,
          "recipe_id": 123,
          "schedule": 123,
          "status": 123,
          "meal_type": "<string>",
          "recipe": {
            "id": 123,
            "name": "<string>",
            "calories": 123,
            "protein": 123,
            "carbs": 123,
            "fat": 123,
            "image_url": "<string>",
            "recipe_url": "<string>",
            "recipe_id": 123,
            "ingredients": "<string>",
            "meal_types": [
              {
                "id": 123,
                "name": "<string>"
              }
            ],
            "diet_types": [
              {
                "id": 123,
                "name": "<string>"
              }
            ]
          }
        }
      ]
    }
  ]
}

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.
Authorization: Bearer <token>

Request Body

daily_menus
array
default:"[]"
List of daily menus to include in the plan
day_of_week
integer
required
Day of the week (1-7, where 1 is Monday)
plan_id
integer
required
Plan ID to which this daily menu belongs
meal_details
array
default:"[]"
List of meal details for this day
recipe_id
integer
required
Recipe ID associated with the meal detail
schedule
integer
required
Order of meals (1-6)
status
integer
required
Status of the meal detail (0: pending, 1: completed)
meal_type
string
required
Type of meal. Possible values: breakfast, lunch, dinner, snack

Request Example

{
  "daily_menus": [
    {
      "day_of_week": 1,
      "plan_id": 1,
      "meal_details": [
        {
          "recipe_id": 12345,
          "schedule": 1,
          "status": 0,
          "meal_type": "breakfast"
        },
        {
          "recipe_id": 12346,
          "schedule": 2,
          "status": 0,
          "meal_type": "lunch"
        }
      ]
    },
    {
      "day_of_week": 2,
      "plan_id": 1,
      "meal_details": [
        {
          "recipe_id": 12347,
          "schedule": 1,
          "status": 0,
          "meal_type": "breakfast"
        }
      ]
    }
  ]
}

Response

id
integer
required
Unique identifier for the plan
user_id
integer
required
ID of the user who owns this plan
active
boolean
required
Indicates whether the plan is active
created_at
datetime
required
Timestamp when the plan was created
updated_at
datetime
required
Timestamp when the plan was last updated
daily_menus
array
required
List of daily menus in the plan
id
integer
required
Unique identifier for the daily menu
day_of_week
integer
required
Day of the week (1-7, where 1 is Monday)
meal_details
array
required
List of meal details for this day
id
integer
required
ID of the meal detail
recipe_id
integer
required
Recipe ID associated with the meal detail
schedule
integer
required
Order of meals (1-6)
status
integer
required
Status of the meal detail (0: pending, 1: completed)
meal_type
string
required
Type of meal. Possible values: breakfast, lunch, dinner, snack
recipe
object
required
Associated recipe details
id
integer
required
Unique identifier for the recipe
name
string
required
Name of the recipe
calories
integer
required
Calorie content (minimum: 0)
protein
integer
required
Protein content in grams (minimum: 0)
carbs
integer
required
Carbohydrate content in grams (minimum: 0)
fat
integer
required
Fat content in grams (minimum: 0)
image_url
string
URL to the recipe image
recipe_url
string
URL to the full recipe details
recipe_id
integer
required
External recipe identifier
ingredients
string
required
Comma-separated list of ingredients
meal_types
array
required
List of applicable meal types
id
integer
required
Category ID
name
string
required
Category name
diet_types
array
required
List of applicable diet types
id
integer
required
Category ID
name
string
required
Category name

Response Example

{
  "id": 1,
  "user_id": 42,
  "active": true,
  "created_at": "2026-03-01T10:00:00Z",
  "updated_at": "2026-03-01T10:00:00Z",
  "daily_menus": [
    {
      "id": 1,
      "day_of_week": 1,
      "meal_details": [
        {
          "id": 1,
          "recipe_id": 12345,
          "schedule": 1,
          "status": 0,
          "meal_type": "breakfast",
          "recipe": {
            "id": 1,
            "name": "Spaghetti Carbonara",
            "calories": 400,
            "protein": 20,
            "carbs": 50,
            "fat": 15,
            "image_url": "https://example.com/image.jpg",
            "recipe_url": "https://example.com/recipe",
            "recipe_id": 12345,
            "ingredients": "Spaghetti, eggs, pancetta, parmesan cheese, black pepper",
            "meal_types": [
              {
                "id": 1,
                "name": "lunch"
              }
            ],
            "diet_types": [
              {
                "id": 1,
                "name": "high_protein"
              }
            ]
          }
        },
        {
          "id": 2,
          "recipe_id": 12346,
          "schedule": 2,
          "status": 0,
          "meal_type": "lunch",
          "recipe": {
            "id": 2,
            "name": "Caesar Salad",
            "calories": 250,
            "protein": 15,
            "carbs": 20,
            "fat": 12,
            "image_url": "https://example.com/salad.jpg",
            "recipe_url": "https://example.com/recipe/salad",
            "recipe_id": 12346,
            "ingredients": "Romaine lettuce, croutons, parmesan, caesar dressing",
            "meal_types": [
              {
                "id": 2,
                "name": "lunch"
              }
            ],
            "diet_types": [
              {
                "id": 3,
                "name": "low_calorie"
              }
            ]
          }
        }
      ]
    }
  ]
}

Error Responses

401 Unauthorized
The request lacks valid authentication credentials
{
  "detail": "Not authenticated"
}
422 Unprocessable Entity
Invalid request body or validation error
{
  "detail": [
    {
      "loc": ["body", "daily_menus", 0, "day_of_week"],
      "msg": "ensure this value is greater than or equal to 1",
      "type": "value_error.number.not_ge"
    }
  ]
}
500 Internal Server Error
An unexpected error occurred on the server
{
  "detail": "Internal server error"
}

Build docs developers (and LLMs) love