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

Creating a Pipeline

Function

This API is used to create a pipeline.

URI

POST /cpepipeline/v2/pipelines

Request

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Default value: application/json;charset=utf8.

X-Auth-Token

Yes

String

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Pipeline name.

description

No

String

Pipeline description.

version

No

Integer

Pipeline version.

stages

Yes

Array of objects

Stage. For details, see Table 3.

environments

No

Array of objects

Release environment. For details, see Table 3.

Table 3 stages and environments

Parameter

Mandatory

Type

Description

name

Yes

String

Stage name or release environment name.

approvalType

Yes

Integer

Approval type.

description

No

String

Description.

tasks

Yes

Array of objects

Task. For details, see Table 4.

Table 4 tasks

Parameter

Mandatory

Type

Description

name

Yes

String

Task name.

displayName

Yes

String

Display name.

input

No

Object

Input parameter. For details, see Table 5.

taskTypeId

Yes

Object

Task type. For details, see Table 6.

orderIndex

No

Integer

Task execution order.

output

No

Object

Output parameter.

Table 5 input

Parameter

Mandatory

Type

Description

assemblingId

No

String

Build task ID.

instanceId

No

String

Instance ID.

appName

No

String

Application name.

modifiedPath

No

String

Modified path.

version

No

String

Component version.

Table 6 taskTypeId

Parameter

Mandatory

Type

Description

category

Yes

String

Task directory.

owner

Yes

String

Task owner.

provider

Yes

String

Task provider.

Response

Table 7 Response parameters

Parameter

Type

Description

project

String

Project name.

domain

String

Tenant name.

id

String

Pipeline ID.

enterpriseProjectId

String

Enterprise project ID.

modelVersion

Integer

Pipeline type.

creator

String

Creator.

revisor

String

Reviser.

createdAt

Integer

Creation time.

createdAt

Integer

Update time.

failMode

String

Best effort policy.

strategyType

Integer

Trigger policy.

pipelineDeclaration

Object

Pipeline definition. For details, see Table 8.

Table 8 pipelineDeclaration

Parameter

Type

Description

name

String

Pipeline name.

modelVersion

Integer

Pipeline type.

version

Integer

Pipeline version.

stages

Array of objects

Pipeline stage. For details, see Table 9.

configMode

String

Pipeline creation type.

Table 9 stages

Parameter

Type

Description

id

String

Stage ID.

name

String

Stage name.

displayName

String

Stage display name.

type

String

Stage type.

pipelineId

String

Pipeline ID.

orderIndex

String

Stage execution sequence.

status

Integer

Stage status.

taskGroup

String

Task group.

tasks

Array of objects

Pipeline task. For details, see Table 10.

Table 10 tasks

Parameter

Type

Description

id

Integer

Task ID.

name

String

Task name.

displayName

String

Display name of a task.

input

Object

Task input parameter. For details, see Table 5.

output

Object

Task output parameter.

status

Integer

Task status.

orderIndex

Integer

Task execution order.

skipped

Boolean

Skip or not.

groupIndex

String

Task group to which a task belongs.

delayTime

Integer

Task execution delay.

errorDetails

String

Task error information.

stageName

String

Stage type.

taskTypeId

Object

Task type. For details, see Table 11.

Table 11 taskTypeId

Parameter

Type

Description

category

String

Task directory.

owner

String

Task owner.

provider

String

Task provider.

type

String

Task type.

Table 12 input

Parameter

Type

Description

assemblingId

String

Build task ID.

environment_id

String

Environment ID.

Example Request

Creating a pipeline

{
    "name": "asdxad",
    "description": "",
    "version": 1,
    "stages": [
        {
            "name": "Artifacts",
            "approvalType": 0,
            "tasks": [
                {
                    "name": "ghy-test-comp-0626-3-62e353",
                    "displayName": "Empty",
                    "input": {
                        "assemblingId": "audzvfrtnru94o8jtb9g38svx0rezi86rq43ff8m"
                    },
                    "taskTypeId": {
                        "category": "Build",
                        "owner": "System",
                        "provider": "Assembling"
                    },
                    "orderIndex": 0
                }
            ]
        },
        {
            "name": "Environments",
            "approvalType": 0,
            "tasks": [
                {
                    "name": "production",
                    "displayName": "echotest-nodel",
                    "orderIndex": 0,
                    "taskTypeId": {
                        "category": "Environment",
                        "owner": "System",
                        "provider": "Environment"
                    },
                    "input": {},
                    "output": {}
                }
            ]
        }
    ],
    "environments": [
        {
            "name": "production",
            "displayName": "echotest-nodel",
            "description": "",
            "tasks": [
                {
                    "name": "Deploy",
                    "taskTypeId": {
                        "category": "Deploy",
                        "owner": "System",
                        "provider": "ENV-CAS"
                    },
                    "input": {
                        "instanceId": "9c1fa25d-7e5a-4de4-bf3a-516b9650c2a0",
                        "appName": "ghy-test-0710-1",
                        "modifiedPath": "{\"ghy-test-0710-1\":\"${Artifacts_ghy-test-comp-0626-3-62e353_Output_release@PublishBuildImage}\"}",
                        "version": "2025.0710.11521"
                    },
                    "output": {},
                    "orderIndex": 0
                }
            ]
        }
    ]
}

Example Response

{
    "project": "cn-north-4",
    "domain": "hwstaff_pub_servicestagew3",
    "id": "c5a2abab-6c56-4b04-bb67-92470daef78f",
    "enterpriseProjectId": "0",
    "name": "testzasd",
    "enterpriseProject": "default",
    "modelVersion": 1,
    "creator": "zhangyuhao",
    "revisor": "zhangyuhao",
    "createdAt": 1753080263966,
    "updatedAt": 1753080263966,
    "failMode": "stop",
    "strategyType": 0,
    "pipelineDeclaration": {
        "name": "testzasd",
        "description": "",
        "modelVersion": 0,
        "version": 1,
        "stages": [
            {
                "id": 0,
                "name": "Artifacts",
                "approvalType": 0,
                "displayName": null,
                "type": null,
                "pipelineId": null,
                "orderIndex": 0,
                "status": null,
                "taskGroup": null,
                "tasks": [
                    {
                        "id": 0,
                        "name": "ghy-test-comp-0626-3-62e353",
                        "displayName": "Empty",
                        "taskTypeId": {
                            "category": "Build",
                            "owner": "System",
                            "provider": "Assembling",
                            "type": null
                        },
                        "input": {
                            "assemblingId": "audzvfrtnru94o8jtb9g38svx0rezi86rq43ff8m"
                        },
                        "output": {},
                        "status": null,
                        "orderIndex": 0,
                        "skipped": false,
                        "groupIndex": null,
                        "delayTime": 0,
                        "errorDetails": null,
                        "stageName": null
                    }
                ]
            },
            {
                "id": 0,
                "name": "Environments",
                "approvalType": 0,
                "displayName": null,
                "type": null,
                "pipelineId": null,
                "orderIndex": 0,
                "status": null,
                "taskGroup": null,
                "tasks": [
                    {
                        "id": 0,
                        "name": "production",
                        "displayName": "echotest-nodel",
                        "taskTypeId": {
                            "category": "Environment",
                            "owner": "System",
                            "provider": "Environment",
                            "type": null
                        },
                        "input": {
                            "environment_id": "6a67914f-8233-4a62-bd7c-5905bfde5df8"
                        },
                        "output": {},
                        "status": null,
                        "orderIndex": 0,
                        "skipped": false,
                        "groupIndex": null,
                        "delayTime": 0,
                        "errorDetails": null,
                        "stageName": null
                    }
                ]
            }
        ],
        "configMode": "ui"
    }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See ServiceStage Error Codes.