diff options
Diffstat (limited to 'doc/api/personal_access_tokens.md')
-rw-r--r-- | doc/api/personal_access_tokens.md | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/doc/api/personal_access_tokens.md b/doc/api/personal_access_tokens.md index b51866fe9b1..c49af2a745c 100644 --- a/doc/api/personal_access_tokens.md +++ b/doc/api/personal_access_tokens.md @@ -72,10 +72,17 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a ## Revoke a personal access token +Revoke a personal access token by either: + +- Using the ID of the personal access token. +- Passing it to the API in a header. + +### Using a personal access token ID + > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216004) in GitLab 13.3. > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/270200) from GitLab Ultimate to GitLab Free in 13.6. -Revoke a personal access token. +Revoke a personal access token using its ID. ```plaintext DELETE /personal_access_tokens/:id @@ -92,10 +99,29 @@ Non-administrators can revoke their own tokens. Administrators can revoke tokens curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens/<personal_access_token_id>" ``` -### Responses +#### Responses + +- `204: No Content` if successfully revoked. +- `400: Bad Request` if not revoked successfully. + +### Using a request header + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/350240) in GitLab 15.0. + +Revokes a personal access token that is passed in using a request header. + +```plaintext +DELETE /personal_access_tokens/self +``` + +```shell +curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens/self" +``` + +#### Responses - `204: No Content` if successfully revoked. -- `400 Bad Request` if not revoked successfully. +- `400: Bad Request` if not revoked successfully. ## Create a personal access token (administrator only) |