Skip to content

API Overview

Code Search provides a comprehensive REST API for integrating search into your workflows.

http://localhost:8080/api/v1

Or for production:

https://your-code-search-domain.com/api/v1

Currently, the API does not require authentication for local deployments. For production deployments, Bearer token authentication can be configured.

Search

Search across all indexed repositories POST /api/v1/search

Repositories

List and manage repositories GET /api/v1/repos

Connections

Manage code host connections GET /api/v1/connections

Jobs

Monitor background jobs GET /api/v1/jobs

SCIP

Precise code intelligence (go-to-definition, find-references) POST /api/v1/scip/repos/{id}/definition

Replace

Search and replace across repositories POST /api/v1/replace/execute

All requests should include:

Content-Type: application/json
Accept: application/json

All responses are JSON. The format varies by endpoint:

{
"results": [...],
"total_count": 100,
"duration": "15ms",
"stats": {
"files_searched": 1234,
"repos_searched": 45
}
}
{
"repos": [...],
"total_count": 50
}
{
"error": "Invalid query parameter"
}

Or plain text error message with appropriate HTTP status code.

CodeDescription
200Success
201Created
400Bad request
401Unauthorized
404Not found
500Server error

List endpoints support pagination using limit and offset:

GET /api/v1/jobs?limit=50&offset=100

Response includes pagination metadata:

{
"jobs": [...],
"total_count": 150,
"limit": 50,
"offset": 100,
"has_more": false
}

API requests have the following timeout limits:

OperationTimeout
Read15s
Write60s
Terminal window
# Search (POST request with JSON body)
curl -X POST "http://localhost:8080/api/v1/search" \
-H "Content-Type: application/json" \
-d '{"query": "handleRequest"}'
# List repos
curl "http://localhost:8080/api/v1/repos"
# List jobs with filters
curl "http://localhost:8080/api/v1/jobs?status=running&type=index"
// Search (POST request)
const response = await fetch("http://localhost:8080/api/v1/search", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query: "handleRequest" }),
});
const data = await response.json();
console.log(data.results);
import requests
response = requests.post(
'http://localhost:8080/api/v1/search',
json={'query': 'handleRequest'}
)
data = response.json()
print(data['results'])
payload := map[string]string{"query": "handleRequest"}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"http://localhost:8080/api/v1/search",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result SearchResponse
json.NewDecoder(resp.Body).Decode(&result)

Code Search provides a complete OpenAPI 3.1 specification and interactive Swagger UI:

ResourceURLDescription
Swagger UI/docsInteractive API explorer
OpenAPI Spec/openapi.yamlFull API specification (YAML)
OpenAPI JSON/openapi.jsonRedirects to YAML

You can import the OpenAPI spec into tools like Postman, generate client SDKs, or use code generators.

CategoryDescription
SearchCode search across repositories
RepositoriesRepository CRUD and management
File BrowsingBrowse files, directories, branches (can be disabled)
ConnectionsCode host connection management
ReplaceSearch & replace with MR creation
SymbolsFind definitions and references
JobsBackground job monitoring
SchedulerSync scheduler management
HealthLiveness and readiness probes

Official SDKs are planned for:

  • Go
  • TypeScript/JavaScript
  • Python