---
title: "Create a brain"
description: "Create a brain — a named collection that groups knowledge packs so they\ncan be attached to a conversation together."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › Brains

`POST /brains`

Create a brain — a named collection that groups knowledge packs so they
can be attached to a conversation together.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Header parameters

- `X-On-Behalf-Of` (`create_brain.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`create_brain.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`create_brain.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

_Required._

- `name` (`create_brain.name`; string, required)
- `description` (`create_brain.description`; any of, optional)
  - any of: `string`, `null`
- `app_id` (`create_brain.app_id`; any of, optional)
  - any of: `string`, `null`
- `emoji` (`create_brain.emoji`; any of, optional)
  - any of: `string`, `null`
- `usage_hint` (`create_brain.usage_hint`; any of, optional)
  - any of: `string`, `null`
- `visibility` (`create_brain.visibility`; string, optional)
  - one of `"private"`, `"app"`, `"public"`; default `"private"`
- `skill_ids` (`create_brain.skill_ids`; array<string>, optional)
  - format `uuid`

## Example request

```json
{
  "name": "string",
  "description": "string",
  "app_id": "string",
  "emoji": "string",
  "usage_hint": "string",
  "visibility": "private",
  "skill_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ]
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://truememory-api.mvstg.com/brains \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "string",
  "description": "string",
  "app_id": "string",
  "emoji": "string",
  "usage_hint": "string",
  "visibility": "private",
  "skill_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ]
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/brains';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    name: 'string',
    description: 'string',
    app_id: 'string',
    emoji: 'string',
    usage_hint: 'string',
    visibility: 'private',
    skill_ids: ['497f6eca-6276-4993-bfeb-53cbbbba6f08']
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/brains"

payload = {
    "name": "string",
    "description": "string",
    "app_id": "string",
    "emoji": "string",
    "usage_hint": "string",
    "visibility": "private",
    "skill_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Successful Response

#### Example

```json
{
  "id": "string",
  "user_id": "string",
  "app_id": "string",
  "name": "string",
  "description": "string",
  "emoji": "string",
  "usage_hint": "string",
  "visibility": "private",
  "skills": [
    {
      "id": "string",
      "key": "string",
      "name": "string"
    }
  ],
  "document_count": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "skill_ids": [
    "string"
  ]
}
```

- `id` (`create_brain.response.201.id`; string, required)
- `user_id` (`create_brain.response.201.user_id`; any of, required)
  - any of: `string`, `null`
- `app_id` (`create_brain.response.201.app_id`; any of, required)
  - any of: `string`, `null`
- `name` (`create_brain.response.201.name`; string, required)
- `description` (`create_brain.response.201.description`; any of, required)
  - any of: `string`, `null`
- `created_at` (`create_brain.response.201.created_at`; string, required)
  - format `date-time`
- `updated_at` (`create_brain.response.201.updated_at`; string, required)
  - format `date-time`
- `skill_ids` (`create_brain.response.201.skill_ids`; array<string>, required) — Ids of ``skills``, for clients that only need to seed a multi-select. Derived rather than stored so it cannot disagree with ``skills``.
- `emoji` (`create_brain.response.201.emoji`; any of, optional)
  - any of: `string`, `null`
- `usage_hint` (`create_brain.response.201.usage_hint`; any of, optional)
  - any of: `string`, `null`
- `visibility` (`create_brain.response.201.visibility`; string, optional)
  - one of `"private"`, `"app"`, `"public"`; default `"private"`
- `skills` (`create_brain.response.201.skills`; array<object>, optional)
  - `id` (`create_brain.response.201.skills.id`; string, required)
  - `key` (`create_brain.response.201.skills.key`; string, required)
  - `name` (`create_brain.response.201.skills.name`; string, required)
- `document_count` (`create_brain.response.201.document_count`; integer, optional)
  - default `0`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`create_brain.response.422.detail`; array<object>, optional)
  - `loc` (`create_brain.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`create_brain.response.422.detail.msg`; string, required)
  - `type` (`create_brain.response.422.detail.type`; string, required)
  - `input` (`create_brain.response.422.detail.input`; unknown, optional)
  - `ctx` (`create_brain.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/brains/create/index.md
