# Download a repository archive (tar)

From **GitHub v3 REST API**.

`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
`master`) 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.

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `ref`

- Location: path
- Required: true
- Type: `string`

## Responses

### `302`

Response

#### Headers

##### `Location`

- Type: `string`

- Example: `https://codeload.github.com/me/myprivate/legacy.zip/master?login=me&token=thistokenexpires`

## Request examples

### cURL

```shell
curl --request GET \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/tarball/{ref}
```
