diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-07 00:10:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-07 00:10:15 +0300 |
commit | 0790cf032c70b3df250e1953a3a11b71d835c5a1 (patch) | |
tree | ca31b07a5623da26df1fa0323832c7896b5e3386 /doc/api/personal_access_tokens.md | |
parent | 37419c44f04cd802ac89fe2d54b8501a0718a5e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/api/personal_access_tokens.md')
-rw-r--r-- | doc/api/personal_access_tokens.md | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/doc/api/personal_access_tokens.md b/doc/api/personal_access_tokens.md new file mode 100644 index 00000000000..162ba88f727 --- /dev/null +++ b/doc/api/personal_access_tokens.md @@ -0,0 +1,62 @@ +# Personal access tokens API **(ULTIMATE)** + +You can read more about [personal access tokens](../user/profile/personal_access_tokens.md#personal-access-tokens). + +## List personal access tokens + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/22726) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.3. + +Get a list of personal access tokens. + +```plaintext +GET /personal_access_tokens +``` + +| Attribute | Type | required | Description | +|-----------|---------|----------|---------------------| +| `user_id` | integer/string | no | The ID of the user to filter by | + +NOTE: **Note:** +Administrators can use the `user_id` parameter to filter by a user. Non-administrators cannot filter by any user except themselves. Attempting to do so will result in a `401 Unauthorized` response. + +```shell +curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens" +``` + +```json +[ + { + "id": 4, + "name": "Test Token", + "revoked": false, + "created_at": "2020-07-23T14:31:47.729Z", + "scopes": [ + "api" + ], + "active": true, + "user_id": 24, + "expires_at": null + } +] +``` + +```shell +curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens?user_id=3" +``` + +```json +[ + { + "id": 4, + "name": "Test Token", + "revoked": false, + "created_at": "2020-07-23T14:31:47.729Z", + "scopes": [ + "api" + ], + "active": true, + "user_id": 3, + "expires_at": null + } +] +``` |