Skip to content

HTTP API

Reflex includes an HTTP server for programmatic access. Start it with:

Terminal window
rfx serve # localhost:7878
rfx serve --port 8080 # custom port
rfx serve --host 0.0.0.0 # all interfaces (use with caution)

Search the codebase.

ParameterTypeRequiredDescription
qstringyesSearch query
symbolsboolnoOnly return symbol definitions
regexboolnoTreat query as regex
exactboolnoExact match only
langstringnoFilter by language
kindstringnoFilter by symbol kind
filestringnoFilter by file path
limitintnoMax results (default: 100)
expandboolnoInclude context lines
timeoutintnoTimeout in seconds (default: 30)

Response:

{
"status": "Fresh",
"can_trust_results": true,
"results": [
{
"file": "src/auth/handler.rs",
"line": 42,
"column": 8,
"match": "pub fn authenticate(creds: &Credentials) -> Result<Session>",
"symbol": "authenticate",
"kind": "Function",
"language": "rust",
"context_before": ["/// Authenticate a user with credentials"],
"context_after": [" let user = lookup_user(&creds.username)?;"]
}
]
}

Status values:

StatusMeaning
FreshIndex is up to date
StaleIndex may be outdated
MissingNo index found

When can_trust_results is false, consider triggering a reindex via POST /index.

Example:

Terminal window
curl "http://localhost:7878/query?q=authenticate&symbols=true&kind=Function"

Index statistics.

Response:

{
"total_files": 1247,
"index_size_bytes": 4521984,
"last_updated": "2025-11-04T10:30:00Z",
"files_by_language": {
"rust": 342,
"typescript": 518,
"python": 187
},
"lines_by_language": {
"rust": 45200,
"typescript": 62800,
"python": 18400
}
}

Returns 404 if no index exists.


Trigger reindexing. This is synchronous — the response returns after indexing completes.

Request body:

{
"force": false,
"languages": ["rust", "typescript"]
}

Both fields are optional. When force is true, the entire index is rebuilt. When languages is provided, only those languages are indexed.

Response: Same schema as GET /stats.


Health check endpoint.

Response: Reflex is running (text/plain)


CodeMeaning
200Success
400Invalid query parameters
404No index found (for /stats)
500Internal error

Use these values for the lang parameter:

LanguageIdentifiers
Rustrust, rs
TypeScripttypescript, ts
JavaScriptjavascript, js
Pythonpython, py
Gogo
Javajava
Cc
C++cpp, c++
C#csharp, cs, c#
Rubyruby, rb
PHPphp
Kotlinkotlin, kt
Vuevue
Sveltesvelte
Zigzig

The HTTP server is designed for local use only:

  • Binds to 127.0.0.1 by default
  • No authentication mechanism
  • CORS enabled for all origins (for local tool integration)

If you bind to 0.0.0.0, the server is accessible on your network. Use only on trusted networks.