# Knowledge bases: Upload a document (https://docs.envocal.ai/api-reference/knowledge-bases/upload-a-document/) > Send multipart/form-data with the document in a file field (e.g. PDF, Word, plain text or Markdown), one document per request, at most 20 MB. The document is processed in the background: poll POST /v1/tenants/{tenantId}/knowledge-bases/{kbId}/documents/status with the returned id until its state is complete. ## POST `/v1/tenants/{tenantId}/knowledge-bases/{kbId}/documents` Send `multipart/form-data` with the document in a `file` field (e.g. PDF, Word, plain text or Markdown), one document per request, at most 20 MB. The document is processed in the background: poll `POST /v1/tenants/{tenantId}/knowledge-bases/{kbId}/documents/status` with the returned `id` until its state is `complete`. **Required permission:** `knowledge:write` ### Parameters | Name | In | | Type | Description | | --- | --- | --- | --- | --- | | `tenantId` | path | required | string | Tenant id, or `current` for the key's own tenant. Must be the key's tenant or one of its sub-tenants. | | `kbId` | path | required | string | Knowledge base id. | ### Request body `multipart/form-data` | Field | Type | | Description | | --- | --- | --- | --- | | `file` | string (binary) | | | ### Responses **201**: Accepted for processing. Body: `{ "id": "" }`. **401**: Missing, invalid, revoked or expired API key. **403**: The key lacks the required permission, or the tenant/resource is outside its reach. **404**: Knowledge base not found in this tenant. **413**: The document is larger than 20 MB. **429**: Rate limit exceeded. Retry after the number of seconds in the Retry-After header. ### Example ```bash curl -X POST "https://api.envocal.ai/v1/tenants/current/knowledge-bases/{kbId}/documents" \ -H "Authorization: Bearer evk_eu_..." \ -F "file=@document.pdf" ```