Create repository using template API

I’m trying to understand how Create repository using a repository template API permissions work when being used by a Github App.

Currently the app has Administration and Contents Repository permissions. However, I see the following error when trying to use that API endpoint either via an installation token or a user access token:

curl -X POST https://api.github.com/repos/react-boilerplate/react-boilerplate/generate -d '{"owner": "scouredimage", "name": "testrepo"}' -H 'Accept: application/vnd.github.baptiste-preview+json' -H 'Content-Type: application/json' -H 'Authorization: token TOKEN'
{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://developer.github.com/v3/repos/#create-repository-using-a-repository-template"
}

Does this mean that the API endpoint is just not accessible to Github Apps? Or, am I missing a required App permission?

Thanks in advance!

4 Likes

There’s nothing inherently different from what the GitHub API sees when you make a request with your personal access token vs when your GitHub app makes the request. So the issue is with your OAuth scope. Check out https://developer.github.com/v3/repos/#oauth-scope-requirements-1 to make sure you have it all set up correctly.

One quick side note: Given that this API endpoint is in preview, it may be restricting access to your GitHub app potentially. I suggest reaching out to support to clarify if that is the case.