diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-31 18:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-31 18:09:22 +0300 |
commit | 532c924885ebec865e0c87f484eadaf2828910e2 (patch) | |
tree | 66d3d85d30d02dfe3f559439ab5e2d6351a969ff /doc/api/rest | |
parent | a8632f50992a5304304e122fc7dfff1fd87b3c09 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/api/rest')
-rw-r--r-- | doc/api/rest/index.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/api/rest/index.md b/doc/api/rest/index.md index 39f080f059d..15bfbef78f1 100644 --- a/doc/api/rest/index.md +++ b/doc/api/rest/index.md @@ -164,6 +164,24 @@ You can also use personal, project, or group access tokens with OAuth-compliant curl --header "Authorization: Bearer <your_access_token>" "https://gitlab.example.com/api/v4/projects" ``` +### Job tokens + +You can use job tokens to authenticate with [specific API endpoints](../../ci/jobs/ci_job_token.md) +by passing the token in the `job_token` parameter or the `JOB-TOKEN` header. +To pass the token in GitLab CI/CD jobs, use the `CI_JOB_TOKEN` variable. + +Example of using the job token in a parameter: + +```shell +curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/1/jobs/42/artifacts?job_token=$CI_JOB_TOKEN" +``` + +Example of using the job token in a header: + +```shell +curl --header "JOB-TOKEN:$CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/releases" +``` + ### Session cookie Signing in to the main GitLab application sets a `_gitlab_session` cookie. The |