v1

latestOpenAPI 3.1.02026-08-066132.7 KB

Get code from a remote public git repository — either a specific function/class by name, a line range, or a full file. PREFERRED WORKFLOW: When search results or findings have already identified a specific function, method, or class, use symbol_name to extract just that declaration. This avoids fetching entire files and keeps context focused. Only fetch full files when you need a broad understanding of a file you haven't seen before. For supported languages (Go, Python, TypeScript, JavaScript, Java, C, C++, C#, Kotlin, Swift, Rust) the response includes a symbols list of declarations with line ranges. This is not a first-call tool — use code_analyze or code_search first to identify targets, then extract precisely what you need.

post/api/v1/code_get_file

Query parameters

clientstring required

Client identifier for your application (e.g. 'my-app-v1'). Required for all REST API requests.

Request body

end_lineinteger

Last line to return (inclusive). If omitted, returns to end of file. Cannot combine with symbol_name.

include_adjacent_symbolsboolean

When true and symbol_name is set, includes structurally related declarations (nearby siblings) alongside the target symbol.

max_linesinteger

Lines to return (max: 2000). When reading an unfamiliar file for orientation, set this to 2000. When you already know which function or class you need (from search or findings results), prefer symbol_name instead — it returns only the relevant declaration and avoids pulling unnecessary context.

pathstring required

File path relative to repository root

repositorystring required

Git URL of a public remote repository

start_lineinteger

First line to return (1-based). Cannot combine with symbol_name.

symbol_namestring

PREFERRED for targeted retrieval. Name of a function/method/class to extract — returns only that declaration. Use this when search results or findings have pointed you to a specific symbol, instead of fetching the entire file. Cannot combine with start_line/end_line. Response includes a symbols list for supported languages.

Response

Successful response

object required