API Reference

APIReference

Interactive OpenAPI specifications and REST endpoints for programmatic analysis.

Public API Gateway • In Development

The public developer API and self-serve API keys are currently being finalized. In the meantime, repositories can be imported and scanned programmatically via our live GitHub Webhook integration.

Open Dashboard
Authentication Specification

Bearer Token Authorization

All requests to the GitCaptain API require an API key passed in the Authorization header. All traffic must be sent over TLS 1.3.

Base API URL

https://api.gitcaptain.com/v1

Global low-latency edge routing

Header Syntax

Authorization: Bearer gc_live_...

Endpoint Directory & Interactive Explorer

Select an endpoint to inspect live cURL, TypeScript, and Python code examples.

POST/v1/analyze/diff

Directly parse a unified git patch string using Tree-sitter AST parsers in temporary worker RAM.

curl -X POST https://api.gitcaptain.com/v1/analyze/diff \
  -H "Authorization: Bearer gc_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "repository": "owner/repo",
    "base_sha": "e2f41b0",
    "head_sha": "a9c08d1",
    "patch": "diff --git a/src/auth.ts b/src/auth.ts..."
  }'
200 OK — Response Payload
{
  "status": "complete",
  "risk_score": 18,
  "merge_recommendation": "safe",
  "ast_metrics": {
    "parsed_files": 2,
    "decision_branches": 6,
    "cyclomatic_depth": 3,
    "execution_time_ms": 114
  },
  "findings": [
    {
      "file_path": "src/auth.ts",
      "line": 42,
      "severity": "medium",
      "issue_type": "security",
      "message": "Token lifetime should be explicitly bound to prevent stale sessions."
    }
  ]
}

Need Enterprise Webhook Concurrency?

For monorepos with high PR burst volumes or teams requiring custom event routing, we provide isolated webhook queues and dedicated API instances.

Contact Engineering