Updated on 2025-12-05 GMT+08:00

Creating a Flow

Function

Creates a flow.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

live:ott:createFlow

Write

-

-

-

-

URI

POST /v1/{project_id}/flows

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see "Obtaining a Project ID".

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Request time. This parameter is mandatory for AK/SK authentication.

X-Project-Id

No

String

Project ID. This parameter is mandatory for AK/SK authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Flow name

region

Yes

String

Region

sources

Yes

Array of FlowSource objects

Input information

Table 4 FlowSource

Parameter

Mandatory

Type

Description

source_listener_address

No

String

Ingest URL

source_listener_port

No

Integer

Port that pulls streams. 2077 and 2088 are not allowed.

stream_id

No

String

streamid of SRT stream pull

min_latency

No

Integer

Minimum latency, in millisecond.

cidr_whitelist

No

Array of strings

CIDR IP whitelist for stream push

description

No

String

Description

protocol

Yes

String

Protocol. The value can be srt-caller or srt-listener.

name

Yes

String

Input resource name

decryption

No

FlowSourceDecryption object

Flow decryption information in StreamConnect.

health_status

No

String

Status of stream push to a third party through SRT. The options are CONNECTED (stream push ongoing) and DISCONNECTED (stream push interrupted).

Table 5 FlowSourceDecryption

Parameter

Mandatory

Type

Description

algorithm

No

String

Encryption algorithm. The value can be aes128 (AES-128), aes192 (AES-192), or aes256 (AES-256).

key_type

Yes

String

Key type. The value can be speke (obtaining keys using the SPEKE protocol), static-key (static key), or srt-password (SRT key).

Currently, only srt-password is supported.

passphrase

Yes

String

SRT decryption key, which is used by a flow to decrypt SRT streams.

Response Parameters

Status code: 201

Table 6 Response body parameters

Parameter

Type

Description

flow

FlowDetailRespBody object

Flow information

Table 7 FlowDetailRespBody

Parameter

Type

Description

name

String

Flow name

region

String

Region

sources

Array of FlowSource objects

Input information

status

String

Status

flow_id

String

Flow ID

outputs

Array of FlowOutput objects

Flow output information

Table 8 FlowSource

Parameter

Type

Description

source_listener_address

String

Ingest URL

source_listener_port

Integer

Port that pulls streams. 2077 and 2088 are not allowed.

stream_id

String

streamid of SRT stream pull

min_latency

Integer

Minimum latency, in millisecond.

cidr_whitelist

Array of strings

CIDR IP whitelist for stream push

description

String

Description

protocol

String

Protocol. The value can be srt-caller or srt-listener.

name

String

Input resource name

decryption

FlowSourceDecryption object

Flow decryption information in StreamConnect.

health_status

String

Status of stream push to a third party through SRT. The options are CONNECTED (stream push ongoing) and DISCONNECTED (stream push interrupted).

Table 9 FlowSourceDecryption

Parameter

Type

Description

algorithm

String

Encryption algorithm. The value can be aes128 (AES-128), aes192 (AES-192), or aes256 (AES-256).

key_type

String

Key type. The value can be speke (obtaining keys using the SPEKE protocol), static-key (static key), or srt-password (SRT key).

Currently, only srt-password is supported.

passphrase

String

SRT decryption key, which is used by a flow to decrypt SRT streams.

Table 10 FlowOutput

Parameter

Type

Description

name

String

Name

type

String

Type

Status code: 400

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Requests

https://{endpoint}/v1/{project_id}/flows

{
  "name" : "test_caller",
  "region" : "cn-north-5",
  "sources" : [ {
    "source_listener_address" : "srt://100.10.10.10",
    "source_listener_port" : 5000,
    "stream_id" : "",
    "min_latency" : 2000,
    "cidr_whitelist" : [ "0.0.0.0/32" ],
    "description" : "test_caller",
    "protocol" : "srt-caller",
    "name" : "gzztest_caller",
    "decryption" : {
      "algorithm" : "aes256",
      "key_type" : "srt-password",
      "passphrase" : "*******"
    }
  } ]
}

Example Responses

Status code: 201

Response indicating successful flow creation

{
  "flow" : {
    "name" : "test_caller",
    "region" : "cn-north-5",
    "sources" : [ {
      "description" : "test_caller",
      "min_latency" : 2000,
      "source_listener_port" : 5000,
      "source_listener_address" : "srt://100.11.10.10",
      "cidr_whitelist" : [ "0.0.0.0/32", "192.168.0.1/16" ],
      "protocol" : "srt-caller",
      "name" : "test_caller",
      "decryption" : {
        "algorithm" : "aes256",
        "key_type" : "srt-password",
        "passphrase" : "******"
      }
    } ],
    "flow_id" : "fcbc63d1-06d8-47ba-8fd9-cd0096b72f6d",
    "status" : "STANDBY"
  }
}

Status code: 400

Response indicating failed flow creation

{
  "error_code" : "LIVE.103011018",
  "error_msg" : "The resource to create is already exists"
}

Status Codes

Status Code

Description

201

Response indicating successful flow creation

400

Response indicating failed flow creation

Error Codes

See Error Codes.