blob: 9120428998a1dffd07d820c9548a81516576ca4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
---
stage: Verify
group: Pipeline Security
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
---
# Project job token scope API **(FREE)**
NOTE:
- Every calls to the project token scope API must be authenticated, for example, with a personal access token.
- The authenticated user (personal access token) needs to have at least Maintainer role for the project.
- Depending on the usage, the personal access token requires read access (scope `read_api`) or read/write access (scope `api`) to the API.
## Get a project job token scope
Fetch CI_JOB_TOKEN access settings (job token scope) of a project.
```plaintext
GET /projects/:id/job_token_scope
```
Parameters
| Attribute | Type | Required | Description |
|-----------|----------------|------------------------|-------------|
| `id` | integer/string | **{check-circle}** Yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
Example of request
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/job_token_scope"
```
Example of response
```json
{
"inbound_enabled": true,
"outbound_enabled": false
}
```
## Patch a project job token scope
Patch CI_JOB_TOKEN access settings of a project.
```plaintext
PATCH /projects/:id/job_token_scope
```
Parameters
| Attribute | Type | Required | Description |
|-----------|----------------|-------------------------|-------------|
| `id` | integer/string | **{check-circle}** Yes | ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
| `enabled` | boolean | **{dotted-circle}** Yes | Indicates CI/CD job tokens generated in other projects have restricted access to this project. |
Example of request
```shell
curl --request PATCH \
--url "https://gitlab.example.com/api/v4/projects/7/job_token_scope" \
--header 'PRIVATE-TOKEN: <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{ "enabled": false }'
```
Example of response
There is no response body.
|