All Products
Search
Document Center

:CreateRtcAsrTask

Last Updated:Aug 14, 2025

Creates a live subtitle task to transcribe an audio stream to text in real time.

Operation description

This operation creates a real-time caption task to transcribe an audio stream into text.

QPS limits

The queries per second (QPS) limit for this operation is 20 for each account. API calls that exceed this limit are throttled. To prevent your business from being affected, call this operation at a reasonable rate.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

live:CreateRtcAsrTask

create

*Domain

acs:live:*:{#accountId}:domain/{#DomainName}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region ID.

cn-shanghai

Mode

string

Yes

The stream type. Valid values: live and rtc. The value live specifies a regular live stream, such as a Real-Time Messaging Protocol (RTMP) stream.

live

SDKAppID

string

No

The ID of the Alibaba Real-Time Communication (ARTC) application.

Note

This parameter is required and takes effect only if you set the Mode parameter to rtc.

appId

ChannelID

string

No

The channel ID.

Note

This parameter is required and takes effect only if you set the Mode parameter to rtc.

channelId

RtcUserId

string

No

The ID of the user who ingests the stream.

Note

This parameter is required and takes effect only if you set the Mode parameter to rtc. You can specify only one user ID.

user1

StreamURL

string

No

The streaming URL.

Note

This parameter is required and takes effect only if you set the Mode parameter to live.

rtmp://xxx

Language

string

Yes

The source language of the audio. Valid values:

  • ja: Japanese

  • yue: Cantonese

  • fspk: mixed Mandarin and English

  • en: English

  • cn: Mandarin

cn

CallbackURL

string

Yes

The callback URL.

http://xxx.com

AuthKey

string

No

The AuthKey that is used to generate the MD5 signature for callbacks.

Note

Two authentication fields are added to the request header for callbacks. "SIG-TIME" indicates the current timestamp. "ASR-SIG" indicates the MD5 authentication field. The "ASR-SIG" field is generated based on the following rule: md5(${SIG-TIME}/${callbackurl}/${authKey})

abcd

TranslateEnabled

boolean

No

Specifies whether to enable translation.

true

TargetLanguages

string

No

The target language for translation. Valid values:

  • cn: Chinese

  • en: English

  • ja: Japanese

en

AutoTerminateEnabled

boolean

No

Specifies whether to automatically shut down the task if the stream is interrupted for longer than the allowed latency. Default value: false.

true

AutoTerminateDelay

integer

No

The maximum duration of a stream interruption before the task is automatically shut down. Unit: seconds. Valid values: 1 to 10.

5

ReportInterval

integer

No

The interval for reporting callbacks. Unit: milliseconds. Valid values: -1 to 500.

  • -1: Callbacks are accepted only for complete sentences, not for intermediate results.

  • 0 or not set: Callback results are reported in real time.

  • A value less than or equal to 500: Callback results are reported at the specified interval.

5

Sample callbacks

The system sends an HTTP POST request to the specified callback URL. The request body contains data in JSON format. For more information about the Content parameter and the callback flow, see Interaction flow and implementation. The following code shows a sample callback:

{
    "task_id": "asr-cf8c70d7-3b8d-496c-98f8-4785******",
    "sdk_app_id": "",
    "channel_id": "",
    "rtc_user_id": "",
    "callback_time_stamp": 1723433155645,
    "language": "cn",
    "content": "{\"header\":{\"nls_task_id\":\"af95c5cc332549f689f3153bc9******\",\"task_key\":\"tl_2977564_17234*****\",\"namespace\":\"SpeechTranscriber\",\"name\":\"TranscriptionResultChanged\",\"task_id\":\"413937911b874146b5796******\",\"message_id\":\"abfc9e9994e748a38499e1******\",\"status_text\":\"Success.\",\"status\":20000000},\"payload\":{\"result\":\"Meeting with you all here\",\"confidence\":0.0,\"words\":[{\"startTime\":0,\"text\":\"Meeting\",\"endTime\":510},{\"startTime\":510,\"text\":\"with\",\"endTime\":1020},{\"startTime\":1020,\"text\":\"you all\",\"endTime\":1530},{\"startTime\":1530,\"text\":\"here\",\"endTime\":2040}],\"index\":0,\"time\":2040,\"fixed_result\":\"\",\"unfixed_result\":\"\",\"status\":0}}"
  }

Response parameters

Parameter

Type

Description

Example

object

Description

string

The result description. A value of success indicates that the request was successful. Otherwise, an error message is returned.

success

RequestId

string

The request ID.

7FF5417D-06E9-5A2C-9A70-581F6149E6C1

RetCode

integer

The status code. A value of 2000 indicates that the request was successful. Other values indicate that the request failed.

2000

TaskId

string

The ID of the task.

asr-a6ac15e0-9118-4b4c-9e64-306163a0****

Examples

Success response

JSON format

{
  "Description": "success",
  "RequestId": "7FF5417D-06E9-5A2C-9A70-581F6149E6C1",
  "RetCode": 2000,
  "TaskId": "asr-a6ac15e0-9118-4b4c-9e64-306163a0****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.