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

# Upload files

> Upload knowledge-base files to a project

Uploads one or more files as knowledge-base sources. Returns `201 Created`.

This endpoint expects `multipart/form-data` with one or more `files` parts.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Project API key for this organization and project. Format: `bot_live_…`
</ParamField>

## Path parameters

<ParamField path="organization_id" type="string" required>
  Organization ID. Must match the API key.
</ParamField>

<ParamField path="project_id" type="string" required>
  Project ID. Must match the API key.
</ParamField>

## Body (multipart)

<ParamField body="files" type="file" required>
  One or more files to upload. Repeat the `files` field for multiple uploads.
</ParamField>

## Response

Success message confirming indexing was started. `data` is typically `null`.

## Errors

<ResponseField name="401" type="Unauthorized">
  Missing, invalid, or revoked API key.
</ResponseField>

<ResponseField name="403" type="Forbidden">
  API key is not authorized for this organization or project, or upload quota exceeded.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://backend.botcadence.com/organizations/ORG_ID/projects/PROJECT_ID/sources/files" \
    -H "X-API-Key: bot_live_YOUR_KEY" \
    -F "files=@./faq.pdf" \
    -F "files=@./pricing.docx"
  ```

  ```javascript JavaScript theme={null}
  const form = new FormData();
  form.append("files", file1, "faq.pdf");
  form.append("files", file2, "pricing.docx");

  const response = await fetch(
    `https://backend.botcadence.com/organizations/${organizationId}/projects/${projectId}/sources/files`,
    {
      method: "POST",
      headers: { "X-API-Key": process.env.BOTCADENCE_API_KEY },
      body: form,
    }
  );
  ```

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

  with open("faq.pdf", "rb") as f1, open("pricing.docx", "rb") as f2:
      response = requests.post(
          f"https://backend.botcadence.com/organizations/{organization_id}/projects/{project_id}/sources/files",
          headers={"X-API-Key": os.environ["BOTCADENCE_API_KEY"]},
          files=[
              ("files", ("faq.pdf", f1, "application/pdf")),
              ("files", ("pricing.docx", f2)),
          ],
      )
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "status": "success",
    "message": "Files uploaded successfully",
    "data": null,
    "status_code": 201
  }
  ```
</ResponseExample>
