1. Assistants
  2. Upload Document to Assistant
POST
/assistants/{assistant_id}/documents
curl --request POST \
     --url https://app.backboard.io/api/assistants/{assistant_id}/documents \
     --header 'X-API-Key: <api-key>' \
     --header 'authorization: <authorization>' \
     --header 'x_session_token: <x_session_token>' \
     --form 'file=@/path/to/file'

Upload a document to an assistant for Retrieval-Augmented Generation (RAG). Documents attached to an assistant are available across all threads created with that assistant, providing shared context and knowledge.

​
Supported File Types

Documents: PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX Text/Data: TXT, CSV, MD, MARKDOWN, JSON, JSONL, XML Code: PY, JS, TS, JSX, TSX, HTML, CSS, CPP, C, H, JAVA, GO, RS, RB, PHP, SQL Images: PNG, JPG, JPEG, WEBP, GIF, BMP, TIFF, TIF

​
Code Examples

  • Python

  • JavaScript (Node.js)

  • cURL

import requests

# Your API credentials
API_KEY = "your_api_key_here"
BASE_URL = "https://app.backboard.io/api"

# Assistant ID from your created assistant
assistant_id = "your_assistant_id_here"

# Upload a document to the assistant
with open("knowledge_base.pdf", "rb") as file:
    response = requests.post(
        f"{BASE_URL}/assistants/{assistant_id}/documents",
        headers={"X-API-Key": API_KEY},
        files={"file": ("knowledge_base.pdf", file, "application/pdf")}
    )

# Check response
if response.status_code == 200:
    document = response.json()
    print(f"Document uploaded: {document['document_id']}")
    print(f"Status: {document['status']}")
    print(f"File size: {document['file_size_bytes']} bytes")
else:
    print(f"Error: {response.status_code} - {response.text}")

​
Important Notes

Documents uploaded to an assistant are available to all threads created with that assistant. This is useful for providing common knowledge or reference materials that the assistant should always have access to.

The document will be processed asynchronously. The status field will show “processing” initially and change to “completed” when the document is ready for use in conversations.

You can upload multiple documents to an assistant to build a comprehensive knowledge base. Use the List Assistant Documents endpoint to see all documents associated with an assistant.

Large files may take longer to process. Processing time varies based on file size and content type. For image/video generation inputs, see Image Tool and Video Tool.

​
Authorizations

X-API-Key
required
string
API Key authentication

​
Query Parameters

assistant_id
required
string
authorization
x_session_token

​
Body

multipart/form-data
file
required
file

File

​
Response

application/json
  • 200

  • 422

Successful Response

document_id
required
string

Document Id

filename
required
string

Filename

status
required
string

DocumentStatus

Available options: pending, processing, indexed, error
created_at
required
string

Created At

metadata_
object | null

Metadata

status_message
string | null

Status Message

summary
string | null

Summary

updated_at
string | null

Updated At