GET
/
text-to-voice
/
{task_id}
curl --request GET \
  --url https://client.camb.ai/apis/text-to-voice/{task_id} \
  --header 'x-api-key: <api-key>'
{
  "status": "SUCCESS",
  "run_id": 123
}

Track every stage of your voice generation process with millisecond precision. This endpoint provides real-time visibility into voice synthesis tasks, enabling seamless integration with time-sensitive applications like live narration systems and interactive voice interfaces.

This endpoint works in conjunction with the main /text-to-voice endpoint, which initiates the voice generation process and provides the essential task_id for status monitoring.

Monitoring Your Voice Generation

Implement intelligent status tracking with this Python example:

def monitor_voice_creation(task_id, poll_interval=5):
    """
    Advanced status tracking with automatic recovery suggestions
    """
    status_guidance = {
        "SUCCESS": {"icon": "✅", "action": "download_voice"},
        "PENDING": {"icon": "⏳", "action": "wait"},
        "TIMEOUT": {"icon": "⏰", "action": "retry_or_contact"},
        "ERROR": {"icon": "❌", "action": "review_inputs"},
        "PAYMENT_REQUIRED": {"icon": "💳", "action": "add_credits"}
    }

    while True:
        response = requests.get(f"/text-to-voice/{task_id}", headers=headers)
        status_data = response.json()
        current_status = status_data.get('status')

        # Get status metadata
        guidance = status_guidance.get(current_status, {})
        print(f"{guidance.get('icon', 'ℹ️')} Status: {current_status}")

        # Handle terminal states
        if current_status in ["SUCCESS", "TIMEOUT", "ERROR", "PAYMENT_REQUIRED"]:
            print(f"Error details: {status_data.get('message', 'Contact support')}")
            print(f"Recommended action: {guidance.get('action', 'contact_support')}")
            if current_status == "SUCCESS":
                print(f"\n🎉 Voice generation completed!")
                print(f"Production ID: {status_data.get('run_id')}")
            return status_data

        time.sleep(poll_interval)

This polling mechanism gives you flexibility to build applications that can provide real-time feedback to users about their voice from description creations. You can adjust the polling interval based on your specific needs, checking more frequently for time-sensitive applications or less frequently for background tasks.

Next Steps

Once your task shows a status of SUCCESS, you’ll receive a run_id in the response. This run_id is your key to accessing the generated sample audio files for the voices. Take this identifier and use it with the /text-to-voice-result/{run_id} endpoint to download your the sample voices, select the one that matches your desired characteristics and put it to work in your application.

Authorizations

x-api-key
string
header
required

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.

Path Parameters

task_id
string
required

This parameter represents a unique identifier for a task. It is used in various API endpoints to query the status or result of a specific task. The task_id is typically returned when a task is created.

Response

200
application/json

Successful response

The response is of type object.