> ## Documentation Index
> Fetch the complete documentation index at: https://docs.talkover.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Voice Template Demo

> Generate a demo audio file for a specific voice template

# Generate Voice Template Demo

Generate a demo audio file for a specific voice template. This endpoint creates a sample audio file that demonstrates how the voice template sounds, allowing you to test and evaluate voice templates before using them in your agents.

## Endpoint

```
GET /api/v1/voice-templates/{voice_template_id}/demo
```

## Path parameters

<ParamField path="voice_template_id" type="string" required>
  The unique identifier of the voice template. You can find this in the voice templates list.
</ParamField>

## Request headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication. Format: `Bearer talq_your_environment_token_here`
</ParamField>

## Example requests

<RequestExample>
  ```bash theme={null}
  # Request 1: Generate demo for a specific voice template
  curl -X GET "https://app.talkover.ai/api/v1/voice-templates/voice-template-uuid-1/demo" \
    -H "Authorization: Bearer talq_your_environment_token_here"
  ```

  ```javascript theme={null}
  // Request 1: Generate demo for a specific voice template
  const response = await fetch('https://app.talkover.ai/api/v1/voice-templates/voice-template-uuid-1/demo', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer talq_your_environment_token_here'
    }
  });

  const result = await response.json();
  console.log(result);
  ```
</RequestExample>

<RequestExample>
  ```bash theme={null}
  # Request 2: Generate demo with error handling
  curl -X GET "https://app.talkover.ai/api/v1/voice-templates/voice-template-uuid-1/demo" \
    -H "Authorization: Bearer talq_your_environment_token_here" \
    -w "\nHTTP Status: %{http_code}\n"
  ```

  ```javascript theme={null}
  // Request 2: Generate demo with error handling
  try {
    const response = await fetch('https://app.talkover.ai/api/v1/voice-templates/voice-template-uuid-1/demo', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer talq_your_environment_token_here'
      }
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const result = await response.json();
    console.log('Demo URL:', result.mp3_url);
  } catch (error) {
    console.error('Error generating demo:', error);
  }
  ```
</RequestExample>

## Response

### Success Response (200 OK)

<ResponseExample>
  ```json theme={null}
  {
    "mp3_url": "https://example.com/storage/demo-audio/signed-url-here.mp3"
  }
  ```
</ResponseExample>

### Response fields

<ResponseField name="mp3_url" type="string" required>
  A signed URL to the generated demo audio file in MP3 format. This URL is temporary and will expire.
</ResponseField>

## Error responses

### 404 Not Found

<ResponseExample>
  ```json theme={null}
  {
    "success": false,
    "message": "Voice template not found"
  }
  ```
</ResponseExample>

### 401 Unauthorized

<ResponseExample>
  ```json theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```
</ResponseExample>

### 500 Server Error

<ResponseExample>
  ```json theme={null}
  {
    "error": "Failed to generate demo audio"
  }
  ```
</ResponseExample>

## Error codes

| Code                       | Description                                | HTTP Status |
| -------------------------- | ------------------------------------------ | ----------- |
| `VOICE_TEMPLATE_NOT_FOUND` | Specified voice template does not exist    | 404         |
| `INVALID_TOKEN`            | Authentication token is invalid or missing | 401         |
| `DEMO_GENERATION_FAILED`   | Failed to generate demo audio              | 500         |

## Important notes

<Info>
  **Temporary URLs.** The demo audio URL is temporary and will expire after a certain time period.
</Info>

<Info>
  **Demo content.** The demo audio contains a sample text that showcases the voice template's capabilities.
</Info>

<Warning>
  **Generation time.** Demo audio generation may take a few seconds to complete.
</Warning>

## Related endpoints

* **List Voice Templates**: `GET /api/v1/voice-templates`
* **List Phone Numbers**: `GET /api/v1/phone-numbers`
