> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wadial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Download incoming media

> Download an incoming image, video, audio, document, or sticker attachment.

Use this endpoint after receiving an incoming media message from webhooks or the event stream. Pass the incoming `message` object from the event payload.

```http theme={null}
POST /api/v1/sessions/{sessionId}/media/download
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "message": {
    "imageMessage": {
      "mimetype": "image/jpeg",
      "directPath": "/v/t62.7118-24/...",
      "mediaKey": "..."
    }
  },
  "maxBytes": 16777216
}
```

`maxBytes` is optional and defaults to 16 MiB. The maximum accepted value is 64 MiB.

Successful responses return base64-encoded media bytes:

```json theme={null}
{
  "data": {
    "mediaType": "image",
    "mimetype": "image/jpeg",
    "fileLength": 184204,
    "sizeBytes": 184204,
    "base64": "..."
  }
}
```

If the message has no downloadable attachment, the API returns a Problem Details validation error.
