## Upload media

`POST https://whatsapp.paaltech.org/api/v1/businesses/{external_id}/media`

Uploads a file to send, as `multipart/form-data` with a `file` field (and an optional
`filename`, shown for documents). The type is detected from the file itself: JPEG/PNG
images (5 MB), MP4/3GP videos (16 MB), AAC/AMR/MP3/M4A/OGG audio (16 MB), and PDF, Word,
Excel, PowerPoint or text documents (100 MB). Then send a message of that type with
`media.id`. A file can be sent many times. Needs media enabled for the business. Example:
`curl -F file=@receipt.pdf -H "Authorization: Bearer $TOKEN" .../businesses/presec/media`.

Ability: `messages.send`

### Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `external_id` | string | yes | Your own ID for the business (Multi-SKUUL - the tenant ID). Max 191 characters. Pattern `^[A-Za-z0-9._:-]+$` |

### Request

```bash
curl --request POST \
  --url 'https://whatsapp.paaltech.org/api/v1/businesses/presec/media' \
  --header "Authorization: Bearer $PAALCHAT_TOKEN" \
  --header 'Accept: application/json'
```

### Responses

- **201** - Stored, ready to send.
- **401** - unauthenticated - missing, invalid, revoked or expired token

```json
{
  "error": {"code": "unauthenticated", "message": "A valid product token is required."}
}
```

- **403** - missing_ability, or feature_disabled (media is not enabled for the business).

```json
{
  "error": {
    "code": "feature_disabled",
    "message": "Media is not enabled for this business."
  }
}
```

- **404** - not_found - not yours, or does not exist

```json
{"error": {"code": "not_found", "message": "Business not found."}}
```

- **422** - validation_failed, unsupported_media (WhatsApp cannot send this kind of file) or media_too_large.

```json
{
  "error": {
    "code": "unsupported_media",
    "message": "WhatsApp cannot send text/html files."
  }
}
```

- **429** - rate_limited - over 300 requests/minute for this product

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Slow down and retry after the Retry-After header."
  }
}
```

