---
title: "List files and directories in any public git repo. Supports fuzzy file search (query parameter), language/path filtering, and depth control. Use to explore project layout, find files by name, or browse specific directories. Results capped at 1000 files; response includes total_files, files_shown, and truncated fields. Use language or path_filter to narrow large repos. Dependency/build directories excluded by default."
method: POST
path: "/api/v1/code_file_tree"
---

# List files and directories in any public git repo. Supports fuzzy file search (query parameter), language/path filtering, and depth control. Use to explore project layout, find files by name, or browse specific directories. Results capped at 1000 files; response includes total_files, files_shown, and truncated fields. Use language or path_filter to narrow large repos. Dependency/build directories excluded by default.

`POST /api/v1/code_file_tree`

## Query parameters

- `client` string, required

## Request body

- object
  - `include_all_dirs` boolean — Include dependency/build/cache directories that are excluded by default (vendor, node_modules, third_party, target, build, dist, Pods, generated, etc.). Set to true if you need to see generated/vendored code in the tree.
  - `include_stats` boolean — If true, include line count and file size for each file.
  - `language` string — Filter to only show files of this language (e.g. "Go", "Java").
  - `max_depth` integer — Maximum directory depth to return. If omitted, returns full tree.
  - `max_results` integer — Max fuzzy matches to return (default 20, max 100). Only used with query.
  - `path_filter` string — Filter to restrict tree to matching paths. Supports both glob patterns (e.g. 'pkg/**', 'src/**/*.go') and token-style filters (e.g. 'pkg/api .go'). Glob patterns are auto-converted to token filters. Mutually exclusive with query.
  - `query` string — Fuzzy search query for finding files by approximate name. Returns ranked matches instead of tree. Examples: 'main.go', 'auth handler'. Mutually exclusive with path_filter.
  - `repository` string, required — Git URL of a public remote repository

## Response `200`

Successful response

- object

## Other responses

- `400` — Bad request (invalid params or missing client)
- `404` — Repository or file not found
- `429` — Rate limited
- `500` — Internal server error
- `502` — Bad gateway (upstream clone failure)
- `503` — Service unavailable (clone queue full)

---

[API](https://skmtc.dev/searchcode/apis/searchcode-rest-api.md) · [All operations](https://skmtc.dev/searchcode/apis/searchcode-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/searchcode/searchcode-rest-api/revisions/24a0730a30a6/schema)
