1. Threads
  2. Upload Document to Thread
POST
/threads/{thread_id}/documents
curl --request POST \
     --url https://app.backboard.io/api/threads/{thread_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 be attached to a specific thread for Retrieval-Augmented Generation (RAG). The document will be processed, indexed, and made available for the assistant to reference when responding to messages in this thread.

​
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"

# Thread ID from your created thread
thread_id = "your_thread_id_here"

# Upload a document to the thread
with open("document.pdf", "rb") as file:
    response = requests.post(
        f"{BASE_URL}/threads/{thread_id}/documents",
        headers={"X-API-Key": API_KEY},
        files={"file": ("document.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']}")
else:
    print(f"Error: {response.status_code} - {response.text}")

​
Important Notes

The document will be processed asynchronously. Check the status field in the response. It will be “processing” initially and change to “completed” when ready for use.

You can check the processing status of your document using the Get Document Status endpoint with the returned document_id.

Large files may take longer to process. The API supports files up to 50MB in size.

​
Authorizations

X-API-Key
required
string
API Key authentication

​
Query Parameters

thread_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