Skip to content

Unable to create a Personal Access Token via API #148626

Closed Answered by rajtilak-2020
AkshayYeti asked this question in API and Webhooks
Discussion options

You must be logged in to vote

Automating GitHub Personal Access Token Rotation

Hi Akshay,

GitHub currently does not support programmatic creation or deletion of Personal Access Tokens (PATs), including the classic tokens, via their REST or GraphQL APIs. Personal Access Tokens must be created manually through the GitHub settings page.


Recommended Approaches for Automating Token Rotation

  1. Use GitHub Apps for Automation:

    • Instead of relying on PATs, consider using GitHub Apps. These are designed for programmatic access and can generate installation access tokens dynamically via API.
    • Access tokens for GitHub Apps are time-limited and can be refreshed as needed.
    • Refer to the GitHub Apps documentation for more details.
  2. S…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by AkshayYeti
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API and Webhooks Discussions and conversations related to APIs or Webhooks General
2 participants