# Upload a CRM document

`POST /v1/crm-documents/upload` calls `crm.documentgenerator.document.upload`. Use a writable key with `crm` scope. The `fields` object requires `entityTypeId`, `entityId`, `title`, `number`, `region`, and base64 `fileContent`; `pdfContent` and `imageContent` are optional. Each decoded file is limited to 2 MiB and the JSON body to 3 MiB. Invalid base64 returns `400` before a portal call.

```bash
curl -X POST https://vibecode.bitrix24.com/v1/crm-documents/upload -H 'X-Api-Key: YOUR_VIBE_KEY' -H 'Content-Type: application/json' -d '{"fields":{"entityTypeId":2,"entityId":45,"title":"VIBE-PROBE document","number":"1","region":"us","fileContent":"RkFLRQ=="}}'
```

The base64 in this example illustrates the request shape. Supply real DOCX bytes for an actual upload. A `201` response contains the created document.
