# Download a repository archive (zip)

> A link to download a branch, tag or commit as a zip archive (the default branch without ref), good for 10 minutes and needing no token.

<div class="g1t-endpoint"><span class="g1t-method" data-method="get">GET</span><code>/repos/{owner}/{name}/zipball/{ref}</code></div>

Over REST, GET …/zipball/{ref} answers 302 with the link in Location, as GitHub does: `curl -L` follows it. Over MCP the link is returned as url, with commit and expires_at. The archive holds one folder, &lt;owner>-&lt;repo>-&lt;first 7 of the commit>/. Up to 10,000 files and 24 MB; clone a larger repository. Needs the Read role; a public repository's are open to anyone.

Over REST the answer is `302 Found` with the link in `Location`, as GitHub's is, so `curl -L -o hello.zip …/zipball/v1.2.0` saves the file, with one folder, `flagon-io-hello-7c1e9a4/`; the body above is what the MCP `repository` tool's `zipball` returns. The link needs no token and stops working after 10 minutes.

- **Authentication:** Optional. Public data can be read without a token; send one to see what is private.
- **MCP tool:** [`repository`](/reference/mcp/#repository) with `action` `zipball`, and the same inputs
- **Scope:** An access token needs [`code:read`](/guides/authentication/#scopes).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `owner` | string | Yes | The workspace that owns the repository. |
| `name` | string | Yes | The repository's name. |
| `ref` | string | Yes | A branch, tag or commit; the default branch when left out. A branch with slashes is sent URL-encoded as one path segment. |

## Example request

```sh
curl https://api.g1t.sh/repos/flagon-io/hello/zipball/v1.2.0 \
  -H "Authorization: Bearer $G1T_TOKEN"
```

## Example response

A successful request answers `200` with:

```json
{
  "url": "https://g1t.sh/flagon-io/hello/archive/7c1e9a4b2d6f80135ac9e2b7d4f6a8c0e1b3d5f7.zip?token=…",
  "commit": "7c1e9a4b2d6f80135ac9e2b7d4f6a8c0e1b3d5f7",
  "expires_at": "2026-10-12T15:13:00.000Z"
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
