Use this API to interact with pipeline schedules.

List all pipeline schedules

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

Lists all pipeline schedules for a project.

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
scope
Query
StringScope of pipeline schedules
Allowed values: active, inactive
Example: active

Responses

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

Create a pipeline schedule

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

Creates a pipeline schedule.

Parameters

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

Request body (application/json)

PropertyTypeDescription
activeBooleanIf true, activates the pipeline schedule. If false, the pipeline schedule is initially deactivated
Default: true
Example: true
cron
Required
StringCron schedule, for example 0 1 * * *
Example: * * * * *
cron_timezoneStringTime zone supported by ActiveSupport::TimeZone, for example Pacific Time (US & Canada), or TZInfo::Timezone, for example America/Los_Angeles
Default: UTC
Example: Asia/Tokyo
description
Required
StringDescription of the pipeline schedule
Example: Test schedule pipeline
inputsArray of objectsArray of inputs to pass to the pipeline schedule. Each input has a name and a value, which can be a string, array, number, or boolean. To delete an existing input, include the name field and set destroy to true
inputs[].name
Required
StringName of the input
Example: deploy_strategy
inputs[].value
Required
String or array or number or booleanValue of the input
ref
Required
StringBranch or tag name that triggers the pipeline. Accepts either short refs (main) or full refs (refs/heads/main or refs/tags/main). Short refs are automatically expanded to full refs, unless the value could match either a branch or a tag
Example: develop

Responses

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

Retrieve a pipeline schedule

GET /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}

Retrieves a pipeline schedule for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13

Responses

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

Update a pipeline schedule

PUT /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}

Updates a pipeline schedule for a project. After the update is done, it is rescheduled automatically.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13

Request body (application/json)

PropertyTypeDescription
activeBooleanIf true, activates the pipeline schedule. If false, the pipeline schedule is initially deactivated
Example: true
cronStringCron schedule, for example 0 1 * * *
Example: * * * * *
cron_timezoneStringTime zone supported by ActiveSupport::TimeZone, for example Pacific Time (US & Canada), or TZInfo::Timezone, for example America/Los_Angeles
Example: Asia/Tokyo
descriptionStringDescription of the pipeline schedule
Example: Test schedule pipeline
inputsArray of objectsArray of inputs to pass to the pipeline schedule. Each input has a name and a value, which can be a string, array, number, or boolean. To delete an existing input, include the name field and set destroy to true
inputs[].destroyBooleanIf true, deletes the input
inputs[].name
Required
StringName of the input
Example: deploy_strategy
inputs[].value
Required
String or array or number or booleanValue of the input
refStringBranch or tag name that triggers the pipeline. Accepts either short refs (main) or full refs (refs/heads/main or refs/tags/main). Short refs are automatically expanded to full refs, unless the value could match either a branch or a tag
Example: develop

Responses

CodeDescriptionSchema
200OKAPIEntitiesCiPipelineScheduleDetails
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

Delete a pipeline schedule

DELETE /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}

Deletes a pipeline schedule for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not found—
412Precondition Failed—

List all pipelines triggered by a pipeline schedule

GET /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/pipelines

Lists all pipelines triggered by a pipeline schedule in a project.

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
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13
scope
Query
StringReturn pipelines in the specified scope
Allowed values: running, pending, finished, branches, tags
Example: pending
status
Query
StringReturn pipelines with the specified status
Allowed values: created, waiting_for_resource, preparing, waiting_for_callback, pending, running, success, failed, canceling, canceled, skipped, manual, scheduled
Example: pending
updated_before
Query
String (date-time)Return pipelines updated on or before the specified time
Example: 2015-12-24T15:51:21.880Z
updated_after
Query
String (date-time)Return pipelines updated on or after the specified time
Example: 2015-12-24T15:51:21.880Z
created_before
Query
String (date-time)Return pipelines created before the specified time
Example: 2015-12-24T15:51:21.880Z
created_after
Query
String (date-time)Return pipelines created after the specified time
Example: 2015-12-24T15:51:21.880Z
sort
Query
StringSort results in ascending or descending order
Allowed values: asc, desc
Default: asc
Example: desc

Responses

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

Run a pipeline schedule

POST /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/play

Runs a pipeline schedule immediately. The next scheduled run of this pipeline is not affected.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not found—

Create or update ownership of a pipeline schedule

POST /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/take_ownership

Creates or updates the owner of a pipeline schedule for a project.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13

Responses

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

Create a variable for a pipeline schedule

POST /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/variables

Creates a variable for a pipeline schedule.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13

Request body (application/json)

PropertyTypeDescription
key
Required
StringKey of the pipeline schedule variable. Must be 255 characters or fewer and contain only A-Z, a-z, 0-9, and _
Example: NEW_VARIABLE
value
Required
StringValue of the variable
Example: new value
variable_typeStringType of the variable. Defaults to env_var
Allowed values: env_var, file

Responses

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

Retrieve a variable for a pipeline schedule

GET /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/variables/{key}

Retrieves a specified variable for a pipeline schedule.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13
key
Path, required
StringKey of the pipeline schedule variable. Must be 255 characters or fewer and contain only A-Z, a-z, 0-9, and _
Example: NEW_VARIABLE

Responses

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

Update a variable for a pipeline schedule

PUT /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/variables/{key}

Updates a variable for a pipeline schedule.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13
key
Path, required
StringKey of the pipeline schedule variable. Must be 255 characters or fewer and contain only A-Z, a-z, 0-9, and _
Example: NEW_VARIABLE

Request body (application/json)

PropertyTypeDescription
valueStringValue of the variable
Example: new value
variable_typeStringType of the variable. Defaults to env_var
Allowed values: env_var, file

Responses

CodeDescriptionSchema
200OKAPIEntitiesCiVariable
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

Delete a variable for a pipeline schedule

DELETE /api/v4/projects/{id}/pipeline_schedules/{pipeline_schedule_id}/variables/{key}

Deletes a specified variable for a pipeline schedule.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
Example: 18
pipeline_schedule_id
Path, required
IntegerID of the pipeline schedule
Example: 13
key
Path, required
StringKey of the pipeline schedule variable. Must be 255 characters or fewer and contain only A-Z, a-z, 0-9, and _
Example: NEW_VARIABLE

Responses

CodeDescriptionSchema
202AcceptedAPIEntitiesCiVariable
400Bad Request—
401Unauthorized—
403Forbidden—
404Not found—

Schemas

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

APIEntitiesCiInput

PropertyTypeDescription
nameString—
valueString—

APIEntitiesCiPipelineBasic

PropertyTypeDescription
created_atString (date-time)Example: 2022-10-21T16:49:48.000+02:00
idInteger (int64)Example: 1
iidIntegerExample: 2
project_idInteger (int64)Example: 3
refStringExample: feature-branch
shaStringExample: 0ec9e58fdfca6cdd6652c083c9edb53abc0bad52
sourceStringExample: push
statusStringExample: success
updated_atString (date-time)Example: 2022-10-21T16:49:48.000+02:00
web_urlStringExample: https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61

APIEntitiesCiPipelineSchedule

PropertyTypeDescription
activeBooleanExample: true
created_atString (date-time)Example: 2017-05-19T13:31:08.849Z
cronStringExample: * * * * *
cron_timezoneStringExample: Asia/Tokyo
descriptionStringExample: Test schedule pipeline
idInteger (int64)Example: 13
inputsAPIEntitiesCiInput—
next_run_atString (date-time)Example: 2017-05-19T13:41:00.000Z
ownerAPIEntitiesUserBasic—
refStringExample: develop
updated_atString (date-time)Example: 2017-05-19T13:40:17.727Z

APIEntitiesCiPipelineScheduleDetails

PropertyTypeDescription
activeBooleanExample: true
created_atString (date-time)Example: 2017-05-19T13:31:08.849Z
cronStringExample: * * * * *
cron_timezoneStringExample: Asia/Tokyo
descriptionStringExample: Test schedule pipeline
idInteger (int64)Example: 13
inputsAPIEntitiesCiInput—
last_pipelineAPIEntitiesCiPipelineBasic—
next_run_atString (date-time)Example: 2017-05-19T13:41:00.000Z
ownerAPIEntitiesUserBasic—
refStringExample: develop
updated_atString (date-time)Example: 2017-05-19T13:40:17.727Z
variablesAPIEntitiesCiVariable—

APIEntitiesCiVariable

PropertyTypeDescription
descriptionStringExample: This variable is being used for ...
environment_scopeStringExample: *
hiddenBoolean—
keyStringExample: TEST_VARIABLE_1
maskedBoolean—
protectedBoolean—
rawBoolean—
valueStringExample: TEST_1
variable_typeStringExample: env_var

APIEntitiesCustomAttribute

PropertyTypeDescription
keyStringExample: foo
valueStringExample: bar

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringExample: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)Example: 1
lockedBoolean—
nameStringExample: Administrator
public_emailStringExample: john@example.com
stateStringExample: active
usernameStringExample: admin
web_urlStringExample: https://gitlab.example.com/root