api reference

A small surface area.
Stable, JSON, predictable.

Every product surface is built on the same handful of endpoints. Authenticate with a Clerk session, send JSON, get JSON back. All requests are scoped to projects you own.

01 / authentication

Session-based auth

RepoDoc uses Clerk for authentication. Requests must carry a valid session cookie issued by the same Clerk application - there is no separate API key system. Endpoints return 401 Unauthorized when the session is missing or expired, and 404 Not Found for projects you don't own - ownership failures are not distinguished from missing projects.

base
https://repodoc.parbhat.dev
content-type
application/json
rate limit
20 req / min
02 / endpoints

Reference

POST/api/query

Ask a natural-language question about an indexed project. Returns a grounded answer with citations to the source files used.

request
{
  "projectId": "uuid",
  "question": "How does authentication work?",
  "conversationHistory": [
    { "role": "user", "content": "previous question" },
    { "role": "assistant", "content": "previous answer" }
  ]
}
response
{
  "answer": "Authentication is handled by Clerk middleware...",
  "sources": [
    {
      "fileName": "src/lib/auth.ts",
      "similarity": 0.89,
      "summary": "Configures Clerk session validation"
    }
  ]
}
POST/api/search

Discover repositories on GitHub by keyword, language, and topic. This searches GitHub, not your indexed projects - vector search over an indexed codebase runs inside /api/query and is not exposed as its own endpoint.

request
{
  "query": "rate limiting",
  "backendLanguages": ["Go"],
  "frontendLanguages": ["React"],
  "databases": ["Postgres"],
  "page": 1,
  "perPage": 10
}
GET/api/analytics

Retrieve aggregated usage and indexing metrics for the authenticated user across their projects.

response
{
  "overview": {
    "totalProjects": 0,
    "totalEmbeddings": 0,
    "totalQuestions": 0,
    "totalActiveShares": 0
  },
  "projectMetrics": { "avgFilesPerProject": 0, "topProjects": [] },
  "codeMetrics": { "languageDistribution": [] },
  "recentActivity": { "last30Days": {}, "dailyActivity": [] }
}
GET/api/architecture

Return the import graph for a project. Nodes are indexed file paths; edges are resolved from relative import specifiers only (aliased imports such as @/lib/... are not resolved).

response
{
  "nodes": [
    { "id": "src/app/page.tsx", "path": "src/app/page.tsx" }
  ],
  "edges": [
    { "from": "src/app/page.tsx", "to": "src/lib/auth" }
  ]
}
POST/api/analyze-diff

Analyze a unified diff against an indexed project and return a structured summary of the change.

request
{
  "projectId": "uuid",
  "diff": "diff --git a/src/lib/auth.ts ..."
}
GET/api/observability

Inspect cost, latency, and indexing health metrics for a single project.

03 / errors

Error shape

Errors are returned with a non-2xx status and a JSON body whose error is a plain string. There is no machine-readable error code - branch on the HTTP status, not on the message text. A 429 is the exception: it adds message and resetAt to the body, plus Retry-After and X-RateLimit-Reset headers. A project over its configured spend limit returns 402.

error
{
  "error": "Project not found or unauthorized"
}

Need help wiring it in? The documentation page walks through every flow end-to-end.