Generate audio from text
curl --request POST \
--url https://api.instaview.sk/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, this is a test.",
"voice": "ALEX",
"language": "en"
}
'import requests
url = "https://api.instaview.sk/voice"
payload = {
"text": "Hello, this is a test.",
"voice": "ALEX",
"language": "en"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Hello, this is a test.', voice: 'ALEX', language: 'en'})
};
fetch('https://api.instaview.sk/voice', 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.instaview.sk/voice",
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 test.',
'voice' => 'ALEX',
'language' => 'en'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.instaview.sk/voice"
payload := strings.NewReader("{\n \"text\": \"Hello, this is a test.\",\n \"voice\": \"ALEX\",\n \"language\": \"en\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.instaview.sk/voice")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is a test.\",\n \"voice\": \"ALEX\",\n \"language\": \"en\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instaview.sk/voice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is a test.\",\n \"voice\": \"ALEX\",\n \"language\": \"en\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Voice
Generate Audio
Converts text to speech using AI-powered voices. Returns an audio stream in MP3 format.
POST
/
voice
Generate audio from text
curl --request POST \
--url https://api.instaview.sk/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, this is a test.",
"voice": "ALEX",
"language": "en"
}
'import requests
url = "https://api.instaview.sk/voice"
payload = {
"text": "Hello, this is a test.",
"voice": "ALEX",
"language": "en"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Hello, this is a test.', voice: 'ALEX', language: 'en'})
};
fetch('https://api.instaview.sk/voice', 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.instaview.sk/voice",
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 test.',
'voice' => 'ALEX',
'language' => 'en'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.instaview.sk/voice"
payload := strings.NewReader("{\n \"text\": \"Hello, this is a test.\",\n \"voice\": \"ALEX\",\n \"language\": \"en\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.instaview.sk/voice")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, this is a test.\",\n \"voice\": \"ALEX\",\n \"language\": \"en\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instaview.sk/voice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, this is a test.\",\n \"voice\": \"ALEX\",\n \"language\": \"en\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Converts text to speech using AI-powered voices. Returns an audio stream in MP3 format that can be played, downloaded, or integrated into applications.
Overview
The Text-to-Speech API allows you to generate natural-sounding speech from text in multiple languages and voices. This endpoint is useful for creating voice content, accessibility features, voice assistants, and more.Use Cases
- Voice Assistants: Generate spoken responses for chatbots and virtual assistants
- Accessibility: Create audio versions of text content for visually impaired users
- Content Creation: Produce voiceovers for videos, podcasts, or presentations
- E-Learning: Generate audio narration for educational materials
- IVR Systems: Create dynamic voice prompts for phone systems
Basic Usage
{
"text": "Hello, welcome to InstaView. We're excited to help you run AI-powered calls.",
"voice": "ALEX",
"language": "en"
}
Voice Options
The API supports 12 different voices with various characteristics:| Voice Name | Gender | Best For |
|---|---|---|
| ALEX | Male | Professional, clear delivery |
| PETER | Male | Warm, conversational tone |
| MIRIAM | Female | Professional, authoritative |
| SUE | Female | Friendly, approachable |
| VIERA | Female | Clear, neutral tone |
| CASANDRA | Female | Warm, engaging |
| SILVIA | Female | Professional, polished |
| MICHAEL | Male | Deep, authoritative |
| LUKE | Male | Energetic, dynamic |
| EMMA | Female | Clear, friendly |
| SARAH | Female | Warm, professional |
| EVA | Female | Neutral, versatile |
Language Support
The API supports 33 languages. Use the appropriate language code for your text:| Language | Code | Language | Code | Language | Code |
|---|---|---|---|---|---|
| English | en | Japanese | ja | Chinese | zh |
| German | de | Hindi | hi | French | fr |
| Korean | ko | Portuguese | pt | Italian | it |
| Spanish | es | Indonesian | id | Dutch | nl |
| Turkish | tr | Filipino | fil | Polish | pl |
| Swedish | sv | Bulgarian | bg | Romanian | ro |
| Arabic | ar | Czech | cs | Greek | el |
| Finnish | fi | Croatian | hr | Malay | ms |
| Slovak | sk | Danish | da | Tamil | ta |
| Ukrainian | uk | Russian | ru | Hungarian | hu |
| Norwegian | no | Vietnamese | vi |
Response Format
The endpoint returns an audio stream withContent-Type: audio/mpeg. You can:
- Stream directly: Play the audio in real-time
- Save to file: Download and store the MP3 file
- Integrate: Use in applications, websites, or phone systems
Example: Saving Audio (Node.js)
const fs = require('fs');
const response = await fetch('https://api.instaview.sk/v1/public/voice', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Hello, this is a test.',
voice: 'SARAH',
language: 'en'
})
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const buffer = await response.arrayBuffer();
fs.writeFileSync('output.mp3', Buffer.from(buffer));
Example: Playing Audio (Browser)
const response = await fetch('https://api.instaview.sk/v1/public/voice', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Hello, this is a test.',
voice: 'EMMA',
language: 'en'
})
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const blob = await response.blob();
const audioUrl = URL.createObjectURL(blob);
const audio = new Audio(audioUrl);
audio.play();
Example: Python
import requests
response = requests.post(
'https://api.instaview.sk/v1/public/voice',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'text': 'Hello, this is a test.',
'voice': 'MICHAEL',
'language': 'en'
}
)
response.raise_for_status()
with open('output.mp3', 'wb') as f:
f.write(response.content)
Text Limitations
The
text field has a maximum length of 5,000 characters. For longer content, split the text into multiple requests.Authentication & Scopes
This endpoint requires the VOICE scope. Ensure your API key has this scope enabled before making requests.
Error Handling
Common errors you may encounter:- 400 Bad Request: Invalid voice name or language code
- 401 Unauthorized: Missing or invalid API key
- 403 Forbidden: API key lacks VOICE scope
- 413 Payload Too Large: Text exceeds 5,000 characters
- 429 Too Many Requests: Rate limit exceeded
Rate Limiting
This endpoint is subject to your API key’s rate limits. Monitor the rate limit headers in the response:X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Time when the rate limit resets
Related Resources
API Keys Guide
Learn about API key management and scopes
Rate Limiting
Understand rate limits and best practices
Error Handling
Handle API errors gracefully
Scopes & Permissions
Learn about API key scopes
Authorizations
API key for authentication using Bearer scheme
Query Parameters
Required for ATS API keys to specify which company to access. Ignored for standard company API keys.
Body
application/json
The text to convert to speech
Maximum string length:
5000Example:
"Hello, this is a test."
The voice name to use for generation
Available options:
ALEX, PETER, MIRIAM, SUE, VIERA, CASANDRA, SILVIA, MICHAEL, LUKE, EMMA, SARAH, EVA Example:
"ALEX"
The language of the text
Available options:
en, ja, zh, de, hi, fr, ko, pt, it, es, id, nl, tr, fil, pl, sv, bg, ro, ar, cs, el, fi, hr, ms, sk, da, ta, uk, ru, hu, no, vi Example:
"en"
Response
Audio stream generated successfully
The response is of type file.