Convert text to speech using a specified voice
curl --request POST \
--url https://api.wav.com/api/public/v1/TextToSpeech \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, this is a sample text to speech conversion.",
"sample_audio_url": "<YOUR_AUDIO_URL>",
"voice_id": "e1cb7380-e3db-433a-b186-a996d7545986",
"gender": "",
"webhook_url": "https://example.com/my-webhook"
}
'import requests
url = "https://api.wav.com/api/public/v1/TextToSpeech"
payload = {
"text": "Hello, this is a sample text to speech conversion.",
"sample_audio_url": "<YOUR_AUDIO_URL>",
"voice_id": "e1cb7380-e3db-433a-b186-a996d7545986",
"gender": "",
"webhook_url": "https://example.com/my-webhook"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'Hello, this is a sample text to speech conversion.',
sample_audio_url: '<YOUR_AUDIO_URL>',
voice_id: 'e1cb7380-e3db-433a-b186-a996d7545986',
gender: '',
webhook_url: 'https://example.com/my-webhook'
})
};
fetch('https://api.wav.com/api/public/v1/TextToSpeech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wav.com/api/public/v1/TextToSpeech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Hello, this is a sample text to speech conversion.',
'sample_audio_url' => '<YOUR_AUDIO_URL>',
'voice_id' => 'e1cb7380-e3db-433a-b186-a996d7545986',
'gender' => '',
'webhook_url' => 'https://example.com/my-webhook'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wav.com/api/public/v1/TextToSpeech"
payload := strings.NewReader("{\n \"text\": \"Hello, this is a sample text to speech conversion.\",\n \"sample_audio_url\": \"<YOUR_AUDIO_URL>\",\n \"voice_id\": \"e1cb7380-e3db-433a-b186-a996d7545986\",\n \"gender\": \"\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wav.com/api/public/v1/TextToSpeech")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is a sample text to speech conversion.\",\n \"sample_audio_url\": \"<YOUR_AUDIO_URL>\",\n \"voice_id\": \"e1cb7380-e3db-433a-b186-a996d7545986\",\n \"gender\": \"\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wav.com/api/public/v1/TextToSpeech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is a sample text to speech conversion.\",\n \"sample_audio_url\": \"<YOUR_AUDIO_URL>\",\n \"voice_id\": \"e1cb7380-e3db-433a-b186-a996d7545986\",\n \"gender\": \"\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "0a65cbb6-2ab8-4949-9ee0-0e8c138ac2cf",
"conversion_id": "6542baa6-d61f-4d90-b832-ed929d9c0996",
"eta": 17,
"credit_estimate": 0.68,
"message": "",
"status": "IN_QUEUE"
}{
"success": false,
"error_code": "INSUFFICIENT_CREDITS",
"message": ""
}{
"success": false,
"error_code": "UNPROCESSABLE_CONTENT",
"message": ""
}{
"success": false,
"error_code": "INTERNAL_SERVER_ERROR",
"message": ""
}Conversion Endpoints
Text To Speech
Synthesize speech from text with voice and gender customization, plus optional webhook callback.
Give priority to the sample audio first, then to the voice ID, and lastly to gender.
POST
/
v1
/
TextToSpeech
Convert text to speech using a specified voice
curl --request POST \
--url https://api.wav.com/api/public/v1/TextToSpeech \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, this is a sample text to speech conversion.",
"sample_audio_url": "<YOUR_AUDIO_URL>",
"voice_id": "e1cb7380-e3db-433a-b186-a996d7545986",
"gender": "",
"webhook_url": "https://example.com/my-webhook"
}
'import requests
url = "https://api.wav.com/api/public/v1/TextToSpeech"
payload = {
"text": "Hello, this is a sample text to speech conversion.",
"sample_audio_url": "<YOUR_AUDIO_URL>",
"voice_id": "e1cb7380-e3db-433a-b186-a996d7545986",
"gender": "",
"webhook_url": "https://example.com/my-webhook"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'Hello, this is a sample text to speech conversion.',
sample_audio_url: '<YOUR_AUDIO_URL>',
voice_id: 'e1cb7380-e3db-433a-b186-a996d7545986',
gender: '',
webhook_url: 'https://example.com/my-webhook'
})
};
fetch('https://api.wav.com/api/public/v1/TextToSpeech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wav.com/api/public/v1/TextToSpeech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Hello, this is a sample text to speech conversion.',
'sample_audio_url' => '<YOUR_AUDIO_URL>',
'voice_id' => 'e1cb7380-e3db-433a-b186-a996d7545986',
'gender' => '',
'webhook_url' => 'https://example.com/my-webhook'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wav.com/api/public/v1/TextToSpeech"
payload := strings.NewReader("{\n \"text\": \"Hello, this is a sample text to speech conversion.\",\n \"sample_audio_url\": \"<YOUR_AUDIO_URL>\",\n \"voice_id\": \"e1cb7380-e3db-433a-b186-a996d7545986\",\n \"gender\": \"\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wav.com/api/public/v1/TextToSpeech")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is a sample text to speech conversion.\",\n \"sample_audio_url\": \"<YOUR_AUDIO_URL>\",\n \"voice_id\": \"e1cb7380-e3db-433a-b186-a996d7545986\",\n \"gender\": \"\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wav.com/api/public/v1/TextToSpeech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is a sample text to speech conversion.\",\n \"sample_audio_url\": \"<YOUR_AUDIO_URL>\",\n \"voice_id\": \"e1cb7380-e3db-433a-b186-a996d7545986\",\n \"gender\": \"\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "0a65cbb6-2ab8-4949-9ee0-0e8c138ac2cf",
"conversion_id": "6542baa6-d61f-4d90-b832-ed929d9c0996",
"eta": 17,
"credit_estimate": 0.68,
"message": "",
"status": "IN_QUEUE"
}{
"success": false,
"error_code": "INSUFFICIENT_CREDITS",
"message": ""
}{
"success": false,
"error_code": "UNPROCESSABLE_CONTENT",
"message": ""
}{
"success": false,
"error_code": "INTERNAL_SERVER_ERROR",
"message": ""
}Body
application/json
- Option 1
- Option 2

