🚀 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
Monitors the progress of a Translated Text-to-Speech task using the provided task_id.
curl --request GET \
--url https://client.camb.ai/apis/translated-tts/{task_id} \
--header 'x-api-key: <api-key>'{
"status": "SUCCESS",
"run_id": 123
}This endpoint enables you to track the status of your Translated Text-to-Speech requests. When you submit content for translation and audio generation, our system processes both operations as a unified background task. This endpoint provides detailed visibility into this combined process, allowing you to determine when your translated audio will be ready for use.Documentation Index
Fetch the complete documentation index at: https://docs.camb.ai/llms.txt
Use this file to discover all available pages before exploring further.
GET request to this endpoint with the task_id you received during your initial submission. The system will return comprehensive information about the current stage of processing for both the translation and audio generation components.
run_id necessary to access your translated text and generated audio file.| Status | Meaning | Recommended Action |
|---|---|---|
SUCCESS | Both translation and audio generation have completed successfully | Retrieve your translated text and audio using the provided IDs |
PENDING | Your request is actively being processed | Continue monitoring at reasonable intervals |
TIMEOUT | Processing exceeded the maximum allowed duration | Consider breaking your content into smaller segments |
ERROR | A system-level issue occurred during processing | Check error details for specific information about what went wrong |
PAYMENT_REQUIRED | Your account has insufficient credits for this operation | Visit your account’s billing page to add more credits |
// Monitoring a Translated Text-to-Speech task with progressive polling
async function monitorTranslatedTTSTask(taskId, apiKey) {
console.log("Beginning task monitoring...");
// Initial configuration
let pollInterval = 10000; // Start with 10-second intervals
let attempts = 0;
const maxAttempts = 30;
while (attempts < maxAttempts) {
attempts++;
try {
// Request current task status
const response = await fetch(`https://client.camb.ai/apis/translated-tts/${taskId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey
}
});
if (!response.ok) {
throw new Error(`HTTP error ${response.status}`);
}
const statusData = await response.json();
console.log(`Status check #${attempts}: ${statusData.status}`);
// Adjust polling interval based on current stage
if (statusData.status === 'PENDING') {
console.log("Task is in progress...");
// Handle different status types
switch (statusData.status) {
case 'SUCCESS':
console.log("Task completed successfully!");
console.log(`Run ID: ${statusData.run_id}`);
return statusData; // Return the complete status object
case 'PENDING':
// Still processing, continue to next poll iteration
break;
case 'TIMEOUT':
console.error("Processing time exceeded. Consider shorter content segments.");
return null;
case 'ERROR':
console.error(`Processing error: ${statusData.error_message}`);
return null;
case 'PAYMENT_REQUIRED':
console.error("Insufficient credits. Please add more credits to your account.");
return null;
default:
console.error(`Unexpected status: ${statusData.status}`);
return null;
}
// Wait before next check
console.log(`Checking again in ${pollInterval/1000} seconds...`);
await new Promise(resolve => setTimeout(resolve, pollInterval));
} catch (error) {
console.error(`Error checking status: ${error.message}`);
return null;
}
}
console.error("Maximum monitoring attempts reached. Task may still be processing.");
return null;
}
SUCCESS status, you’ll receive a run_id for accessing both:
/tts-result/{run_id} endpoint./translation-result/{run_id} endpoint.The 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.
A unique identifier for the task. This is used to query the status of the translated text to speech task that is running. It is returned when a create request is made for translated text to speech.
curl --request GET \
--url https://client.camb.ai/apis/translated-tts/{task_id} \
--header 'x-api-key: <api-key>'{
"status": "SUCCESS",
"run_id": 123
}