Skip to main content
POST
/
api
/
v1
/
assistants
/
{assistant_id}
/
documents
/
upload
Upload Document
curl --request POST \
  --url https://api.example.com/api/v1/assistants/{assistant_id}/documents/upload \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form 'name=<string>' \
  --form 'category=<string>' \
  --form 'tags=<string>'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
This endpoint allows you to upload a document to an assistant’s knowledge base for Retrieval-Augmented Generation (RAG). The document will be processed, chunked, and stored as embeddings in a vector database. The request must be sent as multipart/form-data.

Path Parameters

  • assistant_id (string, required): The unique identifier of the assistant to whom the document will be added.

Form Data

  • file (file, required): The document to upload. Supported file types include .txt, .pdf, .md, and .docx.

Response

A successful request will immediately return a document object with a processing status. The document will be processed in the background. You can check the status later using the Get Document Status endpoint.
Response
{
  "id": "doc_1234567890",
  "user_id": "user_12345",
  "organization_id": "org_67890",
  "assistant_id": "asst_a1b2c3d4e5f67890",
  "name": "product_faq.pdf",
  "status": "processing",
  "created_at": "2023-10-28T16:00:00Z",
  "updated_at": "2023-10-28T16:00:00Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

assistant_id
integer
required

Body

multipart/form-data
file
file
required
name
string | null
category
string | null
tags
string | null

Response

Successful Response