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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
refPath, | String | Name of the branch or tag to run the pipeline on Example: develop |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
inputs | Object | Map of inputs,ci_ removed |
tokenRequired | String | Trigger token or CI/ Example: 6d056f63e50fe6f8c5f8 |
variables | Object | Map of pipeline variables,{ VAR1:Example: {"VAR1": |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
inputs | Object | Map of inputs,ci_ removed |
tokenRequired | String | Trigger token or CI/ Example: 6d056f63e50fe6f8c5f8 |
variables | Object | Map of pipeline variables,{ VAR1:Example: {"VAR1": |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Create a trigger token
POST /api/v4/projects/{id}/triggers
Creates a pipeline trigger token for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
descriptionRequired | String | Description of the trigger token Example: my trigger token description |
expires_ | String (date- | Timestamp of when the pipeline trigger token expires Example: 2024- |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
trigger_Path, | Integer | ID of the trigger token Example: 10 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Update a pipeline trigger token
PUT /api/v4/projects/{id}/triggers/{trigger_id}
Updates a pipeline trigger token for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
trigger_Path, | Integer | ID of the trigger token |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
description | String | Description of the trigger token |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too Many Requests | — |
Delete a pipeline trigger token
DELETE /api/v4/projects/{id}/triggers/{trigger_id}
Deletes a pipeline trigger token for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- Example: 18 |
trigger_Path, | Integer | ID of the trigger token Example: 10 |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
412 | Precondition Failed | — |
429 | Too Many Requests | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesCiPipeline
| Property | Type | Description |
|---|---|---|
archived | Boolean | Example:false |
before_ | String | Example:a91957a858320c0e17f3 |
committed_ | String (date- | Example:2015- |
coverage | Number (float) | Example:98. |
created_ | String (date- | Example:2015- |
detailed_ | Detailed | — |
duration | Integer | Time spent running in seconds Example: 127 |
finished_ | String (date- | Example:2015- |
id | Integer (int64) | ID of the pipeline Example: 1 |
iid | Integer | Internal ID of the pipeline Example: 2 |
project_ | Integer (int64) | ID of the project of the pipeline Example: 3 |
queued_ | Integer | Time spent enqueued in seconds Example: 63 |
ref | String | Git reference of the pipeline Example: feature- |
sha | String | SHA of the commit the pipeline runs for Example: 0ec9e58fdfca6cdd6652 |
source | String | Source that triggered the pipeline Example: push |
started_ | String (date- | Example:2015- |
status | String | Status of the pipeline Example: success |
tag | Boolean | Example:false |
updated_ | String (date- | Example:2015- |
user | APIEntities | — |
web_ | String | URL of the pipeline in the Git Example: https: |
yaml_ | String | Example:widgets: |
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesTrigger
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2015- |
description | String | Example:test |
expires_ | String (date- | Example:2015- |
id | Integer (int64) | Example:10 |
last_ | String (date- | Example:2015- |
owner | APIEntities | — |
token | String | Example:6d056f63e50fe6f8c5f8 |
updated_ | String (date- | Example:2015- |
APIEntitiesUserBasic
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | URL of the user’s avatar Example: https: |
custom_ | Array of APIEntities | — |
id | Integer (int64) | ID of the user Example: 1 |
locked | Boolean | If true, |
name | String | Name of the user.**** if the current user cannot read the bot’s project or groupExample: Administrator |
public_ | String | Public email address of the user Example: john@example. |
state | String | State of the user account.active,blocked,ldap_,blocked_,banned,deactivatedExample: active |
username | String | Username of the user Example: admin |
web_ | String | URL of the user’s profile Example: https: |
DetailedStatusEntity
| Property | Type | Description |
|---|---|---|
action | Object | — |
action. | String | Example:Cancel this job |
action. | String | Example:Are you sure? |
action. | String | Example:cancel |
action. | String | Example:post |
action. | String | Example:/ |
action. | String | Example:Cancel |
details_ | String | Example:/ |
favicon | String | Example:/ |
group | String | Example:success |
has_ | Boolean | Example:true |
icon | String | Example:status_ |
illustration | Object | Example:{"content": |
label | String | Example:passed |
text | String | Example:passed |
tooltip | String | Example:passed |