---
title: "List a site's source files"
method: GET
path: "/sites/{id}/source/files"
tags: ["Sites"]
---

# List a site's source files

`GET /sites/{id}/source/files`

## Request

- Base URL: `https://api.crevio.co/v1`
- URL: `https://api.crevio.co/v1/sites/{id}/source/files`
- Auth: API key in header `Authorization`

Lists every file in the site's repository at `ref`, `main` by default. Pass `path` to list only the files under one directory.

This is how an agent outside Crevio builds a site: list the files, read the ones you will change with `GET /sites/{id}/source/file`, then send your edits to `POST /sites/{id}/source/commits` (whole files) or `POST /sites/{id}/source/commits/diff` (a unified diff) with `expected_head_sha` set to `head_sha`, and put the commit live with `POST /sites/{id}/deploy`.

`ref` is a branch, a tag or a commit sha; an unknown one answers `404` with `param: ref`. Every read reports `commit_sha`, the commit it read, so later reads can pass it as `ref` to stay on one revision, and `head_sha`, where `main` is now, to pass as `expected_head_sha` when you commit.

Fails with `422 repository_missing` when the site has no repository yet, and `503 repository_unreachable` when its repository does not answer in time (retry).

## Path parameters

- `id` string, required

## Query parameters

- `path` string
- `ref` string

## Response `200`

The files at `ref`

- object
  - `object` 'site_source_tree', required
  - `head_sha` string, required: Where `main` points now. Pass it as `expected_head_sha` when you commit.
  - `ref` string, required: The `ref` this read asked for: `main` unless you passed one.
  - `commit_sha` string, required: The commit `ref` resolved to, which this answer was read at. Pass it as `ref` to read more of the same revision.
  - `path` string, nullable, required: The directory listed, normalized; null for the whole repository.
  - `files` object[], required
    - `path` string, required

## Other responses

- `401`: Authentication required
- `404`: Resource not found
- `422`: Validation error
- `429`: Rate limit exceeded — 600 requests per minute per owner on the free tier: every API key and OAuth token one person holds on an account shares one budget, and the account's team keys share another. Retry after the number of seconds in `Retry-After`.
- `503`: Feature not configured for this workspace

## Changes

- **2026-11-15** `56c22ab9b282`: 5 warning
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `401`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `404`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `422`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `429`
  - …1 more
- **2026-11-15** `3d2d9bae7da4`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/crevio/apis/crevio-api-v1/changes/sites/:id/source/files/get.md)

---

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