---
title: "Download a repository archive (tar)"
method: GET
path: "/repos/{owner}/{repo}/tarball/{ref}"
tags: ["repos"]
---

# Download a repository archive (tar)

`GET /repos/{owner}/{repo}/tarball/{ref}`

Gets a redirect URL to download a tar archive for a repository. If you omit `:ref`, the repository’s default branch (usually
`main`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use
the `Location` header to make a second `GET` request.
**Note**: For private repositories, these links are temporary and expire after five minutes.

## Path parameters

- `owner` string, required
- `repo` string, required
- `ref` string, required

## Other responses

- `302` — Response

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-4.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-4/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-4/versions/ee6c7a46328e/schema)
