curl --location 'https://api.inworld.ai/lro/v1alpha/workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation}' \
--header "Authorization: Basic $INWORLD_API_KEY"import time
import requests
operation_name = "workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation}"
url = f"https://api.inworld.ai/lro/v1alpha/{operation_name}"
headers = {"Authorization": "Basic <api-key>"}
while True:
operation = requests.get(url, headers=headers).json()
if operation.get("done"):
break
time.sleep(5)
if "error" in operation:
raise RuntimeError(operation["error"]["message"])
result = operation["response"]
# Signed URLs: download WITHOUT an Authorization header.
audio = requests.get(result["audioUri"]).content
open("output.mp3", "wb").write(audio)const operationName =
'workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation}';
const url = `https://api.inworld.ai/lro/v1alpha/${operationName}`;
const headers = { Authorization: 'Basic <api-key>' };
let operation;
do {
await new Promise((r) => setTimeout(r, 5000));
operation = await (await fetch(url, { headers })).json();
} while (!operation.done);
if (operation.error) throw new Error(operation.error.message);
// Signed URLs: download WITHOUT an Authorization header.
const audio = await (await fetch(operation.response.audioUri)).arrayBuffer();{
"name": "workspaces/{workspace}/ttsAsyncJobs/8f14e45f-ceea-4673-93d8-04f724c8a1b2/operations/1784837936461-p0sEhU",
"done": false
}Get async operation
Poll the status of an asynchronous or batch synthesis job. Substitute the full operation name returned by the submitting endpoint (including its slashes) directly into the URL path. Poll at a modest interval (for example every 5 seconds): short inputs typically complete within seconds, while long inputs and large batches can take minutes.
curl --location 'https://api.inworld.ai/lro/v1alpha/workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation}' \
--header "Authorization: Basic $INWORLD_API_KEY"import time
import requests
operation_name = "workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation}"
url = f"https://api.inworld.ai/lro/v1alpha/{operation_name}"
headers = {"Authorization": "Basic <api-key>"}
while True:
operation = requests.get(url, headers=headers).json()
if operation.get("done"):
break
time.sleep(5)
if "error" in operation:
raise RuntimeError(operation["error"]["message"])
result = operation["response"]
# Signed URLs: download WITHOUT an Authorization header.
audio = requests.get(result["audioUri"]).content
open("output.mp3", "wb").write(audio)const operationName =
'workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation}';
const url = `https://api.inworld.ai/lro/v1alpha/${operationName}`;
const headers = { Authorization: 'Basic <api-key>' };
let operation;
do {
await new Promise((r) => setTimeout(r, 5000));
operation = await (await fetch(url, { headers })).json();
} while (!operation.done);
if (operation.error) throw new Error(operation.error.message);
// Signed URLs: download WITHOUT an Authorization header.
const audio = await (await fetch(operation.response.audioUri)).arrayBuffer();{
"name": "workspaces/{workspace}/ttsAsyncJobs/8f14e45f-ceea-4673-93d8-04f724c8a1b2/operations/1784837936461-p0sEhU",
"done": false
}Authorizations
Your authentication credentials. For Basic authentication, please populate Basic $INWORLD_API_KEY. You can create a key in one command with the Inworld CLI: inworld workspace add-key.
Path Parameters
Full operation resource name returned by the async or batch synthesis endpoint, in the format workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation} or workspaces/{workspace}/ttsBatchJobs/{batch}/operations/{operation}. The embedded slashes are part of the path.
Response
A successful response.
A google.longrunning.Operation tracking an asynchronous or batch synthesis job.
Server-assigned operation resource name, in the format workspaces/{workspace}/ttsAsyncJobs/{job}/operations/{operation} for async jobs or workspaces/{workspace}/ttsBatchJobs/{batch}/operations/{operation} for batch jobs. Pass it verbatim as the path of the Get operation endpoint to poll for completion.
"workspaces/{workspace}/ttsAsyncJobs/8f14e45f-ceea-4673-93d8-04f724c8a1b2/operations/1784837936461-p0sEhU"
Service-specific metadata associated with the operation. Not populated for TTS jobs yet; job metadata is planned for a later release, so do not write code that depends on this field staying absent.
Show child attributes
Show child attributes
If false, the job is still running. If true, the job has finished and exactly one of error or response is set.
Show child attributes
Show child attributes
Set when the job succeeded. Its @type identifies which kind: an async job carries SynthesizeSpeechAsyncResponse, a batch job SynthesizeSpeechBatchResponse.
- Option 1
- Option 2
Show child attributes
Show child attributes