Use this API to trigger pipelines.

Trigger a pipeline with a token

POST /api/v4/projects/{id}/ref/{ref}/trigger/pipeline

Triggers a pipeline with a token. With a CI/CD job token, the triggered pipeline is a multi-project pipeline. The job that authenticates the request becomes associated with the upstream pipeline, which is visible on the pipeline graph. If you use a trigger token in a job, the job is not associated with the upstream pipeline.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
ref
Path, required
StringName of the branch or tag to run the pipeline on
Example: develop

Request body (application/json)

PropertyTypeDescription
inputsObjectMap of inputs, as key-value pairs, to use when creating the pipeline. Introduced in GitLab 17.10. Generally available in GitLab 18.1. Feature flag ci_inputs_for_pipelines removed
token
Required
StringTrigger token or CI/CD job token
Example: 6d056f63e50fe6f8c5f8f4aa10edb7
variablesObjectMap of pipeline variables, as key-value pairs, for example { VAR1: "value1", VAR2: "value2" }
Example: {"VAR1":"value1","VAR2":"value2"}

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesCiPipeline
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

Trigger a pipeline with a token

POST /api/v4/projects/{id}/trigger/pipeline

Triggers a pipeline with a token. With a CI/CD job token, the triggered pipeline is a multi-project pipeline. The job that authenticates the request becomes associated with the upstream pipeline, which is visible on the pipeline graph. If you use a trigger token in a job, the job is not associated with the upstream pipeline.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18

Request body (application/json)

PropertyTypeDescription
inputsObjectMap of inputs, as key-value pairs, to use when creating the pipeline. Introduced in GitLab 17.10. Generally available in GitLab 18.1. Feature flag ci_inputs_for_pipelines removed
token
Required
StringTrigger token or CI/CD job token
Example: 6d056f63e50fe6f8c5f8f4aa10edb7
variablesObjectMap of pipeline variables, as key-value pairs, for example { VAR1: "value1", VAR2: "value2" }
Example: {"VAR1":"value1","VAR2":"value2"}

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesCiPipeline
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

List all project trigger tokens

GET /api/v4/projects/{id}/triggers

Lists all pipeline trigger tokens for a specified project. The trigger token is displayed in full if the trigger token was created by the authenticated user. Trigger tokens created by other users are shortened to four characters.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesTrigger
400Bad Request—
401Unauthorized—
403Forbidden—
404Not found—

Create a trigger token

POST /api/v4/projects/{id}/triggers

Creates a pipeline trigger token for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18

Request body (application/json)

PropertyTypeDescription
description
Required
StringDescription of the trigger token
Example: my trigger token description
expires_atString (date-time)Timestamp of when the pipeline trigger token expires
Example: 2024-07-01T00:00:00.000Z

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesTrigger
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
429Too Many Requests—

Retrieve trigger token details

GET /api/v4/projects/{id}/triggers/{trigger_id}

Retrieves details of a pipeline trigger token for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
trigger_id
Path, required
IntegerID of the trigger token
Example: 10

Responses

CodeDescriptionSchema
200OKAPIEntitiesTrigger
400Bad Request—
401Unauthorized—
403Forbidden—
404Not found—

Update a pipeline trigger token

PUT /api/v4/projects/{id}/triggers/{trigger_id}

Updates a pipeline trigger token for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
trigger_id
Path, required
IntegerID of the trigger token

Request body (application/json)

PropertyTypeDescription
descriptionStringDescription of the trigger token

Responses

CodeDescriptionSchema
200OKAPIEntitiesTrigger
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
429Too Many Requests—

Delete a pipeline trigger token

DELETE /api/v4/projects/{id}/triggers/{trigger_id}

Deletes a pipeline trigger token for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
trigger_id
Path, required
IntegerID of the trigger token
Example: 10

Responses

CodeDescriptionSchema
204No Content—
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
412Precondition Failed—
429Too Many Requests—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesCiPipeline

PropertyTypeDescription
archivedBooleanExample: false
before_shaStringExample: a91957a858320c0e17f3a0eca7cfacbff50ea29a
committed_atString (date-time)Example: 2015-12-24T15:51:21.880Z
coverageNumber (float)Example: 98.29
created_atString (date-time)Example: 2015-12-24T15:51:21.880Z
detailed_statusDetailedStatusEntity—
durationIntegerTime spent running in seconds
Example: 127
finished_atString (date-time)Example: 2015-12-24T17:54:31.198Z
idInteger (int64)ID of the pipeline
Example: 1
iidIntegerInternal ID of the pipeline
Example: 2
project_idInteger (int64)ID of the project of the pipeline
Example: 3
queued_durationIntegerTime spent enqueued in seconds
Example: 63
refStringGit reference of the pipeline
Example: feature-branch
shaStringSHA of the commit the pipeline runs for
Example: 0ec9e58fdfca6cdd6652c083c9edb53abc0bad52
sourceStringSource that triggered the pipeline
Example: push
started_atString (date-time)Example: 2015-12-24T17:54:30.733Z
statusStringStatus of the pipeline
Example: success
tagBooleanExample: false
updated_atString (date-time)Example: 2015-12-24T17:54:31.198Z
userAPIEntitiesUserBasic—
web_urlStringURL of the pipeline in the GitLab UI
Example: https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61
yaml_errorsStringExample: widgets:build: needs 'widgets:test'

APIEntitiesCustomAttribute

PropertyTypeDescription
keyStringExample: foo
valueStringExample: bar

APIEntitiesTrigger

PropertyTypeDescription
created_atString (date-time)Example: 2015-12-24T15:51:21.880Z
descriptionStringExample: test
expires_atString (date-time)Example: 2015-12-24T17:54:31.198Z
idInteger (int64)Example: 10
last_usedString (date-time)Example: 2015-12-24T17:54:31.198Z
ownerAPIEntitiesUserBasic—
tokenStringExample: 6d056f63e50fe6f8c5f8f4aa10edb7
updated_atString (date-time)Example: 2015-12-24T17:54:31.198Z

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)ID of the user
Example: 1
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root

DetailedStatusEntity

PropertyTypeDescription
actionObject—
action.button_titleStringExample: Cancel this job
action.confirmation_messageStringExample: Are you sure?
action.iconStringExample: cancel
action.methodStringExample: post
action.pathStringExample: /namespace1/project1/-/jobs/2/cancel
action.titleStringExample: Cancel
details_pathStringExample: /test-group/test-project/-/pipelines/287
faviconStringExample: /assets/ci_favicons/favicon_status_success.png
groupStringExample: success
has_detailsBooleanExample: true
iconStringExample: status_success
illustrationObjectExample: {"content":"This job depends on upstream jobs that need to succeed in order for this job to be triggered","image":"illustrations/empty-state/empty-job-not-triggered-md.svg","size":"","title":"This job has not been triggered yet"}
labelStringExample: passed
textStringExample: passed
tooltipStringExample: passed