---
title: "Upload a knowledge pack"
description: "Upload a PDF, Markdown or plain-text file to be indexed for retrieval.\n\nThe response returns immediately with the pack in a pending state —\nextraction and embedding run in the background, so poll the pack until\nits status settles before expecting it in retrieval results."
---

> 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 › Knowledge Packs

`POST /knowledge-packs`

Upload a PDF, Markdown or plain-text file to be indexed for retrieval.

The response returns immediately with the pack in a pending state —
extraction and embedding run in the background, so poll the pack until
its status settles before expecting it in retrieval results.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Query parameters

- `skill_id` (`upload_knowledge_pack.query.skill_id`; any of, optional)
  - any of: `string`, `null`
- `app_id` (`upload_knowledge_pack.query.app_id`; any of, optional)
  - any of: `string`, `null`
- `visibility` (`upload_knowledge_pack.query.visibility`; string, optional)
  - one of `"private"`, `"public"`; default `"private"`

## Header parameters

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

## Request body

_Required._

- `file` (`upload_knowledge_pack.file`; string, required)

## Example request

```text
{
  "file": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://truememory-api.mvstg.com/knowledge-packs \
  --header 'Authorization: Bearer <token>' \
  --form-string 'file=string'
```

### TypeScript

```typescript
const formData = new FormData();
formData.append('file', 'string');

const url = 'https://truememory-api.mvstg.com/knowledge-packs';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}, body: formData};

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

files = [
    ("file", (None, "string"))
]
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, files=files, 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` (`upload_knowledge_pack.response.201.id`; string, required)
- `user_id` (`upload_knowledge_pack.response.201.user_id`; any of, required)
  - any of: `string`, `null`
- `app_id` (`upload_knowledge_pack.response.201.app_id`; any of, required)
  - any of: `string`, `null`
- `skill_id` (`upload_knowledge_pack.response.201.skill_id`; any of, required)
  - any of: `string`, `null`
- `filename` (`upload_knowledge_pack.response.201.filename`; string, required)
- `content_type` (`upload_knowledge_pack.response.201.content_type`; string, required)
- `status` (`upload_knowledge_pack.response.201.status`; string, required)
  - one of `"pending"`, `"processing"`, `"ready"`, `"error"`
- `created_at` (`upload_knowledge_pack.response.201.created_at`; string, required)
  - format `date-time`
- `visibility` (`upload_knowledge_pack.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` (`upload_knowledge_pack.response.422.detail`; array<object>, optional)
  - `loc` (`upload_knowledge_pack.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`upload_knowledge_pack.response.422.detail.msg`; string, required)
  - `type` (`upload_knowledge_pack.response.422.detail.type`; string, required)
  - `input` (`upload_knowledge_pack.response.422.detail.input`; unknown, optional)
  - `ctx` (`upload_knowledge_pack.response.422.detail.ctx`; object, optional)


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