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 | The ID or URL- Example: 18 |
refPath, | String | The commit sha or name of a branch or tag Example: develop |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
inputs | Object | The list of inputs to be used to create the pipeline |
tokenRequired | String | The unique token of trigger or job token Example: 6d056f63e50fe6f8c5f8 |
variables | Object | The list of variables to be injected into build 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 | The ID or URL- Example: 18 |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
inputs | Object | The list of inputs to be used to create the pipeline |
tokenRequired | String | The unique token of trigger or job token Example: 6d056f63e50fe6f8c5f8 |
variables | Object | The list of variables to be injected into build 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.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- Example: 18 |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | 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 | The ID or URL- Example: 18 |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
descriptionRequired | String | The trigger token description 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 | — |
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 | The ID or URL- Example: 18 |
trigger_Path, | Integer | The trigger token ID 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 | The ID or URL- Example: 18 |
trigger_Path, | Integer | The trigger token ID |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
description | String | The trigger token description |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
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 | The ID or URL- Example: 18 |
trigger_Path, | Integer | The trigger token ID Example: 10 |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
412 | Precondition Failed | — |
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) | Example:1 |
iid | Integer | Example:2 |
project_ | Integer (int64) | Example:3 |
queued_ | Integer | Time spent enqueued in seconds Example: 63 |
ref | String | Example:feature- |
sha | String | Example:0ec9e58fdfca6cdd6652 |
source | String | Example:push |
started_ | String (date- | Example:2015- |
status | String | Example:success |
tag | Boolean | Example:false |
updated_ | String (date- | Example:2015- |
user | APIEntities | — |
web_ | String | 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 | Example:https: |
custom_ | Array of APIEntities | — |
id | Integer (int64) | Example:1 |
locked | Boolean | — |
name | String | Example:Administrator |
public_ | String | Example:john@example. |
state | String | Example:active |
username | String | Example:admin |
web_ | String | 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 |