Upload a document to the Knowledge Base

Upload a document to your Knowledge Base. Uploads are multipart and processed asynchronously — poll for status.

POST /files adds a document to your agent's Knowledge Base. Uploads are multipart and processed asynchronously: you get a batch_id back immediately, then poll for status.

# Upload
curl -X POST "https://mcp.onkey.chat/functions/v1/rest-api/files" \
  -H "Authorization: Bearer okm_<your-token-here>" \
  -F "[email protected]"
# → { "batch_id": "..." }

# Poll
curl "https://mcp.onkey.chat/functions/v1/rest-api/files/<batch_id>" \
  -H "Authorization: Bearer okm_<your-token-here>"

The Admin the token was issued for also gets an email when processing finishes.

📘

Don't poll in a tight loop

A few seconds between status checks is plenty. See Rate limits.

For the full request and response schema, see the API Reference.

Next steps


Did this page help you?