Use this API to download, keep, and delete job artifacts.
Delete all job artifacts in a project
DELETE /api/v4/projects/{id}/artifacts
Deletes job artifacts that are eligible for deletion from all jobs in a specified project. By default, artifacts from the most recently completed pipeline and the most recent successful pipeline for each ref are kept, regardless of expiration. The request sets the expiry of all deletable job artifacts to the current time. The files are then deleted by the regular cleanup of expired job artifacts, which runs asynchronously on a schedule, so deletion might take a short time. Job logs are never deleted. Artifacts cannot be recovered after deletion. You must have the Maintainer or Owner role for the project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
409 | Conflict | — |
Retrieve job artifacts
GET /api/v4/projects/{id}/jobs/artifacts/{ref_name}/download
Retrieves the artifacts archive for the latest successful job on a specified branch or tag. The latest successful pipeline is determined by its creation time. The start or end time of individual jobs does not affect which pipeline is the latest. When search_recent_successful_pipelines is true, the search includes up to 100 recent successful pipelines for the ref. Otherwise, for parent and child pipelines, artifacts are searched in hierarchical order from parent to child. If both parent and child pipelines have a job with the same name, the artifact from the parent pipeline is returned. The pipeline must have completed with a success status, so any manual jobs in it must either complete successfully or have allow_failure: true set. On GitLab.com, the request might redirect through a CDN, so clients must follow redirects, for example with the cURL --location option.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
ref_Path, | String | Branch or tag name in the repository.HEAD or SHA references are not supported.refs/ instead of the branch name |
jobQuery, | String | Name of the job |
job_Query | String | CI/ |
search_Query | Boolean | If true,Default: false |
download_Query | String | Requested download transfer mode (proxy or direct).Allowed values: proxy,direct |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Download a specific file from artifacts archive from a ref
GET /api/v4/projects/{id}/jobs/artifacts/{ref_name}/raw/{artifact_path}
Downloads a single file from the artifacts of the latest successful job on a specified branch or tag. The file is extracted from the archive and streamed to the client. When search_recent_successful_pipelines is true, the search includes up to 100 recent successful pipelines for the ref. Otherwise, for parent and child pipelines, artifacts are searched in hierarchical order from parent to child. If both parent and child pipelines have a job with the same name, the artifact from the parent pipeline is returned. The pipeline must have completed with a success status, so any manual jobs in it must either complete successfully or have allow_failure: true set. On GitLab.com, the request might redirect through a CDN, so clients must follow redirects, for example with the cURL --location option. This feature was introduced in GitLab 11.5
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
ref_Path, | String | Branch or tag name in the repository.HEAD or SHA references are not supported.refs/ instead of the branch name |
jobQuery, | String | Name of the job |
artifact_Path, | String | Path to a file inside the artifacts archive |
job_Query | String | CI/ |
search_Query | Boolean | If true,Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Download an artifact from a job
GET /api/v4/projects/{id}/jobs/{job_id}/artifacts
Downloads the artifacts archive of a specified job. To download a specific report file, such as JUnit test results, use the file_type attribute. On GitLab.com, the request might redirect through a CDN, so clients must follow redirects, for example with the cURL --location option. This feature was introduced in GitLab 8.5. The file_type attribute was added in GitLab 19.4.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
job_Path, | Integer | ID of the job |
file_Query | String | Type of artifact to download.performance and browser_ share a report group.Allowed values: accessibility,api_,archive,cobertura,jacoco,codequality,container_,dast,dependency_,dotenv,junit,license_,lsif,metrics,performance,browser_,load_,sast,secret_,requirements,requirements_,cluster_,cyclonedx,sarifDefault: archive |
job_Query | String | CI/ |
download_Query | String | Requested download transfer mode (proxy or direct).Allowed values: proxy,direct |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Delete job artifacts
DELETE /api/v4/projects/{id}/jobs/{job_id}/artifacts
Deletes job artifacts from a specified job in a project. This includes archived files, metadata, and report artifacts such as JUnit reports. The job log is not deleted. Artifacts cannot be recovered after deletion. You must have the Maintainer or Owner role for the project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
job_Path, | Integer | ID of the job |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
409 | Conflict | — |
Retain job artifacts
POST /api/v4/projects/{id}/jobs/{job_id}/artifacts/keep
Retains job artifacts. Prevents artifacts for a job from being automatically deleted when they reach their expiration date.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
job_Path, | Integer | ID of the job |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
List all files in an artifacts archive
GET /api/v4/projects/{id}/jobs/{job_id}/artifacts/tree
Lists all files and directories in a specified artifacts archive. It reads the artifact metadata without extracting the archive. This feature was introduced in GitLab 18.8.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
job_Path, | Integer | ID of the job Example: 42 |
pathQuery | String | Path to browse in the artifacts archive. Default: Example: coverage/ |
recursiveQuery | Boolean | If true,Default: falseExample: false |
job_Query | String | CI/ |
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 | — |
Download a specific file from artifacts archive
GET /api/v4/projects/{id}/jobs/{job_id}/artifacts/{artifact_path}
Downloads a single file from the artifacts of a specified job. The file is extracted from the archive and streamed to the client. On GitLab.com, the request might redirect through a CDN, so clients must follow redirects, for example with the cURL --location option. This feature was introduced in GitLab 10.0
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
job_Path, | Integer | ID of the job |
artifact_Path, | String | Path to a file inside the artifacts archive |
job_Query | String | CI/ |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesCiJob
| Property | Type | Description |
|---|---|---|
allow_ | Boolean | — |
archived | Boolean | Example:false |
artifacts | Array of APIEntities | — |
artifacts_ | String (date- | Example:2016- |
artifacts_ | APIEntities | — |
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 | Object | — |
project. | String | Example:false |
queued_ | Number (float) | Time spent enqueued Example: 0. |
ref | String | Example:main |
runner | APIEntities | — |
runner_ | APIEntities | — |
stage | String | Example:deploy |
started_ | String (date- | Example:2015- |
status | String | Example:waiting_ |
tag | Boolean | — |
tag_ | Array of strings | Example:["ubuntu18", |
user | APIEntities | — |
web_ | String | Example:https: |
APIEntitiesCiJobArtifact
| Property | Type | Description |
|---|---|---|
file_ | String | Allowed values:raw,zip,gzipExample: zip |
file_ | String | 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,sarifExample: archive |
filename | String | Example:artifacts. |
size | Integer | Example:1000 |
APIEntitiesCiJobArtifactEntry
| Property | Type | Description |
|---|---|---|
mode | String | Unix file mode in octal format,100644 for a file or 040755 for a directoryExample: 100644 |
name | String | Name of the file or directory Example: index. |
path | String | Full path in the artifacts archive. Example: coverage/ |
size | Integer | File size in bytes. Example: 12345 |
type | String | Type of the entry.file or directoryAllowed values: file,directoryExample: file |
APIEntitiesCiJobArtifactFile
| Property | Type | Description |
|---|---|---|
filename | String | Example:artifacts. |
size | Integer | Example:1000 |
APIEntitiesCiPipelineBasic
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Timestamp when the pipeline was created Example: 2022- |
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 |
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 |
status | String | Status of the pipeline Example: success |
updated_ | String (date- | Timestamp when the pipeline was last updated Example: 2022- |
web_ | String | URL of the pipeline in the Git Example: https: |
APIEntitiesCiRunner
| Property | Type | Description |
|---|---|---|
active | Boolean | If true,paused insteadExample: true |
created_ | String (date- | Example:2025- |
created_ | APIEntities | — |
description | String | Example:test- |
id | Integer (int64) | Example:8 |
ip_ | String | Always null.Example: 127. |
is_ | Boolean | Example:true |
job_ | String | Allowed values:active,idleExample: idle |
name | String | Example:test |
online | Boolean | Example:true |
paused | Boolean | Example:false |
runner_ | String | Allowed values:instance_,group_,project_Example: instance_ |
status | String | Example:online |
APIEntitiesCiRunnerManager
| Property | Type | Description |
|---|---|---|
architecture | String | Example:amd64 |
contacted_ | String | Example:2023- |
created_ | String | Example:2023- |
id | Integer (int64) | Example:8 |
ip_ | String | Example:127. |
job_ | String | Allowed values:active,idleExample: idle |
platform | String | Example:linux |
revision | String | Example:91a27b2a |
status | String | Example:online |
system_ | String | Example:runner- |
version | String | Example:16. |
APIEntitiesCommit
| Property | Type | Description |
|---|---|---|
author_ | String | Email address of the commit author Example: john@example. |
author_ | String | Name of the commit author Example: John Smith |
authored_ | String (date- | Date and time when the commit was authored Example: 2012- |
committed_ | String (date- | Date and time when the commit was committed Example: 2012- |
committer_ | String | Email address of the committer Example: jack@example. |
committer_ | String | Name of the committer Example: Jack Smith |
created_ | String (date- | Date and time when the commit was created.committed_Example: 2017- |
extended_ | Object | Git trailers parsed from the commit message, Example: {"Signed- |
id | String | Full SHA of the commit Example: 2695effb5807a22ff3d1 |
message | String | Full commit message Example: Initial commit |
parent_ | Array of strings | SHAs of the parent commits Example: ["2a4b78934375d7f53875 |
short_ | String | Short SHA of the commit Example: 2695effb |
title | String | Title of the commit message Example: Initial commit |
trailers | Object | Git trailers parsed from the commit message. Example: {"Merged- |
web_ | String | URL to view the commit in the Git Example: https: |
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesUser
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | URL of the user’s avatar Example: https: |
bio | String | Biography of the user |
bot | Boolean | — |
created_ | String (date- | Creation date and time of the user account in ISO 8601 format |
custom_ | Array of APIEntities | — |
discord | String | Discord user ID of the user |
followers | String | — |
following | String | — |
github | String | Git |
id | Integer (int64) | ID of the user Example: 1 |
is_ | String | — |
job_ | String | Job title of the user |
linkedin | String | Linked |
local_ | String | — |
location | String | Location of the user |
locked | Boolean | If true, |
name | String | Name of the user.**** if the current user cannot read the bot’s project or groupExample: Administrator |
organization | String | Organization of the user |
pronouns | String | Pronouns of the user |
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 |
twitter | String | Twitter username of the user |
username | String | Username of the user Example: admin |
web_ | String | URL of the user’s profile Example: https: |
website_ | String | Website of the user |
work_ | String | — |
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: |