Searchcode Code File Tree API

The Code File Tree API from Searchcode — 1 operation(s) for code file tree.

GitHub OpenAPI

Operations 1

POST /api/v1/code_file_tree List files and directories in any public git repo. #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/searchcode-com:searchcode-com-code-file-tree-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

searchcode-com-code-file-tree-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository. This REST API mirrors the MCP tool endpoints for non-MCP clients.
  title: searchcode REST Code File Tree API
  version: 1.0.0
servers:
- description: Production
  url: https://api.searchcode.com
tags:
- name: Code File Tree
paths:
  /api/v1/code_file_tree:
    post:
      operationId: code_file_tree
      parameters:
      - $ref: '#/components/parameters/client'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                include_all_dirs:
                  default: false
                  description: 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.
                  type: boolean
                include_stats:
                  default: false
                  description: If true, include line count and file size for each file.
                  type: boolean
                language:
                  description: Filter to only show files of this language (e.g. "Go", "Java").
                  type: string
                max_depth:
                  description: Maximum directory depth to return. If omitted, returns full tree.
                  type: integer
                max_results:
                  default: 20
                  description: Max fuzzy matches to return. Integer between 1 and 100 — values above 100 are rejected, not clamped. Only used with query.
                  maximum: 100
                  minimum: 1
                  type: integer
                path_filter:
                  description: 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. When combined with query, narrows the file set before fuzzy matching.
                  type: string
                query:
                  description: 'Fuzzy search query for finding files by approximate name. Returns ranked matches instead of tree. Examples: ''main.go'', ''auth handler''. Can be combined with path_filter to search within a directory subset.'
                  type: string
                repository:
                  description: 'Full git URL of ONE public remote repository, e.g. "https://github.com/redis/redis". Required. There is no cross-repository or global search: this API analyses one repository per call, cloning it on demand. Wildcards and placeholders ("*", "all", "global", a bare host like "github.com") are rejected — if you do not have a specific repository URL, ask for one rather than guessing.'
                  type: string
              required:
              - repository
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: Bad request (invalid params or missing client)
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: Repository or file not found
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: Rate limited
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: Internal server error
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: Bad gateway (upstream clone failure)
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: Service unavailable (clone queue full)
      summary: List files and directories in any public git repo.
      tags:
      - Code File Tree
components:
  schemas:
    APIError:
      properties:
        error:
          properties:
            code:
              description: Machine-readable error code
              type: string
            message:
              description: Human-readable error message
              type: string
            retry_after_seconds:
              description: Seconds to wait before retrying (for rate-limited requests)
              type: integer
            suggestion:
              description: Suggested action to resolve the error
              type: string
          required:
          - code
          - message
          type: object
      type: object
  parameters:
    client:
      description: Client identifier for your application (e.g. 'my-app-v1'). Required for all REST API requests.
      in: query
      name: client
      required: true
      schema:
        type: string