---
title: "List source files"
method: GET
path: "/websiteSourceCode/files"
tags: ["Source code"]
---

# List source files

`GET /websiteSourceCode/files`

## Request

- Base URL: `https://api.cactal.ai/v1`
- URL: `https://api.cactal.ai/v1/websiteSourceCode/files`
- Auth: HTTP bearer

Lists file identities, sizes, and line counts without contents, sorted by type then name with cursor pagination (default 20, maximum 100). Filter by name with `nameGlob`. Defaults to head; pass `target=published` or an explicit `version`, and pin continuation requests to the resolved response version.

## Query parameters

- `websiteId` string, required
- `target` 'head' | 'published': Version alias to read: `head` (default) or `published`.
- `version` integer: Explicit source version. Takes precedence over `target`.
- `nameGlob` string: Only list files whose name matches this glob. `*` and `?` stop at a `/` segment boundary; `**` crosses them, for example `blog/**`.
- `cursor` string: Opaque cursor from the previous page. Continue with the returned resolved version to keep the listing pinned.
- `limit` integer: Maximum files to return. Defaults to 20 and cannot exceed 100.

## Response `200`

The file listing for the requested source version.

- object
  - `items` object[], required
    - `type` 'page' | 'component' | 'module' | 'server_function' | 'global_css' | 'not_found' | 'website_config' | 'custom_head_start' | 'custom_head_end' | 'custom_body_start' | 'custom_body_end', required: File type. `page`, `component`, and `module` files are named; every other type is a singleton whose name equals the type.
    - `name` string, required: File name to pass to websiteSourceCode.files.read.
    - `bytes` integer, required: Content size in bytes.
    - `lines` integer, required: Number of lines in the content.
  - `nextCursor` string, nullable, required: Opaque cursor for the next page. Pass it as the `cursor` parameter on the next request. `null` when this is the last page.
  - `websiteId` string, required: Id of the website.
  - `version` integer, required: Source version that was listed. Pass it as `version` when continuing with `nextCursor`.

## Other responses

- `400`: Validation failed. The response `message` names the first invalid field.
- `401`: Missing, invalid, expired, or revoked API key.
- `403`: The authenticated principal lacks the required capability.
- `404`: The resource does not exist or is outside the principal’s access scope.
- `429`: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.

---

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