---
search:
  tags:
    - Exchange Groups
    - POST
seo:
  description: >-
    Adds an exchange group to the account, usable in exchange meal plans. The
    built-in… Reference for the POST /exchange-groups endpoint in the Almendra
    API.
sidebar:
  label: Create an exchange group
  badge: POST
title: Create an exchange group
type: openapi-operation
---
Adds an exchange group to the account, usable in exchange meal plans. The built-in groups of the exchange systems are edited in the dashboard.

Requires the `library:write` permission.

`POST /exchange-groups`

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

- `name` (string, required)
- `description` (string)
- `color` (string)
- `foods` (IngredientInput[], required) — Foods of the group and the quantity that makes one exchange

Request body example:

```json
{
  "name": "Frutas",
  "description": "string",
  "color": "#f59e0b",
  "foods": [
    {
      "food": "507f1f77bcf86cd799439011",
      "quantity": 100,
      "unit": "g"
    }
  ]
}
```

**Responses**

- `201` — Exchange group 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
- `404` — A food of the group 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, 201:

```json
{
  "_id": "string",
  "name": "Cereales sin grasa",
  "description": "string",
  "color": "string",
  "category": "string",
  "replacesDefaultGroup": "string",
  "hidesDefaultGroup": true,
  "foods": [
    {
      "food": "string",
      "foodName": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}
```
