Skip to main content

Upload Document

Upload one or more documents to the RAG knowledge base. The service will save the files, split the text based on the parameters, and write them into the vector collection.

Try It

POST/documents/uploadhttps://api-platform.ope.ai

Authentication

Uses Bearer Token authentication.

  • Header: Authorization: Bearer <token>
  • Example: Authorization: Bearer sk-xxxxxx

Request Body (multipart/form-data)

FieldTypeRequiredDescriptionDefault / Range
modelstringYesThe name of the embedding model used for document vectorizatione.g. bge-m3
filesfile[]YesThe document files to upload. Supports multi-file upload under the same field name.-
chunk_sizeintegerNoDocument chunk sizeDefault 500
chunk_overlapintegerNoThe number of overlapping characters between adjacent chunks to maintain context continuityDefault 50
separatorsstringNoCustom separatorsDefault splitting strategy

Default Limits

Limit ItemDefault LimitDescription
Document CountMax 100 documents per accountIncludes documents currently retained in the knowledge base
Total Document SizeMax 200 MB cumulative size per accountWhen exceeding the limit, you need to delete some documents, compress/split documents, or apply for a higher quota

For higher document counts, larger files, or dedicated knowledge base solutions, please contact us.

Request Examples

curl -X POST "https://api-platform.ope.ai/documents/upload" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-F "model=bge-m3" \
-F "chunk_size=500" \
-F "chunk_overlap=50" \
-F "files=@./handbook.pdf" \
-F "files=@./faq.docx"

Response Example

{
"status": "success",
"uploaded": [
{
"doc_id": "doc_1",
"filename": "handbook.pdf",
"status": "success"
}
]
}

Error Responses

Status CodeScenarioDescription
401Authentication failedAPI Key is missing, invalid, or has insufficient permissions
422Validation failedMissing files/model, or form field format is incorrect
500Upload processing failedFailed to save file, split text, write to vector collection, or perform database operations