---
search:
  tags:
    - Recipes
    - PUT
seo:
  description: >-
    Edits one of the account's recipes. New ingredients or portions recompute
    the… Reference for the PUT /recipes/{recipe_id} endpoint in the Almendra
    API.
sidebar:
  label: Edit a recipe
  badge: PUT
title: Edit a recipe
type: openapi-operation
---
Edits one of the account's recipes. New ingredients or portions recompute the nutrition. If the recipe is already used in a meal plan, template or exchange group and its nutrition changes, the answer is a copy with a new `_id` that replaces it from now on, and existing plans keep the old values.

Requires the `library:write` permission.

`PUT /recipes/{recipe_id}`

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

- `name` (string)
- `portions` (integer)
- `ingredients` (IngredientInput[])
- `instructions` (string[])
- `tags` (string[])
- `preparationTimeMinutes` (integer)
- `cookingTimeMinutes` (integer)
- `difficulty` (string)
- `isPublic` (boolean)

Request body example:

```json
{
  "name": "Quinua con pollo",
  "portions": 2,
  "ingredients": [
    {
      "food": "507f1f77bcf86cd799439011",
      "quantity": 100,
      "unit": "g"
    }
  ],
  "instructions": [
    "string"
  ],
  "tags": [
    "string"
  ],
  "preparationTimeMinutes": 0,
  "cookingTimeMinutes": 0,
  "difficulty": "easy",
  "isPublic": true
}
```

**Responses**

- `200` — Recipe 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` — Not one of the account's recipes, or an ingredient was not found
- `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": "Quinua con pollo",
  "portions": 0,
  "preparationTimeMinutes": 0,
  "cookingTimeMinutes": 0,
  "caloriesKcal": 0,
  "proteinG": 0,
  "carbsG": 0,
  "fatG": 0,
  "tags": [
    "string"
  ],
  "imageUrl": "string",
  "isPublic": true,
  "isDraft": true,
  "createdByThisAccount": true,
  "difficulty": "string",
  "ingredients": [
    {
      "food": "string",
      "foodName": "string",
      "quantity": 0,
      "unit": "string"
    }
  ],
  "instructions": [
    "string"
  ],
  "nutrients": {
    "fiber_g": 0,
    "sodium_mg": 74,
    "iron_mg": 1
  },
  "measures": [
    {
      "amount": 1,
      "description": "taza",
      "grams": 240
    }
  ]
}
```
