CleanClean
API Reference

Search

Semantic code search endpoint.

Search across indexed repositories by natural language query.

Parameters

ParameterTypeRequiredDescription
qstringNatural language search query
repostringRepository in owner/repo format
kintegerNumber of results (default: 10, max: 50)
formatstringtoon (default) or json
expandbooleanInclude call graph context (default: true)

Example

curl "http://localhost:8000/search?q=authentication+middleware&repo=acme/api" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (JSON)

{
  "results": [
    {
      "name": "authenticate_request",
      "file": "src/middleware/auth.py",
      "score": 0.92,
      "line_start": 14,
      "line_end": 38,
      "code": "def authenticate_request(request):\n  ...",
      "callers": ["handle_request", "api_router"],
      "callees": ["verify_jwt", "get_user_from_token"]
    }
  ],
  "meta": {
    "query": "authentication middleware",
    "repo": "acme/api",
    "total": 1,
    "tokens_saved": 214
  }
}

Similarity scores

ScoreMeaning
0.90+Strong match
0.70–0.90Related
< 0.70Weak

On this page