AuthenticationGitHub
Fine-grained personal access tokens on GitHub
A classic token can reach every repository its owner can. A fine-grained token names one owner, the repositories and the permissions, and an organization can require approval before it works.

What differs from a classic token
- Resource owner. A fine-grained token works for one user or one organization. A classic token reaches all repositories in the organizations you can access, and your personal repositories as well.
- Repositories. You can limit the token to selected repositories of that owner. Every token also has read-only access to all public repositories.
- Permissions. Each permission is granted on its own at
read,writeor, for a few,admin. Classic tokens use broad scopes.writeincludesread. - Expiry. You pick an expiration when you create the token. A token with no expiration is allowed unless an organization or enterprise policy sets a maximum lifetime.
- Approval. An organization can require an owner to approve each token before it reaches private resources.
- Prefix. Fine-grained tokens start with
github_pat_, classic tokens withghp_.
GitHub removes a personal access token of either type when it has not been used in a year. You can create up to 50 fine-grained tokens.
Create a token
In your account, open Settings, then Developer settings, then Personal access tokens, then Fine-grained tokens, and select Generate new token. Fill in the token name, the expiration, the resource owner, the repository access and the permissions.
A link can fill in the form. This is the example from GitHub's documentation, shown there with line breaks for legibility:
https://github.com/settings/personal-access-tokens/new
?name=Repo-reading+token
&description=Just+contents:read
&target_name=octodemo
&expires_in=45
&contents=readIt prepares a token with contents:read and metadata:read that expires in 45 days. target_name is the resource owner, so replace octodemo with your own user or organization. expires_in takes 1 to 366 days, or none.
To use a token, send it in the Authorization header. In GitHub's example, replace YOUR-TOKEN with a reference to your token:
curl --request GET \
--url "https://api.github.com/octocat" \
--header "Authorization: Bearer YOUR-TOKEN" \
--header "X-GitHub-Api-Version: 2026-03-10"Organization policy
Organization owners manage tokens in the organization's settings, under Personal access tokens. Three policies exist:
- Access. Allow or restrict each token type separately. Both types are allowed by default.
- Maximum lifetime. For fine-grained tokens the default policy is 366 days. A token that exceeds the policy is blocked from the organization. It is not revoked.
- Approval. Required by default for fine-grained tokens. Until an owner approves it, a token reads only public resources. Owners find requests under Pending requests and can revoke approved tokens under Active tokens.
Classic tokens are never subject to approval. Unless the organization restricts them, any member's classic token reaches organization resources.
What they cannot do today
On 24 November 2026, GitHub's documentation lists these gaps and says they are not permanent:
- Contribute to public repositories where you are not a member.
- Work on repositories where you are an outside collaborator or a repository collaborator.
- Access more than one organization with one token.
- Access Packages.
- Call the Checks API.
- Access Projects owned by a user account.
A few REST API endpoints also accept only classic tokens. The reference page of each endpoint states whether fine-grained tokens work with it.
When a GitHub App fits better
A personal access token of either type is tied to the person who created it. It becomes inactive when that person loses access to the resource, and GitHub's documentation says automation that depends on it could then break. The same documentation describes personal access tokens as a way to act on behalf of yourself. For access on behalf of an organization, and for long-lived integrations, it recommends a GitHub App.
An app is not tied to a user account. Its installation tokens expire after one hour, and it stays installed when the person who set it up leaves. Inside a GitHub Actions workflow, try the built-in GITHUB_TOKEN before either.
What to check on your tokens
- List your classic tokens and replace each with a fine-grained token where the gaps above allow it. GitHub recommends fine-grained tokens whenever possible.
- Give every token an expiration, and only the repositories and permissions its job needs.
- As an organization owner, keep approval required, set a maximum lifetime and review Active tokens.
- Restrict classic tokens for the organization once members have moved, because approval does not apply to them.
- Move tokens that run shared automation to a GitHub App.
- Delete a leaked token at once. GitHub revokes a token on its own when it is pushed to a public repository or gist.
Sources
- Managing your personal access tokens
- Setting a personal access token policy for your organization
- Managing requests for personal access tokens in your organization
- Reviewing and revoking personal access tokens in your organization
- GitHub credential types reference
- Token expiration and revocation
- Authenticating to the REST API
- Deciding when to build a GitHub App
Want a second pair of eyes on yours? We do this work for a living.
More guides

GitHub Apps or personal access tokens for automation
Authentication · 4 min read
Ownership, lifetime, permissions and rate limits compared, with a workflow that creates an app token.

GITHUB_TOKEN permissions: set them for every job
Authentication · 3 min read
The default setting, the permissions key at workflow and job level, and what fork pull requests get.

Secrets in CI/CD: where they leak and how to stop it
Secrets · 4 min read
Six places a pipeline secret escapes, and the GitHub Actions settings that close each one.