How to Send a Voice Message
Sending a Voice Message via API
Upload an audio file and queue a voice campaign with the LigueLead API.
Prerequisites
- Get your
api-tokenandapp-idin your LigueLead account. - Prepare an audio file in a supported format such as MP3 or WAV.
- Collect the recipient phone numbers in Brazilian format without the country code (for example,
11999999999).
Step 1: Upload the audio file
Endpoint: POST /v1/voice/uploads
Run the request to upload the audio file you want to send.
curl -X POST "https://api.liguelead.com.br/v1/voice/uploads" \
-H "api-token: YOUR_API_TOKEN" \
-H "app-id: YOUR_APP_ID" \
-F "title=Welcome Message" \
-F "file=@/path/to/your/audio.mp3"Expected response
{
"message": "Voice upload successful.",
"data": {
"id": 436514,
"title": "Welcome Message"
}
}Save the returned id. You will use it as voice_upload_id in the next request.
Step 2: Send the voice message
Endpoint: POST /v1/voice
Run the request to queue the voice message for delivery.
curl -X POST "https://api.liguelead.com.br/v1/voice" \
-H "api-token: YOUR_API_TOKEN" \
-H "app-id: YOUR_APP_ID" \
-H "Content-Type: application/json" \
-d '{
"title": "Welcome Campaign",
"voice_upload_id": 436514,
"phones": ["11999999999", "11888888888"]
}'Expected response
{
"message": "Voice accepted successfully",
"data": {
"campaign_id": "3b4f7c5e-7e2d-4157-b542-5eb2155455c5",
"accepted_at": "2025-12-29T18:34:38.961Z"
}
}A 202 Accepted response means the request was received and queued for processing.
Optional: Configuring retries
Use the retry fields to control how the voice service redials a number after a failed call. All three fields are optional.
| Field | Type | Default | Constraints | Description |
|---|---|---|---|---|
retry_attempts | integer | 3 | Minimum 1, maximum 3 | Number of retry attempts after a failed call. |
retry_interval_min | integer | 15 | Minimum 5, maximum 180 | Interval, in minutes, between retry attempts. |
retry_end_time | string | None | HH:MM, between 08:00 and 21:45, and at least 10 minutes in the future in America/Sao_Paulo | Cutoff time for new retry attempts. The system does not redial after this time. |
When you omit retry_attempts and retry_interval_min, the voice service automatically applies the default values of 3 attempts with a 15-minute interval between them. These defaults are managed by the voice service and may vary by account.
When you omit retry_end_time, no custom cutoff time is applied.
Voice sending and retries stop automatically at 21:45 (Brasília time). Set
retry_end_timeearly enough for all attempts to finish before that cutoff.
Example payload with retries
curl -X POST "https://api.liguelead.com.br/v1/voice" \
-H "api-token: YOUR_API_TOKEN" \
-H "app-id: YOUR_APP_ID" \
-H "Content-Type: application/json" \
-d '{
"title": "Payment Reminder",
"voice_upload_id": 436514,
"phones": ["11999999999", "11888888888"],
"retry_attempts": 3,
"retry_interval_min": 15,
"retry_end_time": "21:00"
}'Retry validation errors
The API returns 400 Bad Request when retry_end_time:
- does not match the
HH:MMformat - is outside the allowed range of
08:00to21:45 - is less than 10 minutes in the future in the
America/Sao_Paulotimezone
Optional: Managing uploaded audio files
Use these endpoints to review the audio files already available in your account.
List uploaded audio files
curl -X GET "https://api.liguelead.com.br/v1/voice/uploads" \
-H "api-token: YOUR_API_TOKEN" \
-H "app-id: YOUR_APP_ID"Get one uploaded audio file by ID
curl -X GET "https://api.liguelead.com.br/v1/voice/uploads/436514" \
-H "api-token: YOUR_API_TOKEN" \
-H "app-id: YOUR_APP_ID"Troubleshooting
| Issue | What to check |
|---|---|
| File upload fails | Confirm the audio file is valid and the request uses multipart/form-data. |
| Authentication error | Verify the api-token and app-id headers. |
| Voice file not found | Confirm voice_upload_id matches an existing uploaded audio file. |
retry_end_time is rejected | Check the HH:MM format, the 08:00 to 21:45 range, and whether the time is at least 10 minutes in the future in America/Sao_Paulo. |
| Calls are not retried as expected | Confirm the retry settings leave enough time before the 21:45 cutoff. |
Updated about 1 month ago
