Upload documents to the Knowledge Base
Upload documents to your Knowledge Base — up to 20 per request as one batch. Multipart, processed asynchronously — poll for status.
POST /files adds documents to your agent's Knowledge Base — up to 20 files in a single request, forming one batch. Uploads are multipart and processed asynchronously: you get a batch_id back immediately, then poll for status.
# Upload a batch (repeat -F "files=@..." per document)
curl -X POST "https://mcp.onkey.chat/functions/v1/rest-api/files" \
-H "Authorization: Bearer okm_<your-token-here>" \
-F "[email protected]" \
-F "[email protected]" \
-F "[email protected]"
# → { "batch_id": "...", "accepted": 3 }
# 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 — one email per batch, so batching 20 files means one confirmation, not 20. (The single-file -F "file=@..." form still works.)
Limits and validation
- Up to 20 files per request, 10 MB per file, 40 MB total per request.
- Supported types: PDF, DOCX, XLSX, PPTX, TXT, MD.
- Validation is all-or-nothing: if any file is invalid, nothing is imported and the error names every problem file — fix and resend the whole batch.
Batch instead of loopingIf your integration uploads many files (a nightly report drop, a content refresh), send them as one batched request rather than one call per file. Same processing either way — but one batch means one status to poll and one email to the Admin, instead of an inbox full of confirmations.
Don't poll in a tight loopA few seconds between status checks is plenty. See Rate limits.
For the full request and response schema, see the API Reference.
Next steps
- List your active mobile users — see who can ask your agent about the document.
- Errors — the error format and every status code.
Updated about 2 months ago

