“Resource not accessible by integration” when requesting GitHub Pages build via REST API

I’m attempting to set up a GitHub App that checks in a new resource file and triggers a GitHub Pages build so that the new resource is available via the site. I’m trying to trigger a Pages build manually (as it does not trigger directly on check-in by the GitHub App) with the GitHup App authorization via this endpoint: https://developer.github.com/v3/repos/pages/#request-a-page-build

I have the file check in working fine with an installation token so the authorization is solid but I am getting “Resource not accessible by integration” back when I attempt to request a new page build.

The GitHub App has access to the repository with permissions ( Write access to code, Read  and write  access to pages) and it appears that the pages build API endpoint is enabled for use by GitHub Apps so I’m not clear on why it is returning this error.

This is all being done with @octokit/rest (https://www.npmjs.com/package/@octokit/rest). Using its debug logging I have verified that the URL/method and the accept header are correct.

method: 'post',
url: 'https://api.github.com/repos/btouellette/HHHFreshBotRedux/pages/builds',
headers: {
    accept: 'application/vnd.github.mister-fantastic-preview+json',
    authorization: 'token v1.snip',
    'user-agent': 'octokit.js/15.15.1 Node.js/10.12.0 (Linux 4.9; x64)'

Hi @btouellette,

Thank you for being here! It seems like you’re authenticating using a GitHub App installation access token. It isn’t currently possible to request page builds as a GitHub App installation (server-to-server request).

While this endpoint is enabled for GitHub Apps, you’ll need to make a user-to-server request to request a page build:


Could you give that a try and let us know if that helps?


Your GitHub Community Team

Thanks for the info on user-to-server vs server-to-server. This is running as a daily task on a server. I assume user-to-server requests will involve per-session user action (approving access via OAuth URL) so it doesn’t look like I’ll be able to use the page build endpoint.

EDIT: I now have the page build endpoint working by using ‘basic’ authentication in octokit where I can explicitly specify username/pass for my primary account so the page build is requested using the user account credentials rather than the installation token.

1 Like

Hi @andreagriffiths11,

I think I’m having a similar issue, but would love some clarification. I’m trying to create a fork of a repository with installation token access. I’m getting the same error message as listed above.

Is creating a fork another request that must be done user-to-server?


1 Like

Hello. I encountered a similar problem. Try to generate a PAT with right permissions and make sure to authenticate (Settings > Developer settings > PAT > And authenticate for that token). Use that token for your app.

1 Like