> ## Documentation Index
> Fetch the complete documentation index at: https://docs.verbeo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload files

> Upload one file or several to a knowledge base in one call: up to 25 files and 25 MB, all or nothing.

Uploads files to a knowledge base in one `multipart/form-data` request. The answer comes once they are stored; Verbeo then reads them in the background. [Uploading files](https://docs.verbeo.ai/api-reference/knowledge-bases/overview.md#uploading-files) has the file types and how a request is checked.

* **Up to 25 files**, together **up to 25 MB**, each under the field name `files`.
* **All or nothing:** if any file is refused, none is kept, and the error names the file.
* Each file is checked against your plan: its size, the files in the knowledge base, your storage and passages, and duplicates.

## Path parameters

**id** `string` *required*

UUID of the knowledge base.

## Body

**files** `file` *required*

A file to upload, with its name. Repeat the field for each file.

## Request

```bash cURL theme={null}
curl -X POST "https://api.verbeo.ai/v1/knowledge-base/5df09066-0842-4c92-8ef0-6cf2ff6d7455/files" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files=@prices.pdf" \
  -F "files=@faq.md"
```

```javascript Node.js theme={null}
import { readFile } from "node:fs/promises";

const kbId = "5df09066-0842-4c92-8ef0-6cf2ff6d7455";
const form = new FormData();
for (const name of ["prices.pdf", "faq.md"]) {
  form.append("files", new Blob([await readFile(name)]), name);
}
const res = await fetch(`https://api.verbeo.ai/v1/knowledge-base/${kbId}/files`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.VERBEO_API_KEY}` },
  body: form,
});
const { data } = await res.json();
// data.files: one file object for each file sent, "processing"
```

```python Python theme={null}
import os, requests

kb_id = "5df09066-0842-4c92-8ef0-6cf2ff6d7455"
res = requests.post(
    f"https://api.verbeo.ai/v1/knowledge-base/{kb_id}/files",
    headers={"Authorization": f"Bearer {os.environ['VERBEO_API_KEY']}"},
    files=[("files", open("prices.pdf", "rb")), ("files", open("faq.md", "rb"))],
)
files = res.json()["data"]["files"]
```

> [!NOTE]
>
> Do not set `Content-Type` yourself: curl's `-F`, `FormData` and `requests`' `files=` set it with the form's boundary.

## Response

`201 Created`: `files`, a [file object](https://docs.verbeo.ai/api-reference/knowledge-bases/overview.md#the-file-object) for each file, in the order you sent them, each `processing`.

```json theme={null}
{
  "success": true,
  "data": {
    "files": [
      {
        "id": "c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0",
        "store_id": "5df09066-0842-4c92-8ef0-6cf2ff6d7455",
        "display_name": "prices.pdf",
        "file_type": "application/pdf",
        "file_size": 371989,
        "status": "processing",
        "content_hash": "15375e6b518b63b07e33cb2bc0a954ff49a9b326a49fe53dc324c8a894390127",
        "…": "every field of the file object"
      },
      {
        "id": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d",
        "display_name": "faq.md",
        "file_type": "text/markdown",
        "status": "processing",
        "…": "every field of the file object"
      }
    ]
  }
}
```

Read each file with [`GET /knowledge-base/files/{fileId}`](https://docs.verbeo.ai/api-reference/knowledge-bases/get-file), or the knowledge base, until it is `ready`.

## Errors

| Code | Status | When |
| - | - | - |
| `VALIDATION_FAILED` | 422 | `files: must include at least one file`; `files: must include at most 25 files`; `file: send each file under the name "files"`; a file with no name; `photo.png: This file type is not supported. …`; `Request body is not valid multipart/form-data`. |
| `PAYLOAD_TOO_LARGE` | 413 | `One request can carry at most 25 MB of files. Send the rest in another request.` |
| `KB_DUPLICATE_FILE` | 409 | `faq-copy.md: This file is already in this knowledge base, as "faq.md".` |
| `KB_FILE_TOO_LARGE` | 409 | `big.pdf: This file is 30 MB. Files can be up to 25 MB.` |
| `KB_FILE_LIMIT` | 409 | `f4.txt: This knowledge base already has 10 files, the most your plan allows. Delete a file first.` |
| `KB_EMPTY_FILE`, `KB_STORAGE_FULL`, `KB_FULL`, `KB_WORKSPACE_FULL`, `KB_MONTHLY_LIMIT` | 409 | Another of your [plan's limits](https://docs.verbeo.ai/api-reference/knowledge-bases/overview.md#plan-limits). |
| `BAD_GATEWAY` | 502 | `The files could not be stored just now. Try again in a moment.` Nothing was kept. |
| `NOT_FOUND` | 404 | No such knowledge base: `Knowledge base not found`. |

Every refusal keeps nothing of the request: send it again once the named file is fixed or left out.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.