Skip to content

API Overview

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

http://localhost:8080

Or for production:

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

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

Webhooks

Receive push events for instant re-indexing POST /api/v1/webhooks/{provider}

MCP Server

AI assistant integration via Model Context Protocol. Separate binary with 8 tools.

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
}

Most endpoints return plain text error messages with appropriate HTTP status codes:

HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Invalid query parameter

Some newer or streaming endpoints may return JSON errors:

{
"type": "error",
"error": "Failed to connect to search service"
}
Code Description
200 Success
201 Created
400 Bad request
401 Unauthorized
404 Not found
500 Server 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:

Operation Timeout
Read 15s
Write 60s
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:

Resource URL Description
Swagger UI /docs Interactive API explorer
OpenAPI Spec /openapi.yaml Full API specification (YAML)
OpenAPI JSON /openapi.json Redirects to YAML

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

Category Description
Search Code search across repositories
Repositories Repository CRUD and management
File Browsing Browse files, directories, branches (can be disabled)
Connections Code host connection management
Replace Search & replace with MR creation
Symbols Find definitions and references
Jobs Background job monitoring
Scheduler Sync scheduler management
Webhooks Push-event-driven instant re-indexing
MCP AI assistant integration (separate binary)
Health Liveness and readiness probes

Official SDKs are planned for:

  • Go
  • TypeScript/JavaScript
  • Python