Get the job’s artifacts zipped archive of a project.
If you use cURL to download artifacts from GitLab.com, use the
--location
parameter
as the request might redirect through a CDN.
GET /projects/:id/jobs/:job_id/artifacts
string
To be used with triggers for multi-project pipelines. It should be invoked only in a CI/CD job defined in the .gitlab-ci.yml file. The value is always $CI_JOB_TOKEN. The job associated with the $CI_JOB_TOKEN must be running when this token is used. Premium and Ultimate only.
In the Premium and Ultimate tier you can authenticate with this endpoint
in a CI/CD job by using a CI/CD job token.
Use either:
The job_token attribute with the GitLab-provided CI_JOB_TOKEN predefined variable.
For example, the following job downloads the artifacts of the job with ID 42:
The JOB-TOKEN header with the GitLab-provided CI_JOB_TOKEN predefined variable.
For example, the following job downloads the artifacts of the job with ID
42. The command is wrapped in single quotes because it contains a
colon (:):
Download the artifacts zipped archive from the latest successful pipeline for
the given reference name and job, provided the job finished successfully. This
is the same as getting the job’s artifacts, but by
defining the job’s name instead of its ID.
If you use cURL to download artifacts from GitLab.com, use the --location parameter
as the request might redirect through a CDN.
If a pipeline is parent of other child pipelines, artifacts
are searched in hierarchical order from parent to child. For example, if both parent and
child pipelines have a job with the same name, the artifact from the parent pipeline is returned.
GET /projects/:id/jobs/artifacts/:ref_name/download?job=name
Parameters
Attribute
Required
Description
integer/string
ID or URL-encoded path of the project.
string
The name of the job.
ref_name
string
Branch or tag name in repository. HEAD or SHA references are not supported.
job_token
string
To be used with triggers for multi-project pipelines. It should be invoked only in a CI/CD job defined in the .gitlab-ci.yml file. The value is always $CI_JOB_TOKEN. The job associated with the $CI_JOB_TOKEN must be running when this token is used. Premium and Ultimate only.
In the Premium and Ultimate tier you can authenticate with this endpoint
in a CI/CD job by using a CI/CD job token.
Use either:
The job_token attribute with the GitLab-provided CI_JOB_TOKEN predefined variable.
For example, the following job downloads the artifacts of the test job
of the main branch:
The JOB-TOKEN header with the GitLab-provided CI_JOB_TOKEN predefined variable.
For example, the following job downloads the artifacts of the test job
of the main branch. The command is wrapped in single quotes
because it contains a colon (:):
Artifacts for parent and child pipelines
are searched in hierarchical order from parent to child. For example, if both parent and child pipelines
have a job with the same name, the artifact from the parent pipeline is returned.
If you use cURL to download artifacts from GitLab.com, use the --location parameter
as the request might redirect through a CDN.
GET /projects/:id/jobs/artifacts/:ref_name/raw/*artifact_path?job=name
Parameters:
Attribute
Required
Description
artifact_path
string
Path to a file inside the artifacts archive.
integer/string
ID or URL-encoded path of the project.
string
The name of the job.
ref_name
string
Branch or tag name in repository. HEAD or SHA references are not supported.
job_token
string
To be used with triggers for multi-project pipelines. It should be invoked only in a CI/CD job defined in the .gitlab-ci.yml file. The value is always $CI_JOB_TOKEN. The job associated with the $CI_JOB_TOKEN must be running when this token is used. Premium and Ultimate only.
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/1/jobs/1/artifacts/keep"
Example response:
"commit":{"author_email":"admin@example.com","author_name":"Administrator","created_at":"2015-12-24T16:51:14.000+01:00","id":"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd","message":"Test the CI integration.","short_id":"0ff3ae19","title":"Test the CI integration.""coverage":null,"allow_failure":false,"download_url":null,"id":42,"name":"rubocop","ref":"main","artifacts":[],"runner":null,"stage":"test","created_at":"2016-01-11T10:13:33.506Z","started_at":"2016-01-11T10:13:33.506Z","finished_at":"2016-01-11T10:15:10.506Z","duration":97.0,"status":"failed","failure_reason":"script_failure","tag":false,"web_url":"https://example.com/foo/bar/-/jobs/42","user":null
Requests to this endpoint set the expiry of all artifacts that
can be deleted to the current time. The files are then deleted from the system as part
of the regular cleanup of expired job artifacts. Job logs are never deleted.
The regular cleanup occurs asynchronously on a schedule, so there might be a short delay
before artifacts are deleted.
View pricing
to see all GitLab tiers and features, or to upgrade. Try GitLab for free
with access to all features for 30 days. search the docs.
If you want help with something specific and could use community support,
post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab
subscription). Request support