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

Creating a Pipeline With a Template

Function

This API is used to create a pipeline using a template.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{project_id}/api/pipeline-templates/{template_id}/create-pipeline

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

template_id

Yes

String

Definition:

Template ID, which is the unique identifier of a template. Obtain the template ID by calling the API for querying templates. templates.id indicates the template ID.

Constraints:

N/A

Value range:

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

Default value:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

component_id

No

String

Definition:

Pipeline microservice ID.

Constraints:

N/A

Value range:

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

Default value:

N/A

Request Parameters

Table 3 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 4 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Parameter description:

Pipeline name.

Constraints:

N/A.

Value range:

The value can contain only letters, digits, hyphens (-), and underscores (_). The length is 1 to 128 characters.

Default value:

N/A.

description

No

String

Parameter description:

Pipeline description.

Constraints:

N/A

Value range:

Max. 1024 characters.

Default value:

N/A

is_publish

Yes

Boolean

Definition:

Whether the pipeline is a change-triggered pipeline.

Constraints:

N/A

Value range:

  • true: The pipeline is a change-triggered pipeline.

  • false: The pipeline is not a change-triggered pipeline.

Default value:

N/A

sources

Yes

Array of CodeSource objects

Parameter description:

Pipeline source list.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

variables

No

Array of variables objects

Parameter description:

Pipeline parameter list.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 5 CodeSource

Parameter

Mandatory

Type

Description

type

No

String

Definition:

Pipeline source type.

Constraints:

N/A

Range:

  • code: code repository.

  • artifact: artifact repository.

Default value:

N/A

params

No

params object

Parameter description:

Pipeline source parameters, including details about the pipeline source.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 6 params

Parameter

Mandatory

Type

Description

git_type

No

String

Definition:

Code repository type.

Constraints:

N/A

Value range:

  • CodeArts Repo.

  • Gitee.

  • GitHub.

  • GitCode.

  • GitLab.

Default value:

N/A

codehub_id

No

String

Parameter description:

CodeArts Repo code repository ID.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

endpoint_id

No

String

Parameter description:

Code source endpoint ID.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

default_branch

No

String

Parameter description:

Default branch.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

git_url

No

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.

ssh_git_url

No

String

Parameter description:

ssh_git address, for example, https://example.com/CloudPipelinezycs00001/2000.git.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

web_url

No

String

Parameter description:

Web page URL.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

repo_name

No

String

Parameter description:

Pipeline source name.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

alias

No

String

Definition:

Code repository alias.

Constraints:

N/A

Value range:

Enter a maximum of 128 characters. Only letters, digits, and underscores (_) are supported.

Default value:

N/A

Table 7 variables

Parameter

Mandatory

Type

Description

name

No

AnyType

Parameter description:

Parameter name.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

sequence

No

Integer

Parameter description:

Parameter sequence number, which starts from 1 and increases in ascending order.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

type

No

String

Definition:

Parameter type.

Constraints:

N/A

Value range:

  • autoIncrement: auto-increment parameter.

  • enum: enumerated parameter.

  • string: string parameter.

Default value:

N/A

value

No

String

Parameter description:

Parameter value.

Constraints:

N/A

Value range:

Max. 8192 characters.

Default value:

N/A

is_secret

No

Boolean

Definition:

Private parameter or not.

Constraints:

N/A

Value range:

  • true: The parameter is private.

  • false: The parameter is not private.

Default value:

false.

description

No

String

Definition:

Parameter description.

Constraints:

N/A

Value range:

Max. 512 characters.

Default value:

N/A

is_runtime

No

Boolean

Definition:

Whether a parameter can be set at runtime.

Constraints:

N/A

Value range:

  • true: The parameter can be set at runtime.

  • false: The parameter cannot be set at runtime.

Default value:

false.

is_reset

No

Boolean

Definition:

Whether to reset. If the auto-increment parameter is edited, the edited value is used. Otherwise, the last digit increases.

Constraints:

N/A

Value range:

  • true: Use the edited parameter value.

  • false: Use the auto-increment parameter.

Default value:

false.

latest_value

No

String

Definition:

Value of the parameter in the last run.

Constraints:

N/A

Value range:

Max. 8,192 characters.

Default value:

N/A

limits

No

Array of strings

Parameter description:

List of enumerated values.

Constraints:

N/A.

Value range:

Up to 1,024 characters.

Default value:

N/A.

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

pipeline_id

String

Definition:

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

Value range:

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

Example Requests

Create a pipeline based on a template.

Set the pipeline name to New pipeline-2023041516464511, code repository to test001.git, and default branch to master.

POST https://{endpoint}/v5/54f90b75fc1447b1b65e8d3a9f77923d/api/pipeline-templates/434d660a96de423a935a0571c2223bca/create-pipeline

{
  "name" : "New Pipeline - 2023041516464511",
  "description" : "",
  "is_publish" : false,
  "sources" : [ {
    "type" : "code",
    "params" : {
      "git_type" : "codehub",
      "codehub_id" : "2111717853",
      "endpoint_id" : "",
      "default_branch" : "master",
      "git_url" : "https://example.com/cjrTest00002/test001.git",
      "ssh_git_url" : "git@example.com:cjrTest00002/test001.git",
      "web_url" : "",
      "repo_name" : "test001",
      "alias" : ""
    }
  } ]
}

Example Responses

Status code: 200

OK

{
  "pipeline_id" : "ad6b7f66283a45be9c1f82b06c831e59"
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.