# Upload file to knowledge base (/docs/api-reference/knowledge-base/uploadKnowledgeBaseFile)

> Upload a PDF file. The file content must be Base64 encoded.



**POST** `/knowledge_base/create`

Upload a PDF file. The file content must be Base64 encoded.

```yaml
operationId: uploadKnowledgeBaseFile
requestBody:
  required: true
  content:
    application/json:
      schema:
        type: object
        required:
          - file
          - filename
        properties:
          file:
            type: string
            description: Base64-encoded file content.
          filename:
            type: string
            description: Filename including the `.pdf` extension.
            example: sample.pdf
responses:
  '200':
    description: Uploaded file metadata.
    content:
      application/json:
        schema:
          type: object
          properties:
            success:
              type: boolean
            message:
              type: string
            file:
              type: object
              description: A file uploaded to the knowledge base.
              properties:
                id:
                  type: integer
                  example: 17686
                name:
                  type: string
                  example: customer_call.mp3
                original_filename:
                  type: string
                  example: customer_call.mp3
                file_size:
                  type: integer
                  description: Size in bytes.
                mime_type:
                  type: string
                  example: audio/mpeg
                download_url:
                  type: string
                  format: uri
                upload_status:
                  type: string
                  example: uploaded
                upload_date:
                  type: string
                  example: 04/11/2026 16:24:00
                user_name:
                  type: string
                user_id:
                  type: integer
                organization_id:
                  type: integer
        example:
          success: true
          message: File uploaded successfully
          file:
            id: 964
            name: sample.pdf
            original_filename: sample.pdf
            file_size: 524288
            mime_type: application/pdf
            upload_status: uploaded
            upload_date: 05/08/2026 10:30:00
            user_id: 1234
            user_name: Demo User
            organization_id: 14
```

**Python SDK**

```python
# Upload a file to the knowledge base
import base64

file_path = "sample.pdf"  # Path to your PDF file
file_name = "sample.pdf"  # Name for the file in the knowledge base

with open(file_path, "rb") as file:
    file_data = base64.b64encode(file.read()).decode('utf-8')

response = client.knowledge_base.create(file_data, file_name)
print(response)
```

**curl**

```bash
curl -X POST "https://backend.omnidim.io/api/v1/knowledge_base/create" \
  -H "Authorization: Bearer $OMNIDIM_API_KEY"
```
