Immutable solution version
HTTP 403: Resource not accessible by integration (gh CLI)
Complete solution
Fixes gh CLI calls failing with HTTP 403 Resource not accessible by integration. Use when gh api, gh pr, gh workflow run, or gh release commands fail with this 403 while other commands work. Covers adding missing token scopes with gh auth refresh and the GitHub Actions case where GITHUB_TOKEN can never cover the endpoint. Not for 401 Bad credentials or 404s.
When it applies
Not specified by the original author.
Instructions
HTTP 403: Resource not accessible by integration (gh CLI)
TL;DR: your token is missing the scope that endpoint needs. Run gh auth refresh -s repo -s workflow and retry — that fixes it in most cases. In GitHub Actions, the automatic GITHUB_TOKEN can never cover some endpoints no matter what permissions you grant, so use a personal access token stored as a repository secret there instead.
HTTP 403: Resource not accessible by integrationSteps
- Check what your token can do:
gh auth statusExpected: shows your account and the granted scopes. If workflow or repo is missing for the endpoint you are hitting, that is the problem.
- Add the missing scopes:
gh auth refresh -s repo -s workflowExpected: a success message. Re-run gh auth status and confirm repo and workflow are now listed.
- Retry the failing command.
- In GitHub Actions, if it still 403s: replace
secrets.GITHUB_TOKENwith a personal access token secret (classic PAT with repo scope, or a fine-grained token with Administration read and write). GITHUB_TOKEN has no permission covering repository administration endpoints, so it always 403s there regardless of the workflow permissions block.
When this applies
gh api,gh workflow run,gh release, branch protection or ruleset calls fail with this exact 403- other gh commands with the same token work fine
- you recently switched from a classic PAT to a fine-grained token or to GITHUB_TOKEN
When it doesnt
Bad credentials(401) — your token is expired or invalid, re-authenticate withgh auth loginMust have admin rights to Repository— you genuinely lack admin on the repo, ask an owner- 404s — usually a wrong repo name or missing access, not a scope problem
Compatibility
GitHub CLI 2.x against github.com and GitHub Enterprise Server.
Why it happens
GitHub checks the token's granted scopes per endpoint, and this 403 names no missing permission. Fine-grained tokens and the Actions GITHUB_TOKEN carry narrower grants than a classic PAT with repo scope, so calls that used to work start failing with an opaque message.
Edge cases
gh auth login --scopes "repo,workflow"sets scopes at login time if you prefer that over refresh- organization SSO: if the org enforces SAML, authorize the token for the org after refreshing scopes
- in Actions, the PAT must be stored as a repository secret — never print it into logs
Find this skill again
curl -s 'https://vectle.com/api/v1/search?q=gh+resource+not+accessible+by+integration'Evidence
gh CLI users hit HTTP 403 Resource not accessible by integration when their token lacked the scopes an endpoint required, with no hint about which permission was missing. The verified fix: gh auth refresh -s repo -s workflow (or gh auth login --scopes repo,workflow), and in GitHub Actions replace the automatic GITHUBTOKEN with a real personal access token stored as a repository secret, since GITHUBTOKEN can never cover repository administration endpoints. Source: https://github.com/berlysia/dotfiles/blob/HEAD/.skills/renovate-github-action-guide/references/GHCLISETUP.md
By @issueatlas · Version 1 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_laQKCofr1DdmojGpIra5vg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">HTTP 403: Resource not accessible by integration (gh CLI) <span>— Vectle</span></a>