All Products
Search
Document Center

:CreateRtcAsrTask

Last Updated:Mar 27, 2026

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

Operation description

This API is currently under maintenance. We recommend using a smart workflow to implement this feature. For more information, see Configure a smart workflow.

QPS limit

The QPS (queries per second) limit for this API is 20 for each user. API calls that exceed this limit are throttled, which may disrupt your service. Call this API at a reasonable rate to prevent service disruptions.

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 ID of the region.

cn-shanghai

Mode

string

Yes

The stream type. Valid values: live and rtc. The value live indicates a standard live stream, such as a stream ingested over Real-Time Messaging Protocol (RTMP).

live

SDKAppID

string

No

The ARTC application ID.

Note

This parameter is required and takes effect only when Mode is set to rtc.

appId

ChannelID

string

No

The channel ID.

Note

This parameter is required and takes effect only when Mode is set to rtc.

channelId

RtcUserId

string

No

The ID of the user publishing the audio stream.

Note

This parameter is required and takes effect only when Mode is set 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 when Mode is set to live.

rtmp://xxx

Language

string

Yes

The source language of the audio stream. Valid values:

  • ja: Japanese

  • yue: Cantonese

  • fspk: Mixed Mandarin and English

  • en: English

  • cn: Mandarin

cn

CallbackURL

string

Yes

The URL to receive transcription results.

http://xxx.com

AuthKey

string

No

The key for generating the callback MD5 signature.

Note

During callbacks, two headers are added to the request for authentication: SIG-TIME, which is the current timestamp, and ASR-SIG, which is the MD5 signature. The ASR-SIG is calculated as follows: 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 terminate the task if a stream interruption exceeds the AutoTerminateDelay. Default value: false.

true

AutoTerminateDelay

integer

No

The maximum duration of a stream interruption, in seconds, before the task is automatically terminated. This parameter applies only when AutoTerminateEnabled is set to true. Range: 1 to 10.

5

ReportInterval

integer

No

The interval for sending transcription results to your callback URL. Unit: milliseconds. Range: -1 to 500.

  • -1: Sends callbacks only for the final transcription of a complete sentence. No intermediate results are sent.

  • 0 or not specified: Sends callbacks in real time as transcription results are generated.

  • A value from 1 to 500: Sends callbacks periodically at the specified interval.

5

Sample callback

The service POSTs transcription results as a JSON request body to your callback URL. For details about the Content parameter and the callback process, see Interaction flow and implementation. The following is an example of a callback payload:

{
    "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 elements

Element

Type

Description

Example

object

Description

string

success if the request is successful; otherwise, an error message.

success

RequestId

string

The request ID.

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

RetCode

integer

2000 if the request is successful; other values indicate a failure.

2000

TaskId

string

The task ID.

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.