Updated on 2026-01-12 GMT+08:00

Starting a Pipeline

Function

This API is used to start a pipeline.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{project_id}/api/pipelines/{pipeline_id}/run

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

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

pipeline_id

Yes

String

Definition:

Pipeline ID. Obtain the ID by calling the API for querying pipelines. pipelines.pipelineId indicates the pipeline ID.

Constraints:

N/A

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

User token. Obtain a token (the value of the X-Subject-Token response header) by calling the IAM API for .

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

sources

No

Array of sources objects

Parameter description:

Code source information list.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

description

No

String

Definition:

Pipeline running description.

Constraints:

N/A

Value range:

Max. 1,024 characters.

Default value:

N/A

variables

No

Array of variables objects

Definition:

Custom parameters.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

choose_jobs

No

Array of strings

Parameter description:

Pipeline jobs selected to run.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

choose_stages

No

Array of strings

Parameter description:

Selected pipeline stages. The priority is higher than that of choose_jobs. That is, if a stage is not selected, jobs (selected in choose_jobs) under this stage are ignored.

Constraints:

N/A.

Value Range:

N/A.

Default value:

N/A.

Table 4 sources

Parameter

Mandatory

Type

Description

type

Yes

String

Definition:

Pipeline source type. Currently, code and artifact are supported.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

params

No

params object

Definition:

Pipeline source parameters.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 5 params

Parameter

Mandatory

Type

Description

git_type

Yes

String

Definition:

Code repository type.

Constraints:

N/A

Value range:

  • CodeArts Repo.

  • Gitee.

  • GitHub.

  • GitCode.

  • GitLab.

Default value:

N/A

alias

No

String

Parameter description:

Code repository alias. The alias is user-defined and is used to distinguish system parameters when there are multiple repositories. For example, A_REPO_COMMIT_ID, B_REPO_COMMIT_ID.

Constraints:

N/A.

Value Range:

N/A.

Default value:

N/A.

codehub_id

No

String

Definition:

ID of a CodeArts Repo repository. You can obtain the ID by calling the API for querying a code repository.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

default_branch

No

String

Parameter description:

Default branch of the code repository for pipeline execution.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

git_url

Yes

String

Parameter description:

HTTPS address of the Git repository, for example, https://example.com/CloudPipelinezycs00001/2000.git.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

endpoint_id

No

String

Definition:

Code source endpoint ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

build_params

No

build_params object

Definition:

Pipeline build parameters.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

change_request_ids

No

Array of strings

Definition:

Change IDs of the change-triggered pipeline.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 6 build_params

Parameter

Mandatory

Type

Description

build_type

Yes

String

Definition:

Code repository trigger type. The options include branch (triggered by a branch) and tag (triggered by a tag).

Constraints:

N/A

Value range:

N/A

Default value:

N/A

event_type

No

String

Definition:

Pipeline trigger mode.

  • Manual: triggered manually.

  • Scheduler: triggered by a scheduled task.

  • MR: triggered by an MR.

  • Push: triggered by a push event.

  • CreateTag: triggered by a tag.

  • Issue: triggered by an issue.

  • Note: triggered by a comment.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

target_branch

No

String

Parameter description:

Branch that triggers the pipeline execution.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

tag

No

String

Parameter description:

Tag for triggering a pipeline.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 7 variables

Parameter

Mandatory

Type

Description

name

Yes

String

Parameter description:

Parameter name.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

value

Yes

String

Parameter description:

Parameter value.

Constraints:

N/A

Value range:

Max. 8192 characters.

Default value:

N/A

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

pipeline_run_id

String

Definition:

Pipeline run ID. The return value of the API for starting a pipeline is the pipeline run ID.

Value range:

The value consists of 32 characters, including only digits and letters.

Example Requests

Start a pipeline.

The specified branch is master, and the parameter is key:val.

POST https://{endpoint}/v5/54f90b75fc1447b1b65e8d3a9f77923d/api/pipelines/e5460d1d403146a1935c2d4b68ef506c/run

{
  "sources" : [ {
    "type" : "code",
    "params" : {
      "git_type" : "codehub",
      "codehub_id" : "2111699716",
      "default_branch" : "test-lbdsb11",
      "git_url" : "https://example.com/clsyz00001/111.git",
      "build_params" : {
        "build_type" : "branch",
        "event_type" : "Manual",
        "target_branch" : "test-lbdsb11"
      }
    }
  } ],
  "description" : "Pipeline running description.",
  "variables" : [ {
    "name" : "key",
    "value" : "val"
  } ],
  "choose_jobs" : [ "16772939480734f4abbc4-b3b9-4235-82c2-46559434cbd4" ]
}

Example Responses

Status code: 200

OK

{
  "pipeline_run_id" : "ad6b7f66283a45be9c1f82b06c831e59"
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.