---
search:
  tags:
    - Foods
    - POST
seo:
  description: >-
    Adds a food to the account's own foods (Foods > My foods in the dashboard),
    usable in meal plans,… Reference for the POST /foods endpoint in the
    Almendra API.
sidebar:
  label: Create a custom food
  badge: POST
title: Create a custom food
type: openapi-operation
---
Adds a food to the account's own foods (Foods > My foods in the dashboard), usable in meal plans, recipes and exchange groups. Values are per 100 g.

Requires the `library:write` permission.

`POST /foods`

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

- `name` (string, required)
- `category` (string)
- `caloriesKcal` (number, required)
- `proteinG` (number, required)
- `carbsG` (number, required)
- `fatG` (number, required)
- `nutrients` (object) — Other nutrients, per 100 g, with the names \`GET /foods/{food\_id}\` returns (\`fiber\_g\`, \`sodium\_mg\`, \`vitaminC\_mg\`, …). Unknown names answer 400.
- `measures` (FoodMeasureInput[]) — Household measures (e.g. 1 slice = 30 g). Grams are always available.

Request body example:

```json
{
  "name": "Pan integral de la panadería",
  "category": "string",
  "caloriesKcal": 247,
  "proteinG": 13,
  "carbsG": 41,
  "fatG": 3.4,
  "nutrients": {
    "fiber_g": 7,
    "sodium_mg": 400
  },
  "measures": [
    {
      "amount": 1,
      "description": "taza",
      "grams": 240
    }
  ]
}
```

**Responses**

- `201` — Food created
- `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
- `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, 201:

```json
{
  "_id": "string",
  "name": "Pechuga de pollo, cocida",
  "type": "food",
  "source": "CENAN (2017)",
  "category": "string",
  "createdByThisAccount": true,
  "caloriesKcal": 165,
  "proteinG": 31,
  "carbsG": 0,
  "fatG": 3.6,
  "nutrients": {
    "fiber_g": 0,
    "sodium_mg": 74,
    "iron_mg": 1
  },
  "measures": [
    {
      "amount": 1,
      "description": "taza",
      "grams": 240
    }
  ]
}
```
