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

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

Responses

CodeDescriptionSchema
202Accepted—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—
409Conflict—

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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
ref_name
Path, required
StringBranch or tag name in the repository. HEAD or SHA references are not supported. For merge request pipelines, use refs/merge-requests/:iid/head instead of the branch name
job
Query, required
StringName of the job
job_token
Query
StringCI/CD job token for multi-project pipelines. Premium and Ultimate only
search_recent_successful_pipelines
Query
BooleanIf true, searches across recent successful pipelines instead of just the latest one. Introduced in GitLab 18.7
Default: false
download_mode
Query
StringRequested download transfer mode (proxy or direct). Only honored when allowed by the object storage configuration
Allowed values: proxy, direct

Responses

CodeDescriptionSchema
200OKString (binary) (application/octet-stream)
400Bad Request—
401Unauthorized—
403Forbidden—
404Not 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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
ref_name
Path, required
StringBranch or tag name in the repository. HEAD or SHA references are not supported. For merge request pipelines, use refs/merge-requests/:iid/head instead of the branch name
job
Query, required
StringName of the job
artifact_path
Path, required
StringPath to a file inside the artifacts archive
job_token
Query
StringCI/CD job token for multi-project pipelines. Premium and Ultimate only
search_recent_successful_pipelines
Query
BooleanIf true, searches across recent successful pipelines instead of just the latest one. Introduced in GitLab 18.9
Default: false

Responses

CodeDescriptionSchema
200OK—
400Bad request—
401Unauthorized—
403Forbidden—
404Not 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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
job_id
Path, required
IntegerID of the job
file_type
Query
StringType of artifact to download. Set a specific report type to download that report file directly instead of the full artifacts archive. performance and browser_performance share a report group. If the job uploaded both, the requested type is returned, and if it uploaded only one, that artifact is returned whichever type was requested. Introduced in GitLab 19.4
Allowed values: accessibility, api_fuzzing, archive, cobertura, jacoco, codequality, container_scanning, dast, dependency_scanning, dotenv, junit, license_scanning, lsif, metrics, performance, browser_performance, load_performance, sast, secret_detection, requirements, requirements_v2, cluster_image_scanning, cyclonedx, sarif
Default: archive
job_token
Query
StringCI/CD job token for multi-project pipelines. Premium and Ultimate only
download_mode
Query
StringRequested download transfer mode (proxy or direct). Only honored when allowed by the object storage configuration
Allowed values: proxy, direct

Responses

CodeDescriptionSchema
200OKString (binary) (application/octet-stream)
400Bad request—
401Unauthorized—
403Forbidden—
404Not 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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
job_id
Path, required
IntegerID of the job

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—
409Conflict—

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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
job_id
Path, required
IntegerID of the job

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesCiJob
400Bad Request—
401Unauthorized—
403Forbidden—
404Not 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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
job_id
Path, required
IntegerID of the job
Example: 42
path
Query
StringPath to browse in the artifacts archive. Defaults to the root directory
Default: ``
Example: coverage/reports
recursive
Query
BooleanIf true, returns all entries recursively
Default: false
Example: false
job_token
Query
StringCI/CD job token for multi-project pipelines. Premium and Ultimate only
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

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesCiJobArtifactEntry
400Bad Request—
401Unauthorized—
403Forbidden—
404Not 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

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
job_id
Path, required
IntegerID of the job
artifact_path
Path, required
StringPath to a file inside the artifacts archive
job_token
Query
StringCI/CD job token for multi-project pipelines. Premium and Ultimate only

Responses

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

Schemas

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

APIEntitiesCiJob

PropertyTypeDescription
allow_failureBoolean—
archivedBooleanExample: false
artifactsArray of APIEntitiesCiJobArtifact—
artifacts_expire_atString (date-time)Example: 2016-01-19T09:05:50.355Z
artifacts_fileAPIEntitiesCiJobArtifactFile—
commitAPIEntitiesCommit—
coverageNumber (float)Example: 98.29
created_atString (date-time)Example: 2015-12-24T15:51:21.880Z
durationNumber (float)Time spent running
Example: 0.465
erased_atString (date-time)Example: 2015-12-24T18:00:29.728Z
failure_reasonStringExample: script_failure
finished_atString (date-time)Example: 2015-12-24T17:54:31.198Z
idInteger (int64)Example: 1
nameStringExample: deploy_to_production
pipelineAPIEntitiesCiPipelineBasic—
projectObject—
project.ci_job_token_scope_enabledStringExample: false
queued_durationNumber (float)Time spent enqueued
Example: 0.123
refStringExample: main
runnerAPIEntitiesCiRunner—
runner_managerAPIEntitiesCiRunnerManager—
stageStringExample: deploy
started_atString (date-time)Example: 2015-12-24T17:54:30.733Z
statusStringExample: waiting_for_resource
tagBoolean—
tag_listArray of stringsExample: ["ubuntu18","docker runner"]
userAPIEntitiesUser—
web_urlStringExample: https://example.com/foo/bar/-/jobs/1

APIEntitiesCiJobArtifact

PropertyTypeDescription
file_formatStringAllowed values: raw, zip, gzip
Example: zip
file_typeStringAllowed values: archive, metadata, trace, junit, sast, dependency_scanning, container_scanning, dast, codequality, license_scanning, performance, metrics, metrics_referee, network_referee, lsif, dotenv, cobertura, terraform, accessibility, cluster_applications, secret_detection, requirements, coverage_fuzzing, browser_performance, load_performance, api_fuzzing, cluster_image_scanning, cyclonedx, requirements_v2, annotations, repository_xray, jacoco, sarif
Example: archive
filenameStringExample: artifacts.zip
sizeIntegerExample: 1000

APIEntitiesCiJobArtifactEntry

PropertyTypeDescription
modeStringUnix file mode in octal format, such as 100644 for a file or 040755 for a directory
Example: 100644
nameStringName of the file or directory
Example: index.html
pathStringFull path in the artifacts archive. Directories end with a slash
Example: coverage/index.html
sizeIntegerFile size in bytes. Returned only for files
Example: 12345
typeStringType of the entry. Either file or directory
Allowed values: file, directory
Example: file

APIEntitiesCiJobArtifactFile

PropertyTypeDescription
filenameStringExample: artifacts.zip
sizeIntegerExample: 1000

APIEntitiesCiPipelineBasic

PropertyTypeDescription
created_atString (date-time)Timestamp when the pipeline was created
Example: 2022-10-21T16:49:48.000+02:00
idInteger (int64)ID of the pipeline
Example: 1
iidIntegerInternal ID of the pipeline
Example: 2
project_idInteger (int64)ID of the project of the pipeline
Example: 3
refStringGit reference of the pipeline
Example: feature-branch
shaStringSHA of the commit the pipeline runs for
Example: 0ec9e58fdfca6cdd6652c083c9edb53abc0bad52
sourceStringSource that triggered the pipeline
Example: push
statusStringStatus of the pipeline
Example: success
updated_atString (date-time)Timestamp when the pipeline was last updated
Example: 2022-10-21T16:49:48.000+02:00
web_urlStringURL of the pipeline in the GitLab UI
Example: https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61

APIEntitiesCiRunner

PropertyTypeDescription
activeBooleanIf true, the runner is allowed to receive jobs. Deprecated. Use paused instead
Example: true
created_atString (date-time)Example: 2025-05-03T00:00:00.000Z
created_byAPIEntitiesUserBasic—
descriptionStringExample: test-1-20150125
idInteger (int64)Example: 8
ip_addressStringAlways null. Deprecated. Use the runner manager fields in the GraphQL API instead
Example: 127.0.0.1
is_sharedBooleanExample: true
job_execution_statusStringAllowed values: active, idle
Example: idle
nameStringExample: test
onlineBooleanExample: true
pausedBooleanExample: false
runner_typeStringAllowed values: instance_type, group_type, project_type
Example: instance_type
statusStringExample: online

APIEntitiesCiRunnerManager

PropertyTypeDescription
architectureStringExample: amd64
contacted_atStringExample: 2023-10-24T01:27:06.549Z
created_atStringExample: 2023-10-24T01:27:06.549Z
idInteger (int64)Example: 8
ip_addressStringExample: 127.0.0.1
job_execution_statusStringAllowed values: active, idle
Example: idle
platformStringExample: linux
revisionStringExample: 91a27b2a
statusStringExample: online
system_idStringExample: runner-1
versionStringExample: 16.11.0

APIEntitiesCommit

PropertyTypeDescription
author_emailStringEmail address of the commit author
Example: john@example.com
author_nameStringName of the commit author
Example: John Smith
authored_dateString (date-time)Date and time when the commit was authored
Example: 2012-05-28T04:42:42-07:00
committed_dateString (date-time)Date and time when the commit was committed
Example: 2012-05-28T04:42:42-07:00
committer_emailStringEmail address of the committer
Example: jack@example.com
committer_nameStringName of the committer
Example: Jack Smith
created_atString (date-time)Date and time when the commit was created. Identical to committed_date
Example: 2017-07-26T11:08:53.000+02:00
extended_trailersObjectGit trailers parsed from the commit message, with every value for each key
Example: {"Signed-off-by":["John Doe \u003cjohndoe@gitlab.com\u003e","Jane Doe \u003cjanedoe@gitlab.com\u003e"]}
idStringFull SHA of the commit
Example: 2695effb5807a22ff3d138d593fd856244e155e7
messageStringFull commit message
Example: Initial commit
parent_idsArray of stringsSHAs of the parent commits
Example: ["2a4b78934375d7f53875269ffd4f45fd83a84ebe"]
short_idStringShort SHA of the commit
Example: 2695effb
titleStringTitle of the commit message
Example: Initial commit
trailersObjectGit trailers parsed from the commit message. Duplicate keys include the last value only
Example: {"Merged-By":"Jane Doe janedoe@gitlab.com"}
web_urlStringURL to view the commit in the GitLab UI
Example: https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746

APIEntitiesCustomAttribute

PropertyTypeDescription
keyStringExample: foo
valueStringExample: bar

APIEntitiesUser

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
bioStringBiography of the user
botBoolean—
created_atString (date-time)Creation date and time of the user account in ISO 8601 format
custom_attributesArray of APIEntitiesCustomAttribute—
discordStringDiscord user ID of the user
followersString—
followingString—
githubStringGitHub username of the user
idInteger (int64)ID of the user
Example: 1
is_followedString—
job_titleStringJob title of the user
linkedinStringLinkedIn username of the user
local_timeString—
locationStringLocation of the user
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
organizationStringOrganization of the user
pronounsStringPronouns of the user
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
twitterStringTwitter username of the user
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root
website_urlStringWebsite of the user
work_informationString—

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)ID of the user
Example: 1
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root