When I try to download the tarball from the rest API I'm getting,
{ "message": "Not Found", "documentation_url": "https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar", "status": "404" } How can I resolve this?
In my case this was because I didn't have repo permissions granted (article on 404) on my Github Classic PAT. Getting a 404 on an API end point that exists is how GitHub handles any end-point they don't want you to know exists, prior to authorizing. When I've updated that to add the "repo" permission I got a status code 403 Forbidden.
Note the repo permission is greater than the combined repo:status repo_deployment public_repo repo:invite security_events. Even if all of the checkboxes under repo are selected, you'll still get a 404.
Don't forget if using GitHub Enterprise you must authorize your token on the respective project.
For more information see Troubleshooting the REST API