Create a browser ticket
curl --request POST \
--url https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets \
--header 'accessKey: <accesskey>'import requests
url = "https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets"
headers = {"accessKey": "<accesskey>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {accessKey: '<accesskey>'}};
fetch('https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets', 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.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"accessKey: <accesskey>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accessKey", "<accesskey>")
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.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets")
.header("accessKey", "<accesskey>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accessKey"] = '<accesskey>'
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"data": {
"ticketId": "<string>",
"sessionId": "<string>",
"streamUrl": "<string>",
"expiresInSeconds": 123,
"ticket": "<string>"
}
}Speech to Text
Create a browser ticket
Exchange the accessKey for a short-lived, single-use socket ticket.
POST
/
sound_clone
/
api
/
v1
/
stt
/
realtime
/
sessions
/
{sessionId}
/
tickets
Create a browser ticket
curl --request POST \
--url https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets \
--header 'accessKey: <accesskey>'import requests
url = "https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets"
headers = {"accessKey": "<accesskey>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {accessKey: '<accesskey>'}};
fetch('https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets', 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.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"accessKey: <accesskey>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accessKey", "<accesskey>")
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.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets")
.header("accessKey", "<accesskey>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.myvocal.ai/sound_clone/api/v1/stt/realtime/sessions/{sessionId}/tickets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accessKey"] = '<accesskey>'
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"data": {
"ticketId": "<string>",
"sessionId": "<string>",
"streamUrl": "<string>",
"expiresInSeconds": 123,
"ticket": "<string>"
}
}Issues a short-lived ticket for one owned session so a browser can open the socket without exposing
the long-lived key in a URL. The ticket is single-use and bound to the owner and the session; a
reconnect requests a fresh one. A replayed or expired ticket is refused at the handshake.
Path
string
required
The session to stream to.
Header
string
required
API key for this REST request. Keep it on your backend in customer-facing applications;
return only the session and ticket to the browser. Never put the API key in the socket URL.
Response
Successful REST calls return{ code: 1, message, data }. The fields below are inside data;
JSON downloads are the documented exception and return the transcript view directly.
number
1 for success.string
Result message.
object
const ticket = await rest('POST', `/sessions/${sessionId}/tickets`);
const url = new URL(apiBase + ticket.streamUrl);
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
url.searchParams.set('ticket', ticket.ticket);
const socket = new WebSocket(url);
