Skip to main content

Send Audio Message

Send audio messages that appear as voice notes in WhatsApp. These are different from regular audio files and display as playable voice messages (PTT - Push-to-Talk) in the chat.

Endpoint

POST /message/sendWhatsAppAudio/:instanceName

Path Parameters

instanceName
string
required
The name of your WhatsApp instance that you created

Request Body

This endpoint supports three methods for sending audio:
  1. URL: Provide a direct link to the audio file
  2. Base64: Provide the base64-encoded audio content
  3. File Upload: Use multipart/form-data to upload an audio file
number
string
required
The recipient’s WhatsApp number in international format (without + symbol)Example: 5511999999999 for a Brazilian number
audio
string
required
The audio content as a URL or base64 string (not required when using file upload)Examples:
  • URL: https://example.com/audio.mp3
  • Base64: data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAA...
delay
integer
Delay before sending the message in millisecondsExample: 1000 for 1 second delay
quoted
object
Quote a previous message by providing its key and message object
encoding
boolean
Enable audio encoding for better compatibilityDefault: false

Response

key
object
Message key information
message
object
The sent message object containing the audio message data
messageTimestamp
string
Unix timestamp when the message was sent
status
string
Message status (e.g., “PENDING”, “SENT”)

Code Examples

curl -X POST https://your-api-url.com/message/sendWhatsAppAudio/my-instance \
  -H "Content-Type: application/json" \
  -H "apikey: YOUR_API_KEY" \
  -d '{
    "number": "5511999999999",
    "audio": "https://example.com/voice-note.mp3"
  }'

Advanced Examples

{
  "number": "5511999999999",
  "audio": "https://example.com/voice-message.mp3"
}
{
  "number": "5511999999999",
  "audio": "data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAA...",
  "encoding": true
}
{
  "number": "5511999999999",
  "audio": "https://example.com/voice-note.mp3",
  "quoted": {
    "key": {
      "id": "BAE5F2D3E4F5A6B7",
      "remoteJid": "[email protected]",
      "fromMe": false
    },
    "message": {
      "conversation": "Original message"
    }
  }
}

Audio Format Guidelines

For best compatibility with WhatsApp voice messages, use the following formats:
  • Format: MP3, OGG (Opus codec), AAC
  • Sample rate: 16kHz or 48kHz
  • Bitrate: 64kbps - 128kbps
  • Channels: Mono (1 channel)
  • Maximum duration: No hard limit, but shorter is better for voice notes
  • Maximum size: 16MB

Supported Audio Formats

  • MP3 (audio/mpeg)
  • OGG with Opus codec (audio/ogg)
  • M4A/AAC (audio/mp4, audio/aac)
  • WAV (audio/wav) - will be converted
Audio files sent via this endpoint will appear as voice messages (PTT) in WhatsApp, displayed with a play button and waveform. To send regular audio files as documents, use the Send Media endpoint with mediatype: "audio".

PTT vs Regular Audio

Voice Message (PTT) - This Endpoint

  • Appears as a voice message with waveform
  • Plays automatically in sequence
  • Designed for quick voice communication
  • Maximum 16MB file size

Regular Audio File - Send Media Endpoint

  • Appears as an audio file attachment
  • Requires manual play
  • Suitable for music, podcasts, etc.
  • Can be larger files

Error Responses

status
number
HTTP status code
message
string
Error description

Common Errors

Status CodeError MessageSolution
400”Owned media must be a url, base64, or valid file with buffer”Ensure audio is provided as URL, base64, or file upload
401UnauthorizedCheck your API key
404Not FoundVerify instance exists and is connected
500Internal Server ErrorCheck audio file format and size
The audio URL must be publicly accessible. If you’re getting errors, verify that the URL can be accessed without authentication.

Build docs developers (and LLMs) love