---
title: "Download a repository archive"
method: GET
path: "/v1/spaces/{spaceId}/source/archive"
tags: ["Git"]
---

# Download a repository archive

`GET /v1/spaces/{spaceId}/source/archive`

## Request

- Base URL: `https://api.spacefast.com`
- URL: `https://api.spacefast.com/v1/spaces/{spaceId}/source/archive`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.spacefast.com/v1/auth/oauth2/authorize`, token URL `https://api.spacefast.com/v1/auth/oauth2/token`; client credentials, token URL `https://api.spacefast.com/v1/auth/oauth2/token`, scopes: `spaces:read`)

Downloads a repository archive from a synced source connection without requiring a signed Git remote.

## Path parameters

- `spaceId` string, required

## Query parameters

- `connectionType` 'connected' | 'hosted': Which of the space's repository connections to act on: `connected` for the repository you linked from a provider, `hosted` for the one Spacefast hosts and you push to.
- `ref` string: Branch, tag, or commit SHA to read. Defaults to the repository's default branch.
- `includeGlob` union: Archive only files matching these globs. Repeat the parameter to pass more than one.
  - string
  - string[]
- `excludeGlob` union: Leave files matching these globs out of the archive. Repeat the parameter to pass more than one.
  - string
  - string[]
- `maxBlobSize` integer: Skip files larger than this many bytes.
- `archivePrefix` string: Directory name every archived path is nested under.

## Response `200`

A gzip-compressed tar archive of the repository.

## Other responses

- `default`: Problem details (RFC 9457). Any 4xx/5xx response is one `application/problem+json` document.

---

[API](https://skmtc.dev/spacefast/apis/spacefast-api.md) · [All operations](https://skmtc.dev/spacefast/apis/spacefast-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spacefast/apis/spacefast-api/revisions/bd165bc7c983?raw)
