π Introducing MARS8 Series β Four Powerful Variants | Available on All Major Clouds | Learn about the model here
π Introducing MARS8 Series β Four Powerful Variants | Available on All Major Clouds | Learn about the model here
Retrieves the results of multiple Text-to-Speech runs using a list of run_id values in a single request.
curl --request POST \
--url https://client.camb.ai/apis/tts-results \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"run_ids": [
12345,
6789
]
}
'{
"1234": {
"output_url": "https://audio-storage.camb.ai/files/audio_1234.flac"
},
"5678": {
"output_url": "https://audio-storage.camb.ai/files/audio_5678.flac"
}
}This endpoint streamlines the process of retrieving multiple completed audio files at once, perfect for applications that process batches of text-to-speech tasks. Instead of making individual requests for eachDocumentation Index
Fetch the complete documentation index at: https://docs.camb.ai/llms.txt
Use this file to discover all available pages before exploring further.
run_id, you can efficiently gather all your generated audio files in a single API call.
POST request to this endpoint with an array of run_id values in the request body. The system will process all your completed tasks and return URLs for each audio file, making it easy to download or reference them in your application.
run_id is mapped to its corresponding audio file URL.run_id values for the completed text-to-speech tasks you want to retrieve:
{
"run_ids": [12345, 12346, 12347, 12348]
}
{
"12345": "https://audio-storage.camb.ai/files/audio_12345.flac",
"12346": "https://audio-storage.camb.ai/files/audio_12346.flac",
"12347": "https://audio-storage.camb.ai/files/audio_12347.flac",
"12348": "https://audio-storage.camb.ai/files/audio_12348.flac"
}
import requests
# Your API authentication
headers = {
"x-api-key": "your-api-key", # Replace with your actual API key
"Content-Type": "application/json",
}
# List of run_ids from your completed TTS tasks (must be between 2-5 run_ids)
run_ids = [12345, 12346, 12347, 12348] # Replace with your actual run_ids
def get_bulk_audio_results(run_ids):
"""
Retrieves URLs for multiple completed TTS tasks in a single request.
Args:
run_ids: List of run_id values for completed TTS tasks (must be 2-5 items)
Returns:
dict: Dictionary mapping run_ids to their audio file URLs
"""
# Validate the number of run_ids
if len(run_ids) < 2 or len(run_ids) > 5:
print(
f"Error: Must provide between 2 and 5 run_ids. You provided {len(run_ids)}."
)
return {}
print(f"Retrieving audio URLs for {len(run_ids)} completed tasks...")
# Prepare the request payload
payload = {"run_ids": run_ids}
try:
# Make the POST request
response = requests.post(
"https://client.camb.ai/apis/tts-results",
headers=headers,
json=payload,
)
# Check if the request was successful
response.raise_for_status()
# Parse the response
results = response.json()
print(f"Successfully retrieved {len(results)} audio file URLs!")
return results
except requests.exceptions.RequestException as e:
print(f"Error retrieving bulk audio results: {e}")
return {}
# Retrieve all audio URLs
audio_urls = get_bulk_audio_results(run_ids)
# Process the results
for run_id, output_json in audio_urls.items():
print(f"Run ID {run_id}: {output_json.get('output_url')}")
run_id values per requestrun_id values per requestrun_id list into chunks of 2-5 itemsThe x-api-key is a custom header required for authenticating requests to our API. Include this header in your request with the appropriate API key value to securely access our endpoints. You can find your API key(s) in the 'API' section of our studio website.
An array of unique positive integers, each representing the ID of a specific run. You must provide between 2 and 5 IDs, and all IDs must correspond to the same run type (e.g., all text-to-speech or all dubbing runs).
2 - 5 elements[12345, 6789]Successful Response
An object containing the results of one to five text-to-speech (TTS) runs. Each key in the object is a unique identifier for a run, and the corresponding value is the Text-to-Speech run details.
curl --request POST \
--url https://client.camb.ai/apis/tts-results \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"run_ids": [
12345,
6789
]
}
'{
"1234": {
"output_url": "https://audio-storage.camb.ai/files/audio_1234.flac"
},
"5678": {
"output_url": "https://audio-storage.camb.ai/files/audio_5678.flac"
}
}