Answers: <p>In my case this was because I didn't have <code>repo</code> <a href="https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28#404-not-found-for-an-existing-resource" rel="nofollow noreferrer">permissions granted (article on 404)</a> 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 &quot;repo&quot; permission I got a status code 403 Forbidden.</p>
  <p>Note the <code>repo</code> permission is greater than the combined <code>repo:status</code>
  <code>repo_deployment</code> <code>public_repo</code> <code>repo:invite</code> <code>security_events</code>. Even if all of the checkboxes under <code>repo</code> are selected, you'll still get a 404.</p>
  <p><a href="https://devops.stackexchange.com/a/19921/18965"><strong>Don't forget if using GitHub Enterprise you must authorize your token on the respective project</strong></a>.</p>
  <p>For more information see <a href="https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28#404-not-found-for-an-existing-resource" rel="nofollow noreferrer">Troubleshooting the REST API</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2024-12-17T15:33:21.937Z
Answers: 2024-12-17T16:01:28.760Z
Answers: 2024-12-17T16:01:28.760Z
Answers: Evan Carroll
Body: <p>When I try to download the tarball from the rest API I'm getting,</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;message&quot;: &quot;Not Found&quot;,
    &quot;documentation_url&quot;: &quot;https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar&quot;,
    &quot;status&quot;: &quot;404&quot;
  }
  </code></pre>
  <p>How can I resolve this?</p>
  
Tags: <github>
Title: Github Rest API returns 404 when I try to download a tarball for the repo
UserDisplayName: Evan Carroll
ThreadText: # Github Rest API returns 404 when I try to download a tarball for the repo
  
  (Asked by: username_0 on 2024-12-17)
  
  When I try to download the tarball from the rest API I'm getting,
  
  ```json
  {
    "message": "Not Found",
    "documentation_url": "https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar",
    "status": "404"
  }
  
  ```
  
  How can I resolve this?
  
  **Tags:** github
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-12-17. Score: 0
  
  In my case this was because I didn't have `repo` [permissions granted (article on 404)](https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28#404-not-found-for-an-existing-resource) 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**](https://devops.stackexchange.com/a/19921/18965).
  
  For more information see [Troubleshooting the REST API](https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28#404-not-found-for-an-existing-resource)
  
  
  ---
  
  