Updated on 2026-10-27 GMT+08:00

Creating a Function Flow

Function

This API is used to create a function flow.

Calling Method

For details, see Calling APIs.

Authorization Information

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

URI

POST /v1/{project_id}/ffs/graphs

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details, see Obtaining a Project ID.

Constraints

N/A.

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

x-cloud-service

No

String

User tags.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

id

No

String

Flow instance ID.

name

No

String

Name.

description

No

String

Description.

nodes

No

Array of GraphNode objects

nodes

edges

No

Array of GraphEdge objects

edges

constants

No

String

constants

label

No

String

label

enterprise_project_id

No

String

enterprise_project_id

merge_params

No

Boolean

merge_params

mode

No

String

mode

enable_stream_response

No

Boolean

Whether to return stream data.

express_config

No

ExpressConfig object

Definition

Express flow configuration items of FunctionGraph.

Constraints

Express flow configuration. This parameter is required when mode is set to EXPRESS.

Range

N/A.

Default Value

N/A.

Table 4 GraphNode

Parameter

Mandatory

Type

Description

id

No

String

ID

name

No

String

Name.

category

No

String

Category.

description

No

String

Description.

parent_node

No

String

parent_node

shape

No

Shape object

shape

position_x

No

Integer

position_x

position_y

No

Integer

position_y

execution_id

No

String

Execution ID.

incoming_edges

No

Array of strings

incoming_edges

outgoing_edges

No

Array of strings

outgoing_edges

Table 5 GraphEdge

Parameter

Mandatory

Type

Description

id

No

String

id

from

No

String

from

to

No

String

to

label

No

String

label

shape

No

Shape object

shape

Table 6 Shape

Parameter

Mandatory

Type

Description

geometry

No

String

geometry

style

No

String

style

Table 7 ExpressConfig

Parameter

Mandatory

Type

Description

log_level

No

String

Definition

Log level.

Range

  • ALL: all logs

  • ERROR: error logs

  • NONE: no logs

Response Parameters

Status code: 201

Table 8 Response body parameters

Parameter

Type

Description

id

String

Flow instance ID.

name

String

Name.

description

String

Description.

nodes

Array of GraphNode objects

nodes

edges

Array of GraphEdge objects

edges

domain_name

String

domain_name

domain_id

String

domain_id

project_id

String

project_id

workflow_id

String

workflow_id

workflow_run_id

String

workflow_run_id

created

String

Creation time (UTC), in the format yyyy-MM-ddTHH:mm:ssZ.

updated

String

Update time (UTC), in the format yyyy-MM-ddTHH:mm:ssZ.

task_status

String

task_status

error_info

OperateErrorResponse object

OperateErrorResponse

workflow_urn

String

workflow_urn

workflow_definition

WorkflowCreateBody object

Definition

Request body for creating a flow.

Range

N/A.

constants

String

constants

label

String

label

privilege

String

privilege

enterprise_project_id

String

enterprise_project_id

merge_params

Boolean

merge_params

mode

String

mode

express_config

ExpressConfig object

Definition

Express flow configuration items of FunctionGraph.

Range

N/A.

lts_group_id

String

lts_group_id

lts_stream_id

String

lts_stream_id

enable_stream_response

Boolean

Whether to return stream data.

Table 9 GraphNode

Parameter

Type

Description

id

String

ID

name

String

Name.

category

String

Category.

description

String

Description.

parent_node

String

parent_node

shape

Shape object

shape

position_x

Integer

position_x

position_y

Integer

position_y

execution_id

String

Execution ID.

incoming_edges

Array of strings

incoming_edges

outgoing_edges

Array of strings

outgoing_edges

Table 10 GraphEdge

Parameter

Type

Description

id

String

id

from

String

from

to

String

to

label

String

label

shape

Shape object

shape

Table 11 Shape

Parameter

Type

Description

geometry

String

geometry

style

String

style

Table 12 OperateErrorResponse

Parameter

Type

Description

graph_id

String

graph_id

error_detail

String

error_detail

Table 13 WorkflowCreateBody

Parameter

Type

Description

name

String

Definition

Name of a flow.

Range

1 to 64 characters

description

String

Definition

Flow description.

Range

1 to 512 characters

start

String

Definition

ID of the start node in a flow.

Range

1 to 256 characters

triggers

Array of Trigger objects

Definition

List of triggers in a flow.

Range

0 to 200 triggers

functions

Array of Function objects

Definition

List of functions in a flow.

Range

0 to 100 functions

states

Array of OperationState objects

Definition

List of nodes in a flow.

Range

1 to 100 nodes

constants

Object

Definition

Flow constant.

Range

N/A.

retries

Array of Retry objects

Definition

List of retry policies for a flow.

Range

0 to 200 policies

mode

String

Definition

Flow mode. The default mode is NORMAL.

Range

  • NORMAL: standard mode

  • EXPRESS: express mode

express_config

ExpressConfig object

Definition

Express flow configuration. This parameter is required when mode is set to EXPRESS.

enterprise_project_id

String

Definition

Enterprise project of a flow.

Range

0 to 64 characters

enable_stream_response

Boolean

Definition

Whether streaming response is supported.

Range

N/A.

Table 14 Trigger

Parameter

Type

Description

trigger_name

String

Definition

Trigger name.

Range

N/A.

trigger_type

String

Definition

Trigger type.

Range

  • FLOWTIMER: timer

  • SMN: SMN

  • APIG: API Gateway (shared)

  • APIG_DE: API Gateway (dedicated)

  • OBS: OBS

enabled

Boolean

Definition

Whether to enable the trigger.

Range

N/A.

trigger_config

OBSTriggerConfig object

Definition

OBS trigger configuration.

Range

N/A.

Table 15 OBSTriggerConfig

Parameter

Type

Description

bucket

String

Definition

OBS bucket name.

Range

N/A.

events

Array of strings

Definition

OBS event list.

Range

N/A.

prefix

String

Definition

OBS object name prefix.

Range

N/A.

suffix

String

Definition

OBS object name suffix.

Range

N/A.

Table 16 Function

Parameter

Type

Description

name

String

Definition

Function name, which must be unique in a flow.

Range

N/A.

operation

String

Definition

Function URN.

Range

N/A.

metadata

Object

Definition

Extended information about the function, which is customized by users.

Range

N/A.

Table 17 OperationState

Parameter

Type

Description

action_mode

String

Definition

Node execution mode.

Range

  • sequential: serial mode

  • parallel: parallel mode

actions

Array of Action objects

Definition

Node execution actions.

Range

N/A.

on_errors

Array of OnError objects

Definition

List of node execution error handling policies.

Range

N/A.

id

String

Definition

Node ID, which is unique in a flow.

Range

N/A.

name

String

Definition

Node name.

Range

N/A.

type

String

Definition

Node type list.

Range

  • Operation: operation node

  • Sleep: sleep node

  • End: end node

end

Boolean

Definition

Whether the node is an end node.

Range

N/A.

transition

String

Definition

ID of the next node.

Range

N/A.

state_data_filter

StateDataFilter object

Definition

Filter expression.

Range

N/A.

duration

Long

Definition

Waiting time, in seconds. This parameter is mandatory and valid only when the node type is Sleep.

Range

N/A.

Table 18 Action

Parameter

Type

Description

function_ref

FunctionRef object

Definition

Function invocation information.

Range

N/A.

Table 19 FunctionRef

Parameter

Type

Description

ref_name

String

Definition

Function reference name, which must be the same as the name in the outer functions.

Range

N/A.

invoke_mode

String

Definition

Function invocation mode. Currently, only synchronous invocation is supported.

Range

  • synchronize: synchronous invocation

  • asynchronous: asynchronous invocation

arguments

Object

Definition

Input parameter for function execution. Constants in constants can be referenced.

Definition format: parameter path | constant value/constant path

Parameter path: The JsonPath of the input parameter, for example, $.a.b[0].c.

The constant value can be of the numeric, string (enclosed in single quotation marks), or Boolean type.

The constant path is the JsonPath path of the constant, but the root node must be represented by $CONST, for example, $CONST.a.b.

Range

N/A.

Table 20 OnError

Parameter

Type

Description

error

String

Definition

Error matching expression, which is used to filter exceptions.

Range

N/A.

transition

String

Definition

ID of the next node.

Range

N/A.

retry_ref

String

Definition

Retry policy name.

Range

N/A.

Table 21 StateDataFilter

Parameter

Type

Description

input

String

Definition

Input filter expression (JSONPath).

Range

N/A.

output

String

Definition

Output filter expression (JSONPath).

Range

N/A.

Table 22 Retry

Parameter

Type

Description

name

String

Definition

Retry policy name, which must be unique in a flow.

Range

N/A.

delay

Long

Definition

Retry interval, in seconds. If the parameter is not set, the value is 1 by default.

Range

N/A.

max_attempts

Long

Definition

Maximum number of retry times. If this parameter is not set, the default value 3 is used.

Range

N/A.

Table 23 ExpressConfig

Parameter

Type

Description

log_level

String

Definition

Log level.

Range

  • ALL: all logs

  • ERROR: error logs

  • NONE: no logs

Status code: 400

Table 24 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

request_id

String

Request ID.

Status code: 500

Table 25 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

request_id

String

Request ID.

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

201

Created

400

Bad Request

500

Internal Server Error

Error Codes

See Error Codes.