Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,761
    • Issues 44,761
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,332
    • Merge requests 1,332
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #362239
Closed
Open
Issue created May 12, 2022 by Andreas Deicha@TrueKalixContributor

New personal access token API endpoint 'id'

Proposal

To view the properties of a personal access token (PAT) via the API, the user currently needs to retrieve a list of all his PATs. He can do this by submitting a valid PAT via the API call. The admin can additionally display the PATs of a specific user using the user_id parameter, but a complete list of all PAT properties always comes with it. In order to not always have to query the complete list, it would be possible to query only a specific PAT by providing a parameter that gets the PAT by its id. The API call looks like this:

[GET api/v4/personal_access_tokens/id]

Command:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens/3"

Trying to access a PAT that does not exist should return a 404 error not found and an unauthorized one should return the 401.

Implementation Plan

  • Add a new route to lib/api/personal_access_token.rb which receives a parameter :id
Edited May 16, 2022 by Andreas Deicha
Assignee
Assign to
Time tracking