Skip to Content
TurbineWhats.app
TurbineWhats.app
API schemaPricingWorkspaceOverview
WhatsApp sessionsText messagesImages and PDFsContacts, chats, and groupsWebhooksGroupsGroup operationsMessage operationsChat operationsContact operationsPresence operationsProfile operationsLabel operationsWhatsApp channel operationsStatus operationsBusiness catalog operationsCall operations
API guides

Images and PDFs

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

Read as MarkdownOpenAPI specification

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.

EndpointAccepted MIME types
POST /messages/imageimage/jpeg, image/png
POST /messages/documentapplication/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_idRequired
UUID

A ready session owned by your account and permitted by the API key.

toRequired
string · international number

Country code and phone number, without spaces. The optional leading + is normalized.

base64Required
base64 string

Raw base64 content without a data: URL prefix. At most 1,400,000 characters; approximately 1 MiB decoded.

mimetypeRequired
string

One of the MIME types accepted by the selected endpoint.

filenameOptional
string · up to 120 characters

Optional file name. Letters, digits, underscores, spaces, periods and hyphens only.

captionOptional
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.

Node.js
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 rulesDelivery tracking

Text messages

Previous Page

Contacts, chats, and groups

Next Page

On this page

Supported formatsRequest fieldsSend a PDF