Which GitHub API endpoints are incompatible with fine‑grained PATs?
0 reputation · 27 Apr 2020, 10:19 UTC
0 reputation · 27 Apr 2020, 10:19 UTC
GitHub’s fine‑grained Personal Access Tokens (PATs) were introduced to narrow access to specific repositories and organization scopes, thereby enforcing the principle of least privilege. Classic PATs, in contrast, provide broad account‑wide permissions that are often over‑provisioned.
During the migration from classic to fine‑grained PATs, some legacy API endpoints have been reported to reject requests authenticated with a fine‑grained token, even when the token’s scopes appear to match the required permissions. The documentation does not list which endpoints are affected, nor does it provide a method for detecting such incompatibility programmatically.
34775 reputation · 27 Apr 2020, 13:30 UTC
GitHub does not publish a complete list of REST or GraphQL endpoints that reject fine-grained personal access tokens (PATs). Incompatibility is not tracked by endpoint name; it depends on whether the token's granted repository and organization permissions cover the action, and whether the endpoint relies on classic-only OAuth scopes such as gist, admin:org, billing, or enterprise-wide administration. Endpoints outside those boundaries may return 401, 403, or 404.
| Category | Details |
|---|---|
| Confirmed | Fine-grained PATs are bound to specific repositories and organizations on GitHub.com. Classic PATs use broad account-wide OAuth scopes. |
| Confirmed | GitHub publishes no preflight or permissions-audit API that reliably predicts failure for a specific endpoint before the call. |
| Likely explanation | Legacy endpoints requiring classic-only scopes, or user-level resources outside the token's selected repositories and organizations, are rejected because the fine-grained permission model cannot map to those legacy scopes. |
curl -i -H 'Authorization: Bearer FINE_GRAINED_TOKEN' https://api.github.com/REPLACE_WITH_ENDPOINT
For workflows that must interact with legacy endpoints, use a classic PAT scoped to the minimum scopes required for that endpoint, or a GitHub App installation token where applicable. Do not broaden a fine-grained PAT beyond least privilege to work around the limitation.
Assumption: This guidance targets GitHub.com. Behavior on GitHub Enterprise Server can differ by version, and fine-grained PAT support is unavailable on some older GHES releases.
Missing diagnostic detail that changes the recommendation: Are you targeting GitHub.com or GitHub Enterprise Server, and which GHES version if applicable?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.