Skip to main content

Messages API

Endpoints for sending, editing, forwarding, and deleting WhatsApp messages.

Common Response

All send message endpoints return the same response format:

{
"id": "b6652d6e-8e5d-4ee3-a16a-bfc560b64448",
"messageId": "3EB01CEDFD9A2E927BED83"
}
FieldTypeDescription
idstringInternal unique identifier (UUID)
messageIdstringWhatsApp message identifier

Recipient Formats

The to field accepts multiple formats:

FormatExampleDescription
International5511999999999Full format with country code (recommended)
Brazilian11999999999Auto-adds +55 country code
Personal Chat[email protected]Direct message
Group Chat[email protected]Group message
WhatsApp LID40076373446793@lidLID identifier

Send Text Message

Sends a text message to a contact or group.

POST /api/message/{instanceId}/text

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"message": "Hello, this is a test message!",
"quoteMessageId": "73C5222F61C8DB541672CE65D79C7E4B"
}
FieldTypeRequiredDescription
tostringYesRecipient phone number or chat ID
messagestringYesText message content
quoteMessageIdstringNoMessage ID to reply to

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/text" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"message": "Hello from Zapy API!"
}'

Send Image Message

Sends an image to a contact or group.

POST /api/message/{instanceId}/image

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...",
"caption": "Check out this image!",
"quoteMessageId": "73C5222F61C8DB541672CE65D79C7E4B",
"viewOnce": false
}
FieldTypeRequiredDefaultDescription
tostringYes-Recipient phone number or chat ID
imagestringYes-Base64 encoded image or URL
captionstringNo-Image caption
quoteMessageIdstringNo-Message ID to reply to
viewOncebooleanNofalseSend as view-once message

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/image" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"image": "https://example.com/image.jpg",
"caption": "Beautiful sunset!"
}'

Send Video Message

Sends a video to a contact or group.

POST /api/message/{instanceId}/video

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"video": "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21...",
"caption": "Check out this video!",
"quoteMessageId": "73C5222F61C8DB541672CE65D79C7E4B",
"viewOnce": false
}
FieldTypeRequiredDefaultDescription
tostringYes-Recipient phone number or chat ID
videostringYes-Base64 encoded video or URL
captionstringNo-Video caption
quoteMessageIdstringNo-Message ID to reply to
viewOncebooleanNofalseSend as view-once message

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/video" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"video": "https://example.com/video.mp4",
"caption": "Amazing video!"
}'

Send Audio Note (Voice Message)

Sends a voice note (PTT - Push to Talk) to a contact or group. Voice notes appear with the characteristic WhatsApp voice message UI.

POST /api/message/{instanceId}/audio-note

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"audio": "data:audio/ogg;base64,T2dnUwACAAAAAAAAAADqnjMl...",
"quoteMessageId": "73C5222F61C8DB541672CE65D79C7E4B",
"viewOnce": false
}
FieldTypeRequiredDefaultDescription
tostringYes-Recipient phone number or chat ID
audiostringYes-Base64 encoded audio or URL
quoteMessageIdstringNo-Message ID to reply to
viewOncebooleanNofalseSend as view-once message
Audio Format

For best compatibility, use OGG format with Opus codec for voice notes.

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/audio-note" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"audio": "data:audio/ogg;base64,T2dnUwACAAAAAAAAAADqnjMl..."
}'

Send Audio File

Sends an audio file (not voice note) to a contact or group. Audio files appear as playable media attachments.

POST /api/message/{instanceId}/audio-file

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"audio": "data:audio/mp3;base64,UklGRnoGAABXQVZFZm10IBAAAAABAAEA...",
"quoteMessageId": "73C5222F61C8DB541672CE65D79C7E4B"
}
FieldTypeRequiredDescription
tostringYesRecipient phone number or chat ID
audiostringYesBase64 encoded audio or URL
quoteMessageIdstringNoMessage ID to reply to

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/audio-file" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"audio": "https://example.com/song.mp3"
}'

Send Document

Sends a document file to a contact or group.

POST /api/message/{instanceId}/document

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"document": "data:application/pdf;base64,JVBERi0xLjQKJcfsj6IKNSAwIG9iago...",
"caption": "Here is the requested document",
"fileName": "report.pdf",
"quoteMessageId": "73C5222F61C8DB541672CE65D79C7E4B"
}
FieldTypeRequiredDescription
tostringYesRecipient phone number or chat ID
documentstringYesBase64 encoded document or URL
captionstringNoDocument caption
fileNamestringNoDisplay filename
quoteMessageIdstringNoMessage ID to reply to

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/document" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511999999999",
"document": "https://example.com/report.pdf",
"fileName": "Monthly_Report.pdf",
"caption": "Here is the monthly report"
}'

Forward Message

Forwards an existing message to another contact or group.

POST /api/message/{instanceId}/forward

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"to": "[email protected]",
"messageId": "73C5222F61C8DB541672CE65D79C7E4B"
}
FieldTypeRequiredDescription
tostringYesRecipient phone number or chat ID
messageIdstringYesWhatsApp message ID to forward

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/forward" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "5511888888888",
"messageId": "3EB01CEDFD9A2E927BED83"
}'

Edit Message

Edits the content of an existing text message.

POST /api/message/{instanceId}/edit

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"messageId": "[email protected]_3EB0C767D71CC8C55E",
"message": "This is the edited message content"
}
FieldTypeRequiredDescription
messageIdstringYesWhatsApp message ID to edit
messagestringYesNew message content
Edit Limitations

Only text messages sent by you can be edited. Media messages cannot be edited.

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/edit" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messageId": "3EB01CEDFD9A2E927BED83",
"message": "Updated message text"
}'

Mark Message as Read

Marks a message as read, sending a read receipt to the sender.

POST /api/message/{instanceId}/read

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"messageId": "73C5222F61C8DB541672CE65D79C7E4B"
}
FieldTypeRequiredDescription
messageIdstringYesWhatsApp message ID to mark as read

Response

{
"messageId": "3EB01CEDFD9A2E927BED83"
}

Example

curl -X POST "https://api.zapyapi.com/api/message/my-instance/read" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messageId": "3EB01CEDFD9A2E927BED83"
}'

Delete Message

Deletes a message for everyone in the chat.

DELETE /api/message/{instanceId}/delete

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier

Request Body

{
"messageId": "73C5222F61C8DB541672CE65D79C7E4B"
}
FieldTypeRequiredDescription
messageIdstringYesWhatsApp message ID to delete

Response

Returns 204 No Content on success.

Delete Limitations

Messages can only be deleted within a certain time window after sending (typically ~1 hour). Only messages sent by you can be deleted for everyone.

Example

curl -X DELETE "https://api.zapyapi.com/api/message/my-instance/delete" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messageId": "3EB01CEDFD9A2E927BED83"
}'

Gets a temporary download URL for media content from a message.

GET /api/message/{instanceId}/media-download-link/{messageId}

Path Parameters

ParameterTypeRequiredDescription
instanceIdstringYesWhatsApp instance identifier
messageIdstringYesWhatsApp message ID containing media

Response

{
"url": "https://example.com/media/document.pdf",
"urlExpiresIn": 3600,
"fileName": "document.pdf"
}
FieldTypeDescription
urlstringTemporary URL to download the media
urlExpiresInnumberURL expiration time in seconds
fileNamestringOriginal filename

Example

curl -X GET "https://api.zapyapi.com/api/message/my-instance/media-download-link/3EB01CEDFD9A2E927BED83" \
-H "x-api-key: YOUR_API_KEY"