api:pbx:audio:tts
Table of Contents
API : PBX : Audio Text to speech
Introduction
This request will generate audio based on a voice and text to be spoken by the text-to-speech engine.
Request
| URL | https://api.telecomx.dk/pbx/audio/tts | ||
|---|---|---|---|
| Method | POST | ||
| Access level | MANAGER or OWNER if user belongs to the customer the audio shall belong to. RESELLER if customer belongs to the reseller. RESELLER_ADMIN or ADMIN. |
||
| Property | Type | Description | |
| Body | engine | String | [optional] Which speech engine to use: ELEVEN_ML, ELEVEN_FLASH, ELEVEN_TURBO, ELEVEN_V3. Limits apply to usage. Defaults to ELEVEN_FLASH. |
| text | String | The text to speak, max. 3000 characters. | |
| voice | String | The voice to speak with - use Voices API to retrieve a list of available voices. | |
| language | String | [optional] The language of the text in ISO 639-1 format. Only applies to engines: ELEVEN_FLASH and ELEVEN_TURBO. If not set, it will be inferred from the voice. |
|
| speed | Number | [optional] Speaking speed - 70 (slow) → 120 (fast). Defaults to 100 (normal). |
|
| stability | Number | [optional] Randomness in generation, lower = more emotional, higher = more monotonous. 0 → 100, defaults to 50. |
|
| similarity | Number | [optional] How closely to the original should the voice be, 0 → 100, defaults to 75. |
|
| style | Number | [optional] This amplifies the style of the voice, 0 → 100, default to 0. |
|
| customer | Id | [optional] Id of customer the audio belongs to. Defaults to users customer. |
|
| employee | Id | [optional] Id of employee the audio belongs to, if the audio shall only be playable by the employee. |
|
| name | String | [optional] Name of the audio, defaults to the start of the text. |
|
| Engine | Description | Languages | Stream startup |
|---|---|---|---|
| ELEVEN_ML | Eleven Labs multilingual V2 | 29 | ~1000ms |
| ELEVEN_TURBO | Eleven Labs turbo V2.5 | 32 | ~500ms |
| ELEVEN_FLASH | Eleven Labs flash V2.5 | 32 | ~350ms |
| ELEVEN_V3 | Eleven Labs V3 | 70+ | ~2000ms - 9500ms |
Request body example
{
voice: '138hdr30efnjvhi0njovd',
text: 'Welcome to our company. Press 1 for sales, press 2 for support, or press 3 for accounting',
customer: '123457890123457890AAAA',
name: 'Default greeting message'
}
Response
The created audio item.
| Json object | ||
|---|---|---|
| _id | Id | Unique id of the audio. |
| customer | Id | Id of customer the audio belongs to. |
| usedBy | Array | Array of id's of the dialplan items that uses it. |
| name | String | Name/description of the audio. |
| length | Number | Length in seconds. |
| employee | Id | Optional id of employee the audio belongs to and can be used/seen by. |
Note that properties holding no value may be omitted from the object.
Example
{ _id: '1234567890123457890ABCD', customer: '12345678901234567890CCCC', usedBy: ['123457890123457890AAAA','12345678901234567890AAAB'], name: 'Welcome greeting 08:00-12:00', length: 15, employee: null }
Errors
| Error code | Message | Description |
|---|---|---|
| 404 | id | Audio not found |
| 404 | customer | Customer not found |
| 422 | message | Message is missing |
| 422 | voice | Selected voice not found |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |
api/pbx/audio/tts.txt · Last modified: 2025/09/15 13:29 by Per Møller