Use this API to run CI/CD jobs on a runner: request the next job, update its state, append to its log, and transfer its artifacts.
GitLab Runner uses these endpoints itself.
Request a job
POST /api/v4/jobs/request
Requests a job for a runner to execute.
Request body (application/json)
| Property | Type | Description |
|---|---|---|
info | Object | Runner’s metadata |
info. | String | Runner’s architecture |
info. | Object | Runner’s config |
info. | String | GPUs enabled |
info. | String | Runner’s executor |
info. | Object | Runner’s features |
info. | Object | Runner’s labels |
info. | String | Runner’s name |
info. | String | Runner’s platform |
info. | String | Runner’s revision |
info. | String | Runner’s version |
last_ | String | Runner’s queue last_ |
session | Object | Runner’s session data |
session. | String | Session’s authorization |
session. | String | Session’s certificate |
session. | String | Session’s url |
system_ | String | Runner’s system identifier |
tokenRequired | String | Runner’s authentication token |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Job was scheduled | APIEntities |
204 | No job for Runner | — |
400 | Bad Request | — |
403 | Forbidden | — |
409 | Conflict | — |
422 | Runner is orphaned | — |
429 | Too Many Requests | — |
Update a job
PUT /api/v4/jobs/{id}
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | Job’s ID |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
checksum | String | Job’s trace CRC32 checksum |
exit_ | Integer | Job’s exit code |
failure_ | String | Job’s failure_ |
output | Object | Build log state |
output. | Integer | Job’s trace size in bytes |
output. | String | Job’s trace CRC32 checksum |
runtime_ | String | Runtime environment key emitted by the runner on job suspension Maximum length: 512 |
state | String | Job’s status: |
tokenRequired | String | Job’s authentication token |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Job was updated | — |
202 | Update accepted | — |
400 | Unknown parameters | — |
403 | Forbidden | — |
404 | Not Found | — |
409 | Conflict | — |
429 | Too Many Requests | — |
Download job artifacts
GET /api/v4/jobs/{id}/artifacts
Downloads artifacts for a specified job.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | Job’s ID |
tokenQuery | String | Job’s authentication token |
direct_Query | Boolean | Perform direct download from remote storage instead of proxying artifacts Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Download allowed | String (binary) (application/) |
302 | Found | String (binary) (application/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Artifact not found | — |
429 | Too Many Requests | — |
Upload job artifacts
POST /api/v4/jobs/{id}/artifacts
Uploads artifacts for a specified job.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | Job’s ID |
Request body (multipart/form-data)
| Property | Type | Description |
|---|---|---|
accessibility | String | Specify accessibility level of artifact private/ |
artifact_ | String | The format of artifact Allowed values: raw,zip,gzipDefault: zip |
artifact_ | String | The type of artifact Allowed values: archive,metadata,trace,junit,sast,dependency_,container_,dast,codequality,license_,performance,metrics,metrics_,network_,lsif,dotenv,cobertura,terraform,accessibility,cluster_,secret_,requirements,coverage_,browser_,load_,api_,cluster_,cyclonedx,requirements_,annotations,repository_,jacoco,sarifDefault: archive |
expire_ | String | Specify when artifact should expire |
fileRequired | String (binary) | The artifact file to store (generated by Multipart middleware) |
metadata | String (binary) | The artifact metadata to store (generated by Multipart middleware) |
token | String | Job’s authentication token |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | — |
400 | Bad request | — |
403 | Forbidden | — |
404 | Not Found | — |
405 | Artifacts support not enabled | — |
413 | File too large | — |
429 | Too Many Requests | — |
Authorize artifacts upload
POST /api/v4/jobs/{id}/artifacts/authorize
Authorizes uploading artifacts for a specified job.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | Job’s ID |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
artifact_ | String | The type of artifact Allowed values: archive,metadata,trace,junit,sast,dependency_,container_,dast,codequality,license_,performance,metrics,metrics_,network_,lsif,dotenv,cobertura,terraform,accessibility,cluster_,secret_,requirements,coverage_,browser_,load_,api_,cluster_,cyclonedx,requirements_,annotations,repository_,jacoco,sarifDefault: archive |
filesize | Integer | Size of artifact file |
token | String | Job’s authentication token |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Upload allowed | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not Found | — |
405 | Artifacts support not enabled | — |
413 | File too large | — |
429 | Too Many Requests | — |
Append a patch to the job trace
PATCH /api/v4/jobs/{id}/trace
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | Job’s ID |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
debug_ | Boolean | Enable or disable the debug trace |
token | String | Job’s authentication token |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Trace was patched | — |
400 | Missing Content- | — |
403 | Forbidden | — |
404 | Not Found | — |
416 | Range not satisfiable | — |
429 | Too Many Requests | — |
List all jobs processed by a runner
GET /api/v4/runners/{id}/jobs
Lists all jobs that are being processed or were processed by a specified runner. The list of jobs is limited to projects where the user has the Reporter, Developer, Maintainer, or Owner role.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of a runner |
system_Query | String | System ID associated with the runner manager |
statusQuery | String | Status of the job Allowed values: created,waiting_,preparing,waiting_,pending,running,success,failed,canceling,canceled,skipped,manual,scheduled |
order_Query | String | Order by idAllowed values: id |
sortQuery | String | Sort by asc or desc order.order_ as well,idAllowed values: asc,descDefault: desc |
cursorQuery | String | Cursor for obtaining the next set of records |
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 | No access granted | — |
404 | Runner not found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesCiJobBasicWithProject
| Property | Type | Description |
|---|---|---|
allow_ | Boolean | — |
commit | APIEntities | — |
coverage | Number (float) | Example:98. |
created_ | String (date- | Example:2015- |
duration | Number (float) | Time spent running Example: 0. |
erased_ | String (date- | Example:2015- |
failure_ | String | Example:script_ |
finished_ | String (date- | Example:2015- |
id | Integer (int64) | Example:1 |
name | String | Example:deploy_ |
pipeline | APIEntities | — |
project | APIEntities | — |
queued_ | Number (float) | Time spent enqueued Example: 0. |
ref | String | Example:main |
stage | String | Example:deploy |
started_ | String (date- | Example:2015- |
status | String | Example:waiting_ |
tag | Boolean | — |
user | APIEntities | — |
web_ | String | Example:https: |
APIEntitiesCiJobRequestArtifacts
| Property | Type | Description |
|---|---|---|
artifact_ | String | — |
artifact_ | String | — |
exclude | String | — |
expire_ | String | — |
name | String | — |
paths | String | — |
untracked | String | — |
when | String | — |
APIEntitiesCiJobRequestCache
| Property | Type | Description |
|---|---|---|
fallback_ | String | — |
key | String | — |
paths | String | — |
policy | String | — |
untracked | String | — |
when | String | — |
APIEntitiesCiJobRequestCredentials
| Property | Type | Description |
|---|---|---|
password | String | — |
type | String | — |
url | String | — |
username | String | — |
APIEntitiesCiJobRequestGitInfo
| Property | Type | Description |
|---|---|---|
before_ | String | — |
depth | String | — |
protected | String | — |
ref | String | — |
ref_ | String | — |
refspecs | String | — |
repo_ | String | — |
repo_ | String | — |
sha | String | — |
APIEntitiesCiJobRequestHook
| Property | Type | Description |
|---|---|---|
name | String | — |
script | String | — |
APIEntitiesCiJobRequestImage
| Property | Type | Description |
|---|---|---|
entrypoint | String | — |
executor_ | String | — |
name | String | — |
ports | APIEntities | — |
pull_ | String | — |
APIEntitiesCiJobRequestJobInfo
| Property | Type | Description |
|---|---|---|
id | String | — |
instance_ | String | — |
instance_ | String | — |
name | String | — |
namespace_ | String | — |
organization_ | String | — |
pipeline_ | String | — |
project_ | String | — |
project_ | String | — |
project_ | String | — |
project_ | String | — |
queue_ | String | — |
queue_ | String | — |
root_ | String | — |
scoped_ | String | — |
stage | String | — |
time_ | String | — |
user_ | String | — |
APIEntitiesCiJobRequestPort
| Property | Type | Description |
|---|---|---|
name | String | — |
number | String | — |
protocol | String | — |
APIEntitiesCiJobRequestResponse
| Property | Type | Description |
|---|---|---|
allow_ | String | — |
artifacts | APIEntities | — |
cache | APIEntities | — |
credentials | APIEntities | — |
dependencies | String | — |
features | String | — |
git_ | APIEntities | — |
hooks | APIEntities | — |
id | String | — |
image | APIEntities | — |
inputs | String | — |
job_ | APIEntities | — |
run | String | — |
runner_ | APIEntities | — |
secrets | String | — |
services | APIEntities | — |
steps | APIEntities | — |
suspend_ | String | — |
token | String | — |
variables | String | — |
APIEntitiesCiJobRequestRunnerInfo
| Property | Type | Description |
|---|---|---|
runner_ | String | — |
timeout | String | — |
uuid | String | — |
APIEntitiesCiJobRequestService
| Property | Type | Description |
|---|---|---|
alias | String | — |
command | String | — |
entrypoint | String | — |
executor_ | String | — |
name | String | — |
ports | APIEntities | — |
pull_ | String | — |
variables | String | — |
APIEntitiesCiJobRequestStep
| Property | Type | Description |
|---|---|---|
allow_ | String | — |
name | String | — |
script | String | — |
timeout | String | — |
when | String | — |
APIEntitiesCiPipelineBasic
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2022- |
id | Integer (int64) | Example:1 |
iid | Integer | Example:2 |
project_ | Integer (int64) | Example:3 |
ref | String | Example:feature- |
sha | String | Example:0ec9e58fdfca6cdd6652 |
source | String | Example:push |
status | String | Example:success |
updated_ | String (date- | Example:2022- |
web_ | String | Example:https: |
APIEntitiesCommit
| Property | Type | Description |
|---|---|---|
author_ | String | Example:john@example. |
author_ | String | Example:John Smith |
authored_ | String (date- | Example:2012- |
committed_ | String (date- | Example:2012- |
committer_ | String | Example:jack@example. |
committer_ | String | Example:Jack Smith |
created_ | String (date- | Example:2017- |
extended_ | Object | Example:{"Signed- |
id | String | Example:2695effb5807a22ff3d1 |
message | String | Example:Initial commit |
parent_ | Array of strings | Example:["2a4b78934375d7f53875 |
short_ | String | Example:2695effb |
title | String | Example:Initial commit |
trailers | Object | Example:{"Merged- |
web_ | String | Example:https: |
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesProjectIdentity
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2020- |
description | String | Example:desc |
id | Integer (int64) | Example:1 |
name | String | Example:project1 |
name_ | String | Example:John Doe / |
path | String | Example:project1 |
path_ | String | Example:namespace1/ |
APIEntitiesUser
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | Example:https: |
bio | String | — |
bot | Boolean | — |
created_ | String | — |
custom_ | Array of APIEntities | — |
discord | String | — |
followers | String | — |
following | String | — |
github | String | — |
id | Integer (int64) | Example:1 |
is_ | String | — |
job_ | String | — |
linkedin | String | — |
local_ | String | — |
location | String | — |
locked | Boolean | — |
name | String | Example:Administrator |
organization | String | — |
pronouns | String | — |
public_ | String | Example:john@example. |
state | String | Example:active |
twitter | String | — |
username | String | Example:admin |
web_ | String | Example:https: |
website_ | String | — |
work_ | String | — |