Skip to main content
POST
/
knowledge
/
{knowledge_base_id}
/
upload
cURL
# Simple file upload
curl -X POST "https://api.opper.ai/v2/knowledge/{knowledge_base_id}/upload" \
  -H "Authorization: Bearer ${OPPER_API_KEY}" \
  -F "file=@document.pdf"

# Upload with metadata and custom chunk settings
curl -X POST "https://api.opper.ai/v2/knowledge/{knowledge_base_id}/upload" \
  -H "Authorization: Bearer ${OPPER_API_KEY}" \
  -F "file=@contract.pdf" \
  -F "text_processing.chunk_size=1000" \
  -F "text_processing.chunk_overlap=100" \
  -F 'metadata={"category": "legal", "client": "acme"}'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "key": "<string>",
  "original_filename": "<string>",
  "document_id": 123,
  "metadata": {}
}

Authorizations

Authorization
string
header
required

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

Path Parameters

knowledge_base_id
string<uuid>
required

The id of the knowledge base to upload the file to

Body

multipart/form-data
file
file
required

The file to upload

text_processing.chunk_size
integer
default:2000

The chunk size to use for the document (number of characters)

text_processing.chunk_overlap
integer
default:200

The chunk overlap to use for the document (number of characters)

metadata
string | null

Optional JSON object metadata to attach to the file

Example:

"{\"category\": \"legal\", \"client\": \"acme\"}"

Response

Successful Response

id
string<uuid>
required
key
string
required
original_filename
string
required
document_id
integer
required
metadata
Metadata · object