---
search:
  tags:
    - Meal Plans
    - PUT
seo:
  description: >-
    Changes a meal plan made in the dashboard or through the API. days replaces…
    Reference for the PUT /meal-plans/{meal_plan_id} endpoint in the Almendra
    API.
sidebar:
  label: Edit a meal plan
  badge: PUT
title: Edit a meal plan
type: openapi-operation
---
Changes a meal plan made in the dashboard or through the API. `days` replaces every day (same shape as when creating). Send `expectedUpdatedAt` to avoid overwriting someone else's newer edit. PDF plans cannot be edited.

Requires the `meal_plans:write` permission.

`PUT /meal-plans/{meal_plan_id}`

**Request body** (`application/json`)

- `name` (string)
- `startDate` (string<date>) — First day, in the account's time zone. Defaults to the day after the patient's last plan ends, or tomorrow.
- `endDate` (string<date>) — Last day (defaults to 6 days after \`startDate\`). \`daily\` and \`text\` plans last whole weeks. When editing, a new \`startDate\` alone keeps the plan's length.
- `objective` (string)
- `indications` (string[]) — Recommendations shown with the plan (defaults to the patient's previous plan's)
- `days` (MealPlanDayInput[])

Request body example:

```json
{
  "name": "Plan semana 1",
  "startDate": "2026-11-02",
  "endDate": "2026-11-02",
  "objective": "string",
  "indications": [
    "string"
  ],
  "days": [
    {
      "weekday": "monday",
      "name": "string",
      "isFreeDay": true,
      "targets": {
        "caloriesKcal": 1800,
        "proteinG": 110,
        "carbsG": 200,
        "fatG": 60
      },
      "meals": []
    }
  ]
}
```

**Responses**

- `200` — Meal plan edited
- `400` — Invalid path parameter, query parameter or request body
- `401` — Missing or invalid API key
- `403` — The account behind the API key has no active paid plan, or the key lacks the permission this operation needs
- `404` — Meal plan, food or exchange group not found
- `409` — The plan changed after \`expectedUpdatedAt\`, or it is a PDF plan
- `415` — Request body sent without \`Content-Type: application/json\`
- `429` — Rate limit exceeded (600 requests per 60 seconds); retry after \`Retry-After\` seconds
- `500` — Unexpected server error

Response example, 200:

```json
{
  "_id": "string",
  "name": "Plan semana 1",
  "patient": "string",
  "type": "daily",
  "startDate": "2019-08-24T14:15:22Z",
  "endDate": "2019-08-24T14:15:22Z",
  "sent": true,
  "objective": "string",
  "pdfUrl": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "indications": [
    "string"
  ],
  "days": [
    {
      "name": "Lunes",
      "isFreeDay": true,
      "caloriesKcal": 0,
      "proteinG": 0,
      "carbsG": 0,
      "fatG": 0,
      "meals": [
        {
          "name": "Desayuno",
          "time": "08:00",
          "comment": "string",
          "text": "string",
          "caloriesPercentage": 0,
          "proteinTargetG": 0,
          "carbsTargetG": 0,
          "fatTargetG": 0,
          "options": [
            {
              "name": "Opción 1",
              "foods": [
                {
                  "food": "string",
                  "foodName": "Avena en hojuelas",
                  "quantity": 40,
                  "unit": "g"
                }
              ]
            }
          ],
          "exchanges": [
            {
              "group": "string",
              "quantity": 2,
              "excludedFoods": [
                "string"
              ]
            }
          ]
        }
      ]
    }
  ]
}
```
