Symbols API
Index and search workspace symbols — functions, classes, variables, and imports — for fast navigation and cross-reference analysis.
Overview
The Symbols API maintains a structured index of named symbols across your workspace. The agent uses it to locate definitions, find all references, and understand cross-file dependencies without reading every file on each turn.
Index Symbols
POST /symbols/index
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request
{
"workspace_id": "my-project",
"files": [
{
"path": "src/lib/auth.ts",
"content": "export function validateToken(token: string): boolean { ... }"
}
]
}
| Field | Type | Description |
|-------|------|-------------|
| workspace_id | string | Workspace to index into |
| files | array | Files to parse. Each item has path and content |
Response
{
"symbols_indexed": 128,
"files_processed": 12,
"duration_ms": 87
}
Symbol indexing is language-aware. The parser extracts structured metadata (name, kind, signature, location) rather than treating code as plain text.
Search Symbols
GET /symbols/search?q=validateToken&type=function&limit=20
Authorization: Bearer YOUR_API_KEY
Query Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| q | string | — | Search query (name substring or pattern) |
| type | string | all | Filter by symbol type: function, class, variable, import |
| limit | number | 20 | Maximum results to return |
| workspace_id | string | — | Scope search to a specific workspace |
Response
{
"symbols": [
{
"name": "validateToken",
"kind": "function",
"path": "src/lib/auth.ts",
"start_line": 14,
"end_line": 28,
"signature": "function validateToken(token: string): boolean",
"exported": true
}
],
"total": 1,
"query_ms": 4
}
Symbol Kinds
| Kind | Examples |
|------|---------|
| function | Functions, methods, arrow functions, lambdas |
| class | Classes, abstract classes, interfaces, structs |
| variable | Constants, let/var declarations, module-level bindings |
| import | Import statements, require calls, use declarations |
Find References
GET /symbols/refs?name=validateToken&workspace_id=my-project
Authorization: Bearer YOUR_API_KEY
Query Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| name | string | Exact symbol name to find references for |
| workspace_id | string | Scope to a specific workspace |
Response
{
"symbol": "validateToken",
"definition": {
"path": "src/lib/auth.ts",
"start_line": 14
},
"references": [
{ "path": "src/api/session.ts", "line": 42, "context": "if (!validateToken(req.token)) {" },
{ "path": "src/middleware.ts", "line": 8, "context": "const valid = validateToken(token);" }
],
"reference_count": 2
}
Database Stats
GET /symbols/stats?workspace_id=my-project
Authorization: Bearer YOUR_API_KEY
Response
{
"workspace_id": "my-project",
"total_symbols": 2847,
"by_kind": {
"function": 1203,
"class": 284,
"variable": 1190,
"import": 170
},
"files_indexed": 94,
"last_indexed": "2026-03-21T14:32:00Z"
}
Use /symbols/refs to safely understand the blast radius before the agent renames or refactors a symbol. A symbol with many references warrants a careful, multi-file edit approach.