Voices
List all supported voices for given language and dialect.
Request
GEThttps://api.fliki.ai/v1/voices
Headers
{
"Content-type": "application/json",
"Authorization": "Bearer API_KEY"
}
Key | Value | Description |
---|---|---|
Content-Type | application/json | Specifies that the request body format is JSON, allowing the server to parse the data correctly. |
Authorization | Bearer YOUR_API_KEY | Generate your API Key in the account/api. section and replace YOUR_API_KEY with your actual key. |
Query params
{
"languageId": String,
"dialectId": String
}
Key | Type | Description |
---|---|---|
languageId | string | Unique identifier for each language. |
dialectId | string | Unique identifier for each dialect within a language. |
Obtain languageId
via the languages endpoint. Obtain dialectId
via the dialects endpoint.
Response
[
{
"_id": String,
"name": String,
"gender": String,
"isUltra": String,
"audioSample": String,
"styles": Object,
},
]
Key | Type | Description |
---|---|---|
_id | string | Unique identifier for each voice. |
name | string | Name of the voice (e.g., “John”, “Emma”). |
gender | string | Gender of the voice (e.g., “male”, “female”). |
isUltra | string | Indicates if the voice is an “Ultra” realistic voice. |
audioSample | string | URL or path to the audio sample for the voice. |
styles | object | Object containing different voice styles or variations. |
Example
- Bash
- TypeScript
- Python
- Go
cURL Request
curl \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-X GET "https://api.fliki.ai/v1/voices?languageId=...&dialectId=..."
TypeScript Request
const apiKey = '<API_KEY>'; // Replace with your actual API key
const languageId = '...'; // Replace with your actual language ID
const dialectId = '...'; // Replace with your actual dialect ID
async function getVoices(apiKey: string, languageId: string, dialectId: string) {
const url = `https://api.fliki.ai/v1/voices?languageId=${encodeURIComponent(languageId)}&dialectId=${encodeURIComponent(dialectId)}`;
try {
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`Error: ${response.status} - ${response.statusText}`);
}
const data = await response.json();
console.log(data);
} catch (error) {
console.error('Error fetching voices:', error);
}
}
getVoices(apiKey, languageId, dialectId);
Python Request
import requests
api_key = "<API_KEY>"
language_id = "..." # Replace with your actual language ID
dialect_id = "..." # Replace with your actual dialect ID
url = "https://api.fliki.ai/v1/voices"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
params = {
"languageId": language_id,
"dialectId": dialect_id
}
response = requests.get(url, headers=headers, params=params)
print(response.json())
Go Request
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
apiKey := "<API_KEY>"
languageID := "..." // Replace with your actual language ID
dialectID := "..." // Replace with your actual dialect ID
url := "https://api.fliki.ai/v1/voices"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
q := req.URL.Query()
q.Add("languageId", languageID)
q.Add("dialectId", dialectID)
req.URL.RawQuery = q.Encode()
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}