Searchcode Code Get Files API

The Code Get Files API from Searchcode — 1 operation(s) for code get files.

GitHub OpenAPI

Operations 1

POST /api/v1/code_get_files Get contents of multiple files from a remote public git repository in a single… #

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-get-files-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-get-files-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 Get Files API
  version: 1.0.0
servers:
- description: Production
  url: https://api.searchcode.com
tags:
- name: Code Get Files
paths:
  /api/v1/code_get_files:
    post:
      operationId: code_get_files
      parameters:
      - $ref: '#/components/parameters/client'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                max_lines:
                  default: 500
                  description: 'Per-file safety cap on lines returned (cap: 2000).'
                  maximum: 2000
                  type: integer
                paths:
                  description: List of files to read. Each entry has a path and optional line range.
                  items:
                    properties:
                      end_line:
                        description: Last line to return (inclusive). If omitted, returns to end of file.
                        type: integer
                      path:
                        description: File path relative to repository root
                        type: string
                      start_line:
                        default: 1
                        description: First line to return (1-based).
                        type: integer
                    required:
                    - path
                    type: object
                  maxItems: 10
                  type: array
                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
              - paths
              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: Get contents of multiple files from a remote public git repository in a single…
      tags:
      - Code Get Files
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