--- import BaseLayout from "@/layouts/BaseLayout.astro"; const baseUrl = "https://docs.opencodehub.space"; const apiCategories = [ { title: "Authentication", description: "Login, register, 2FA, OAuth, SSO/SAML, session management", icon: ``, color: "text-blue-500", bgColor: "bg-blue-500/10", borderColor: "border-blue-500/20", href: `${baseUrl}/api/authentication/`, endpoints: [ { method: "POST", path: "/api/auth/login", desc: "Sign in with credentials" }, { method: "POST", path: "/api/auth/register", desc: "Create new account" }, { method: "POST", path: "/api/auth/logout", desc: "Sign out" }, { method: "GET", path: "/api/auth/me", desc: "Get current user" }, { method: "POST", path: "/api/auth/2fa/setup", desc: "Set up TOTP 2FA" }, { method: "POST", path: "/api/auth/2fa/enable", desc: "Enable 2FA" }, { method: "POST", path: "/api/auth/2fa/disable", desc: "Disable 2FA" }, { method: "POST", path: "/api/auth/password", desc: "Change password" }, { method: "POST", path: "/api/auth/password-reset", desc: "Request password reset" }, { method: "GET", path: "/api/auth/google", desc: "Google OAuth login" }, { method: "GET", path: "/api/auth/sso/:provider", desc: "SSO login" }, ], }, { title: "Repositories", description: "Create, read, update, delete repositories. Manage branches, collaborators, labels, wiki", icon: ``, color: "text-green-500", bgColor: "bg-green-500/10", borderColor: "border-green-500/20", href: `${baseUrl}/api/rest-api/`, endpoints: [ { method: "GET", path: "/api/repos", desc: "List repositories" }, { method: "POST", path: "/api/repos", desc: "Create repository" }, { method: "GET", path: "/api/repos/:owner/:repo", desc: "Get repository" }, { method: "PATCH", path: "/api/repos/:owner/:repo", desc: "Update repository" }, { method: "DELETE", path: "/api/repos/:owner/:repo", desc: "Delete repository" }, { method: "GET", path: "/api/repos/:owner/:repo/branches", desc: "List branches" }, { method: "GET", path: "/api/repos/:owner/:repo/collaborators", desc: "List collaborators" }, { method: "POST", path: "/api/repos/:owner/:repo/collaborators", desc: "Add collaborator" }, { method: "GET", path: "/api/repos/:owner/:repo/labels", desc: "List labels" }, { method: "POST", path: "/api/repos/:owner/:repo/star", desc: "Star/unstar repo" }, { method: "POST", path: "/api/repos/:owner/:repo/fork", desc: "Fork repository" }, { method: "GET", path: "/api/repos/:owner/:repo/wiki", desc: "List wiki pages" }, { method: "PUT", path: "/api/repos/:owner/:repo/wiki/:slug", desc: "Create/update wiki page" }, ], }, { title: "Pull Requests", description: "Create, review, merge PRs. Manage reviews, comments, dependencies, stacks", icon: ``, color: "text-purple-500", bgColor: "bg-purple-500/10", borderColor: "border-purple-500/20", href: `${baseUrl}/api/rest-api/`, endpoints: [ { method: "GET", path: "/api/repos/:owner/:repo/pulls", desc: "List pull requests" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls", desc: "Create pull request" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number", desc: "Get pull request" }, { method: "PATCH", path: "/api/repos/:owner/:repo/pulls/:number", desc: "Update pull request" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/merge", desc: "Merge pull request" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number/diff", desc: "Get PR diff" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/reviews", desc: "Submit review" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number/comments", desc: "List comments" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/comments", desc: "Add comment" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/ai-review", desc: "Trigger AI review" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/auto-merge", desc: "Enable auto-merge" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number/linked-prs", desc: "List linked PRs" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number/checks", desc: "List status checks" }, ], }, { title: "Stacked PRs", description: "Graphite-style stacked branches with rebase, approval propagation, merge readiness", icon: ``, color: "text-cyan-500", bgColor: "bg-cyan-500/10", borderColor: "border-cyan-500/20", href: `${baseUrl}/features/stacked-prs/`, endpoints: [ { method: "GET", path: "/api/stacks", desc: "List all stacks" }, { method: "GET", path: "/api/repos/stacks/:stackId", desc: "Get stack details" }, { method: "POST", path: "/api/repos/:owner/:repo/stacks/submit", desc: "Submit stack" }, { method: "POST", path: "/api/repos/:owner/:repo/stacks/:stackId/rebase", desc: "Rebase stack" }, { method: "GET", path: "/api/repos/:owner/:repo/stacks/:stackId/merge-readiness", desc: "Check merge readiness" }, { method: "POST", path: "/api/repos/:owner/:repo/stacks/:stackId/merge", desc: "Merge stack" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/dependencies", desc: "Get PR dependencies" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/stack-order", desc: "Get stack order" }, ], }, { title: "Issues", description: "Create, manage, and link issues. Cross-repo links and linked PRs", icon: ``, color: "text-amber-500", bgColor: "bg-amber-500/10", borderColor: "border-amber-500/20", href: `${baseUrl}/api/rest-api/`, endpoints: [ { method: "GET", path: "/api/repos/:owner/:repo/issues", desc: "List issues" }, { method: "POST", path: "/api/repos/:owner/:repo/issues", desc: "Create issue" }, { method: "GET", path: "/api/repos/:owner/:repo/issues/:number", desc: "Get issue" }, { method: "PATCH", path: "/api/repos/:owner/:repo/issues/:number", desc: "Update issue" }, { method: "POST", path: "/api/repos/:owner/:repo/issues/:number/comments", desc: "Add comment" }, { method: "GET", path: "/api/repos/:owner/:repo/issues/:number/cross-repo-links", desc: "Cross-repo links" }, { method: "GET", path: "/api/repos/:owner/:repo/issues/:number/linked-prs", desc: "Linked PRs" }, ], }, { title: "CI/CD Actions", description: "GitHub Actions-compatible pipelines, runners, artifacts, secrets", icon: ``, color: "text-orange-500", bgColor: "bg-orange-500/10", borderColor: "border-orange-500/20", href: `${baseUrl}/features/ci-actions/`, endpoints: [ { method: "GET", path: "/api/repos/:owner/:repo/actions/runs", desc: "List workflow runs" }, { method: "GET", path: "/api/repos/:owner/:repo/actions/runs/:runId", desc: "Get run details" }, { method: "POST", path: "/api/repos/:owner/:repo/actions/runs/:runId/cancel", desc: "Cancel run" }, { method: "POST", path: "/api/repos/:owner/:repo/actions/runs/:runId/rerun", desc: "Rerun run" }, { method: "GET", path: "/api/repos/:owner/:repo/actions/runs/:runId/artifacts", desc: "List artifacts" }, { method: "GET", path: "/api/repos/:owner/:repo/actions/secrets", desc: "List secrets" }, { method: "POST", path: "/api/repos/:owner/:repo/actions/secrets/:name", desc: "Create/update secret" }, { method: "POST", path: "/api/actions/runners/register", desc: "Register runner" }, { method: "POST", path: "/api/actions/runners/poll", desc: "Poll for jobs" }, ], }, { title: "Merge Queue", description: "Priority lanes, speculative builds, conflict detection, automated merge ordering", icon: ``, color: "text-emerald-500", bgColor: "bg-emerald-500/10", borderColor: "border-emerald-500/20", href: `${baseUrl}/features/merge-queue/`, endpoints: [ { method: "GET", path: "/api/repos/:owner/:repo/queue", desc: "List queue entries" }, { method: "POST", path: "/api/repos/:owner/:repo/queue/join", desc: "Join queue" }, { method: "GET", path: "/api/repos/:owner/:repo/queue/:id/conflicts", desc: "Check conflicts" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number/merge-readiness", desc: "Check merge readiness" }, ], }, { title: "AI Code Review", description: "10+ AI providers: OpenAI, Anthropic, Google, Groq, Ollama, OpenRouter, Together", icon: ``, color: "text-violet-500", bgColor: "bg-violet-500/10", borderColor: "border-violet-500/20", href: `${baseUrl}/features/ai-review/`, endpoints: [ { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/ai-review", desc: "Trigger AI review" }, { method: "GET", path: "/api/repos/:owner/:repo/pulls/:number/ai-review", desc: "Get AI review" }, { method: "GET", path: "/api/ai-review-rules", desc: "List review rules" }, { method: "POST", path: "/api/ai-review-rules", desc: "Create review rule" }, { method: "PATCH", path: "/api/ai-review-rules/:id", desc: "Update review rule" }, { method: "DELETE", path: "/api/ai-review-rules/:id", desc: "Delete review rule" }, { method: "POST", path: "/api/repos/:owner/:repo/pulls/:number/suggestions/:id/apply", desc: "Apply AI suggestion" }, ], }, { title: "Webhooks & Automations", description: "Outbound webhooks with HMAC signing, rule-based automation engine", icon: ``, color: "text-rose-500", bgColor: "bg-rose-500/10", borderColor: "border-rose-500/20", href: `${baseUrl}/guides/webhooks/`, endpoints: [ { method: "GET", path: "/api/repos/:repoId/webhooks", desc: "List webhooks" }, { method: "POST", path: "/api/repos/:repoId/webhooks", desc: "Create webhook" }, { method: "PATCH", path: "/api/repos/:repoId/webhooks/:id", desc: "Update webhook" }, { method: "DELETE", path: "/api/repos/:repoId/webhooks/:id", desc: "Delete webhook" }, { method: "POST", path: "/api/repos/:repoId/webhooks/:id/test", desc: "Test webhook" }, { method: "GET", path: "/api/automation-rules", desc: "List automation rules" }, { method: "POST", path: "/api/automation-rules", desc: "Create automation rule" }, ], }, { title: "Organizations & Teams", description: "Multi-tenant orgs, team management, role-based access control", icon: ``, color: "text-indigo-500", bgColor: "bg-indigo-500/10", borderColor: "border-indigo-500/20", href: `${baseUrl}/api/rest-api/`, endpoints: [ { method: "GET", path: "/api/orgs/:org/members", desc: "List members" }, { method: "POST", path: "/api/orgs/:org/members", desc: "Add member" }, { method: "DELETE", path: "/api/orgs/:org/members/:userId", desc: "Remove member" }, { method: "GET", path: "/api/orgs/:org/roles", desc: "List roles" }, { method: "POST", path: "/api/orgs/:org/roles", desc: "Create role" }, ], }, { title: "Notifications", description: "In-app notifications, email digests, blocking notifications, SSE realtime", icon: ``, color: "text-sky-500", bgColor: "bg-sky-500/10", borderColor: "border-sky-500/20", href: `${baseUrl}/features/notifications/`, endpoints: [ { method: "GET", path: "/api/notifications", desc: "List notifications" }, { method: "POST", path: "/api/notifications/:id/read", desc: "Mark as read" }, { method: "POST", path: "/api/notifications/:id/archive", desc: "Archive notification" }, { method: "POST", path: "/api/notifications/mark-all-read", desc: "Mark all as read" }, { method: "GET", path: "/api/user/notification-preferences", desc: "Get preferences" }, { method: "PATCH", path: "/api/user/notification-preferences", desc: "Update preferences" }, ], }, { title: "Packages", description: "Built-in npm and Docker container registry for private packages", icon: ``, color: "text-teal-500", bgColor: "bg-teal-500/10", borderColor: "border-teal-500/20", href: `${baseUrl}/api/rest-api/`, endpoints: [ { method: "GET", path: "/api/packages/npm/:package", desc: "Get npm package" }, { method: "GET", path: "/api/packages/docker/v2/:path", desc: "Docker registry API" }, ], }, ]; const authMethods = [ { name: "Bearer Token (PAT)", description: "Personal access tokens for API access", header: "Authorization: Bearer och_xxxxxxxxxxxx", example: `curl -H "Authorization: Bearer och_abc123def456" \\ https://git.yourcompany.com/api/repos`, }, { name: "Basic Auth (Git HTTP)", description: "Username + PAT for git clone/push over HTTPS", header: "Authorization: Basic base64(username:token)", example: `git clone https://username:och_abc123@git.yourcompany.com/owner/repo.git`, }, { name: "Session Cookie", description: "Browser sessions via och_session cookie (web UI only)", header: "Cookie: och_session=eyJhbG...", example: `# Automatically set by the web UI after login`, }, ]; ---

API Reference

Integrate OpenCodeHub into your workflow. {apiCategories.reduce((sum, c) => sum + c.endpoints.length, 0)}+ endpoints across repositories, pull requests, CI/CD, AI review, and more.

Base URL
/api
Authentication
Bearer token
Rate Limit
100 req/min (auth'd)

Authentication

{authMethods.map((method) => (

{method.name}

— {method.description}
{method.example}
))}

Generate tokens at Settings → Tokens. See full authentication docs for details.

Endpoints by Category

{apiCategories.map((category) => (

{category.title}

— {category.description}
Docs →
{category.endpoints.map((endpoint) => (
{endpoint.method} {endpoint.path}
{endpoint.desc}
))}
))}

Response Format

Success

{`{
  "data": {
    "id": "repo-123",
    "name": "my-project",
    "visibility": "private"
  }
}`}

Error

{`{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Repository name is required"
  }
}`}

Resources