Skip to content

TTS Asynchronous Generation Documentation

Request URL and Headers

https://tts-api.dubbingx.com/

Note: All requests in this document use the POST method.

Common Request Headers

ParameterValue
AuthorizationBearer apiKey
Content-Typeapplication/json

apiKey is the user's API key. which can be generated in the client

1-1. Retrieve Voice List

/v1/getTTSTimbreList

Request Parameters

json
{"pageIndex":1,"pageSize":100}

Response

FieldDescription
idVoice ID
gradepremium for multilingual; ordinary for monolingual
gender0 for female; 1 for male;
voiceUrlURL for voice sample
json
{
    "code": 200,
    "success": true,
    "msg": "操作成功",
    "data": {
        "total": 1,
        "list": [
            {
                "id": "30002",
                "grade": "premium",
                "isOfficial": true,
                "name": "智吾褚",
                "description": "中青年  稳重   温暖",//Middle-aged, calm, warm
                "gender": 1,
                "avatar": "https://public.dubbingx.com/avatar/10092/20240329-143217.png",
                "voiceUrl": "https://public.dubbingx.com/audition/10092/mujin.wav",
                "status": true,
                "createTime": "2023-11-03 18:24:12"
            }
        ]
    },
    "time": "2024-04-10 16:24:55",
    "traceId": "1777976038257512450"
}

1-2. Analyze Emotion from Text (Optional)

/v2/analyzeEmotion

FieldDescription
textText content to be analyzed

Example Request:

json
{
	"text": "The weather is great today!!"
}

Response

FieldDescription
dataReturned emotion and level
json
{
  "code": 200,
  "success": true,
  "msg": "操作成功",
  "data": "开心-正常-3",//meanings Happy-Normal-3
  "time": "2024-09-02 11:23:05",
  "traceId": "1830446316581281793"
}

2.Send TTS Synthesis Command (Asynchronous Result)

/v2/addTtsTask

V2 version uses SSML format

FieldDescription
textSSML formatted string
SSML FiledDescription
voiceIdVoice ID obtained from getTTSTimbreList
emotionEmotion from emotion data url, each emotion has 5 levels. Do not pass for monolingual; leave empty for multilingual to support automatic emotion detection. Users need to concatenate and pass the emotion. First, take the outermost type, such as "常规"(Displayed in English as General); then take the second-level aura, such as "日常说话"(Displayed in English as Daily Talk); and finally, append the intensity, ranging from 1 to 5. The concatenated result will be similar to: 常规-日常说话-3
languagezh for Chinese, jp for Japanese, en for English, yue for Cantonese
audioPitchPitch, 1.0 is the original pitch, range from 0.7 to 1.3
audioSpeedSpeed, 1.0 is the original speed, range from 0.7 to 1.3
phonemePhoneme annotation, only supports Chinese, wrap a single character per annotation, multiple characters require multiple annotations. Format: <phoneme ph="duan2">段</phoneme>

Example Request:

json
{
    "text": "<speak voiceId=\"30065\" language=\"zh\" emotion=\"常规-日常说话-3\" audioPitch=\"1.1\" audioSpeed=\"1.1\">这是一<phoneme ph=\"duan2\">段</phoneme>测试音频!</speak>"
}

Response

FieldDescription
taskIdTask ID returned after successfully adding the task
json
{
    "code": 200,
    "success": true,
    "msg": "操作成功",//Operation successful
    "data": {
        "taskId": "1778319033905385473"
    },
    "time": "2024-04-11 15:07:52",
    "traceId": "1778319033238491137"
}

3.Retrieve Synthesis Status

v1/getTtsTaskInfo/${taskId}

Request Parameters Append taskId to the URL.

MeThod:POST

Response

FieldDescription
statusReady for synthesis, Transitioning, Completed ,Failed. When status is Completed, the fileUrl will return the synthesized audio download link.
json
{
    "code": 200,
    "success": true,
    "msg": "操作成功",
    "data": {
        "id": "1778319033905385473",
        "status": "Completed",
        "language": "zh",
        "fileName": "dce642383ca447b3ac4ed57cd3e5b2b4.wav",
        "fileUrl": "https://tts-bucket.dubbingx.com/10092/30002/dce642383ca447b3ac4ed57cd3e5b2b4.wav?Expires=1712849799&OSSAccessKeyId=LTAI5t8FMBqtNy467wQoCC3t&Signature=x7wCkhlQlCI8DPNdP8kLoPkvk0w%3D",
        "updateTime": "2024-04-11 15:07:59",
        "createTime": "2024-04-11 15:07:52"
    },
    "time": "2024-04-11 15:36:39",
    "traceId": "1778326277661331458"
}

3-1.Retrieve Synthesis Status in Batch

v1/getTtsTaskListInfo Request Body Raw: Json

json
["1778328789218971650","1778328790586314754","1778328790703755265","1778328790888304642"]

Example Response:

json
{
    "code": 200,
    "success": true,
    "msg": "操作成功",
    "data": [
        {
            "id": "1778328789218971650",
            "status": "Completed",
            "language": "zh",
            "fileName": "61a74e1801ef4984ac0c911e815efaa1.wav",
            "fileUrl": "",
            "updateTime": "2024-04-11 15:46:43",
            "createTime": "2024-04-11 15:46:38"
        },
        {
            "id": "1778328790586314754",
            "status": "Completed",
            "language": "zh",
            "fileName": "eb80e60b17bc457db8e37fe0051fd020.wav",
            "fileUrl": "",
            "updateTime": "2024-04-11 15:46:46",
            "createTime": "2024-04-11 15:46:38"
        },
        {
            "id": "1778328790703755265",
            "status": "Completed",
            "language": "zh",
            "fileName": "e74b9d83d1134aafb1b82a9626166756.wav",
            "fileUrl": "",
            "updateTime": "2024-04-11 15:46:48",
            "createTime": "2024-04-11 15:46:38"
        },
        {
            "id": "1778328790888304642",
            "status": "Completed",
            "language": "zh",
            "fileName": "52ec6be56d2346a6a9847553d51c5094.wav",
            "fileUrl": "",
            "updateTime": "2024-04-11 15:46:51",
            "createTime": "2024-04-11 15:46:38"
        }
    ],
    "time": "2024-04-11 15:47:43",
    "traceId": "1778329063622889474"
}

For Business Inquiries and Discounts, Please Contact

Manager Liao: +86-18758246772, liaowenguo@dubbingx.com

Manager Huang: +86-13091911143, huangbai@dubbingx.com

Manager Peirong: +86-13645716337, huangpeirong@dubbingx.com

版权所有© 智声悦合(杭州)科技有限公司