---
title: "Add a knowledge pack to a brain"
description: "Add a pack you own to a brain. Returns the pack as it now sits in the\nbrain."
---

> 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/{brain_id}/knowledge-packs`

Add a pack you own to a brain. Returns the pack as it now sits in the
brain.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `brain_id` (`add_knowledge_pack_to_brain.path.brain_id`; string, required)
  - format `uuid`

## Header parameters

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

## Request body

_Required._

- `pack_id` (`add_knowledge_pack_to_brain.pack_id`; string, required)
  - format `uuid`

## Example request

```json
{
  "pack_id": "57cc3d41-f96b-4516-a620-a3167d9dc6bf"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://truememory-api.mvstg.com/brains/<brain_id>/knowledge-packs' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "pack_id": "57cc3d41-f96b-4516-a620-a3167d9dc6bf"
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/brains/<brain_id>/knowledge-packs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({pack_id: '57cc3d41-f96b-4516-a620-a3167d9dc6bf'})
};

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/<brain_id>/knowledge-packs"

payload = { "pack_id": "57cc3d41-f96b-4516-a620-a3167d9dc6bf" }
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",
  "skill_id": "string",
  "filename": "string",
  "content_type": "string",
  "status": "pending",
  "visibility": "private",
  "created_at": "2019-08-24T14:15:22Z"
}
```

- `id` (`add_knowledge_pack_to_brain.response.201.id`; string, required)
- `user_id` (`add_knowledge_pack_to_brain.response.201.user_id`; any of, required)
  - any of: `string`, `null`
- `app_id` (`add_knowledge_pack_to_brain.response.201.app_id`; any of, required)
  - any of: `string`, `null`
- `skill_id` (`add_knowledge_pack_to_brain.response.201.skill_id`; any of, required)
  - any of: `string`, `null`
- `filename` (`add_knowledge_pack_to_brain.response.201.filename`; string, required)
- `content_type` (`add_knowledge_pack_to_brain.response.201.content_type`; string, required)
- `status` (`add_knowledge_pack_to_brain.response.201.status`; string, required)
  - one of `"pending"`, `"processing"`, `"ready"`, `"error"`
- `created_at` (`add_knowledge_pack_to_brain.response.201.created_at`; string, required)
  - format `date-time`
- `visibility` (`add_knowledge_pack_to_brain.response.201.visibility`; string, optional)
  - one of `"private"`, `"app"`, `"public"`; default `"private"`

### 422

Validation Error

#### Example

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

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


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