# Images and PDFs

Send JPEG/PNG images and PDF documents as bounded base64 payloads on a paid plan.

## Supported formats

These endpoints require send permission and paid access. Trials support text only. Advanced session message operations additionally support bounded audio, video, stickers and public HTTPS media URLs; see the Message operations reference and Capabilities and limits.





Endpoint | Accepted MIME types
--- | ---
POST /messages/image | image/jpeg, image/png
POST /messages/document | application/pdf







## Request fields

The whole JSON request must fit within 1,500,000 bytes. Send an Idempotency-Key as with text. Each accepted media send consumes one message from the account allowance.



- `channel_id` (UUID, required): A ready session owned by your account and permitted by the API key.
- `to` (string · international number, required): Country code and phone number, without spaces. The optional leading + is normalized.
- `base64` (base64 string, required): Raw base64 content without a data: URL prefix. At most 1,400,000 characters; approximately 1 MiB decoded.
- `mimetype` (string, required): One of the MIME types accepted by the selected endpoint.
- `filename` (string · up to 120 characters): Optional file name. Letters, digits, underscores, spaces, periods and hyphens only.
- `caption` (string · up to 1,024 characters): Optional text accompanying the media.









## Send a PDF

Provide a real invoice.pdf file, an authorized recipient, and your own session ID before running this example. Use the same envelope for images with image/jpeg or image/png.







```javascript
import { readFile } from 'node:fs/promises';

const pdf = await readFile('./invoice.pdf');
const response = await fetch('https://turbinewhats.app/api/v1/messages/document', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer ' + process.env.TURBINEWHATS_TOKEN,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'invoice-1042-pdf'
  },
  body: JSON.stringify({
    channel_id: '1d848fa6-b0c2-4d28-b870-09f44d750d93',
    to: '14155550123',
    base64: pdf.toString('base64'),
    mimetype: 'application/pdf',
    filename: 'invoice-1042.pdf',
    caption: 'Your invoice is attached.'
  })
});
const result = await response.json();
if (!response.ok) throw new Error(result.error.message);
console.log(result.data.id);
```



[Message response and retry rules](https://turbinewhats.app/docs/messages)
[Delivery tracking](https://turbinewhats.app/docs/delivery)