QueryOutboundTaskTtsVoiceList
Queries available TTS (text-to-speech) voice list and returns the voice ID, name, type, and preview URL. You can filter voices by gender and language. Use this API to select a voice for the Raascall when creating an outbound scenario or task.
Prerequisites
-
The SDK is installed.
-
An AccessKey has been obtained and configured. For more information, see Obtain an AccessKey and configure it to environment variables.
Request parameters
|
Name |
Type |
Required |
Description |
Example |
|
Action |
String |
Yes |
The operation to perform. Set the value to QueryOutboundTaskTtsVoiceList. |
QueryOutboundTaskTtsVoiceList |
|
Version |
String |
Yes |
The API version. Format: YYYY-MM-DD. Set the value to 2025-11-27. |
2025-11-27 |
|
VoiceType |
String |
No |
The voice gender. Valid values: MALE and FEMALE. |
FEMALE |
|
Language |
String |
No |
The voice language, such as ZH_CN and EN_US. |
ZH_CN |
Response parameters
|
Name |
Type |
Description |
Example |
|
RequestId |
String |
The request ID. |
xxxx-xxxx-xxxx |
|
Success |
Boolean |
Indicates whether the request was successful. |
True |
|
Code |
String |
The error code. Empty when the request is successful. |
None |
|
Message |
String |
The error message or success message. |
Operation succeeded |
|
Data |
Array |
The returned data, including VoiceId, VoiceName, VoiceType, Language, and PreviewUrl. For more information, see the following parameter description. |
Examples
Python
import json
import os
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
def main():
config = open_api_models.Config(
access_key_id=os.getenv("ACCESS_KEY_ID"),
access_key_secret=os.getenv("ACCESS_KEY_SECRET"),
)
config.endpoint = "thirdswaicall.aliyuncs.com"
config.protocol = "HTTPS"
client = OpenApiClient(config)
params = open_api_models.Params(
style="RPC",
version="2025-11-27",
action="QueryOutboundTaskTtsVoiceList",
method="POST",
pathname="/",
protocol="HTTPS",
auth_type="AK",
req_body_type="json",
body_type="json",
)
body = {}
# body.update({'VoiceType': 'FEMALE', 'Language': 'ZH_CN'})
request = open_api_models.OpenApiRequest(query=OpenApiUtilClient.query(body))
runtime = util_models.RuntimeOptions(autoretry=True, max_attempts=3)
try:
resp = client.call_api(params, request, runtime)
print(json.dumps(resp.get("body", {}), ensure_ascii=False, indent=2))
except Exception as e:
print(f"调用失败: {e}")
if __name__ == "__main__":
main()
Java
import com.aliyun.teaopenapi.Client;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teaopenapi.models.OpenApiRequest;
import com.aliyun.teaopenapi.models.Params;
import com.aliyun.teautil.models.RuntimeOptions;
import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
public class Demo {
public static void main(String[] args) throws Exception {
// 初始化配置
Config config = new Config()
.setAccessKeyId(System.getenv("ACCESS_KEY_ID"))
.setAccessKeySecret(System.getenv("ACCESS_KEY_SECRET"))
.setEndpoint("thirdswaicall.aliyuncs.com")
.setProtocol("HTTPS");
Client client = new Client(config);
// 设置 API 参数
Params params = new Params()
.setStyle("RPC")
.setVersion("2025-11-27")
.setAction("QueryOutboundTaskTtsVoiceList")
.setMethod("POST")
.setPathname("/")
.setProtocol("HTTPS")
.setAuthType("AK")
.setReqBodyType("json")
.setBodyType("json");
// 构建请求参数
Map<String, Object> body = new HashMap<>();
// 根据实际需求添加请求参数
OpenApiRequest request = new OpenApiRequest()
.setQuery(com.aliyun.openapiutil.Client.query(body));
// 设置运行时选项(自动重试)
RuntimeOptions runtime = new RuntimeOptions()
.setAutoretry(true)
.setMaxAttempts(3);
try {
// 调用 API
Map<String, ?> response = client.callApi(params, request, runtime);
Gson gson = new Gson();
System.out.println(gson.toJson(response.get("body")));
} catch (Exception e) {
System.err.println("调用失败: " + e.getMessage());
}
}
}
Sample response
{
"Success": true,
"Code": null,
"Message": "操作成功",
"RequestId": "xxxx-xxxx-xxxx",
"Data": [
{
"VoiceId": "voice_001",
"VoiceName": "小云",
"VoiceType": "FEMALE",
"Language": "ZH_CN",
"PreviewUrl": "https://oss.aliyun.com/preview/voice_001.mp3"
}
]
}
The specific results are contained in the Data node. The following table describes the parameters in the Data node.
|
Name |
Type |
Description |
Example |
|
VoiceId |
String |
The voice ID. |
voice_001 |
|
VoiceName |
String |
The voice name. |
Xiaoyun |
|
VoiceType |
String |
The voice gender. Valid values: MALE and FEMALE. |
FEMALE |
|
Language |
String |
The language. |
ZH_CN |
|
PreviewUrl |
String |
The preview URL. |
https://oss.aliyun.com/preview/voice_001.mp3 |
Error codes
If an error occurs, see Error codes for troubleshooting.