Text to Speech - Uplift AI API Docs

Convert text to speech

JavaScript

{
  "voiceId": "v_8eelc901",
  "text": "سلام، آپ اِس وقت اوریٹر کی آواز سن رہے ہیں۔",
  "outputFormat": "MP3_22050_128",
}
curl --request POST \
  --url https://api.upliftai.org/v1/synthesis/text-to-speech \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "phraseReplacementConfigId": "<string>"
}
'
import requests

url = "https://api.upliftai.org/v1/synthesis/text-to-speech"

payload = {
    "text": "<string>",
    "phraseReplacementConfigId": "<string>"
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.upliftai.org/v1/synthesis/text-to-speech",\
  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' => '<string>',\
    'phraseReplacementConfigId' => '<string>'\
  ]),\
  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.upliftai.org/v1/synthesis/text-to-speech"

payload := strings.NewReader("{\n  \"text\": \"<string>\",\n  \"phraseReplacementConfigId\": \"<string>\"\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.upliftai.org/v1/synthesis/text-to-speech")
  .header("Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"text\": \"<string>\",\n  \"phraseReplacementConfigId\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.upliftai.org/v1/synthesis/text-to-speech")

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\": \"<string>\",\n  \"phraseReplacementConfigId\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body

Authorizations

Body

Response