Developer Docs/Text to Speech API

Text to Speech API

Build Text to Speech integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

Overview

Convert text to natural-sounding speech using a library of built-in voices, or clone a custom voice from a short audio sample for consistent narration.

Primary Endpoint

POST/api/v1/video/send_tts

Generate text-to-speech audio

Request Parameters

NameTypeRequiredDescription
msgstringYesText content to convert to speech (1-3000 characters)
tts_idstringNoSystem voice ID (MongoDB ObjectId). Must provide either tts_id or user_voice_id.
user_voice_idstringNoCustom cloned voice ID (MongoDB ObjectId). Must provide either tts_id or user_voice_id.
countrystringNoLocale language part (e.g. 'en', 'zh', 'pt', 'ja'). Optional when using user_voice_id, defaults to 'en'. Combine with `region` to form locale like 'en-US'/'zh-CN'. Values should come from POST /api/v1/anchor/language_list (top-level `value`).
regionstringNoLocale region part (e.g. 'US', 'CN', 'BR', 'JP'). Optional when using user_voice_id, defaults to 'US'. Combine with `country` to form locale like 'en-US'/'zh-CN'. Values should come from POST /api/v1/anchor/language_list (child `value`).
speechRatenumberNoSpeech speed multiplier (0.5-2.0)
typeenum: turnstile | aliyun_captchaNoCaptcha type (required when captcha verification is needed)
turnstile_tokenstringNoCaptcha token (required when type is 'turnstile')
captchaVerifyParamstringNoCaptcha verification parameter (required when type is 'aliyun_captcha')

Request Example

curl -X POST "https://www.a2e.com.cn/api/v1/video/send_tts" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "msg": "Welcome. Let's start your AI journey.",
  "tts_id": "66dc3c1b7dc1f1c483cc5ab8",
  "user_voice_id": "66f1234567890abcdef12345",
  "country": "en",
  "region": "US",
  "speechRate": 1,
  "type": "turnstile",
  "turnstile_token": "0x4AAAAAAxxxxxxxxxxxxxxxxxx",
  "captchaVerifyParam": "xxxxxxxxxxxx"
}'

Related Endpoints

POST/api/v1/anchor/tts_list

List system voices (TTS presets)

POST/api/v1/anchor/language_list

List supported languages/regions for voices

POST/api/v1/anchor/voice_list

List available voices by country/region

GET/api/v1/anchor/voice_list

List available voices (GET)

POST/api/v1/video/send_tts

Generate text-to-speech audio

GET/api/v1/tts/preview/list

Get TTS preview list

DELETE/api/v1/tts/preview/{id}

Delete TTS preview record

POST/api/v1/userVoice/training

Start voice training

GET/api/v1/userVoice/trainingRecord

Get voice training records

GET/api/v1/userVoice/completedRecord

Get completed voice training records

DELETE/api/v1/userVoice/{_id}

Delete voice training record

GET/api/v1/userVoice/{_id}

Get voice training record detail

PUT/api/v1/userVoice/{_id}

Update voice training record name

Responses

200

Text-to-speech generation successful

400

Invalid request parameters

401

Unauthorized - Invalid or missing bearer token