Create streaming key

Updated

Creates a streaming key for Media Gateway ingress streaming.

posthttps://api.agora.io/{region}/v1/projects/{appId}/rtls/ingress/streamkeys

Create a key before streaming to ensure that the media stream is pushed to the correct channel and under the correct host ID.

Important

Keep the created streaming key secure to prevent unauthorized streaming to the channel.

Path Parameters

region#*string

Region for the streaming key or stream. Supported values are na for North America, eu for Europe, ap for Asia except mainland China, and cn for mainland China.

Important

Make sure that:

  • The region value is the same as for the input source stream.
  • The domain names for setting the region parameter and streaming are the same.
  • The region value is in lowercase.
Allowedna | eu | ap | cn
appId#*string

The app ID provided by Agora to each developer. After creating a project in Agora Console, you can get an app ID. The app ID is a unique identifier for a project.

Header Parameters

X-Request-ID#?string

The UUID (Universally Unique Identifier) of the request. After you pass in this field, the Agora server returns this field in the response header. It is recommended to assign X-Request-ID a value. If omitted, the Agora server automatically generates a UUID and returns it.

Example6d35d43f-f4c5-4b3a-9df4-8f0d7e1d5f0a

Request Body

application/json

settings#requiredobject

Important

To ensure a successful request, do not leave this field empty or set to null.

Response Body

application/json

application/json

application/json

Response schema

200application/json

The request succeeded and returned the created streaming key.

status#optionalstring

Request status. success means the request succeeds.

data#optionalobject
401application/json

The request failed. A 401 (Unauthorized) response status code means the request is not authorized.

status#optionalstring

Request status.

message#optionalstring

Description of why the request failed.

defaultapplication/json

The request failed. A 401 (Unauthorized) response status code means the request is not authorized.

status#optionalstring

Request status.

message#optionalstring

Description of why the request failed.

Response Headers

X-Request-ID#?string

The UUID (Universally Unique Identifier) of the request. The value is in the X-Request-ID response header. If a request error occurs, print the value in the log to troubleshoot the problem.

Status200Example6d35d43f-f4c5-4b3a-9df4-8f0d7e1d5f0a

Authorization

This endpoint requires authentication.

basicAuthhmacAuth

Request examples

curl --request POST \  --url https://api.sd-rtn.com/region/v1/projects/yourActualAppId/rtls/ingress/streamkeys \  --header 'Accept: application/json' \  --header 'Authorization: Basic <Base64EncodedCredentials>' \  --header 'Content-Type: application/json' \  --header 'X-Request-ID: <UniqueRequestID>' \  --data '{  "settings": {    "channel": "shx001",    "uid": "1001",    "expiresAfter": 0  }}'

Response example

{  "status": "success",  "data": {    "streamKey": "2dfMTR****fys",    "channel": "shx001",    "uid": "1001",    "expiresAfter": 0,    "createdAt": "1686820170"  }}
{  "status": "error",  "message": "Describes why the request failed."}
{  "status": "error",  "message": "Describes why the request failed."}