Skip to content

API reference

RepoWrangler exposes a small JSON HTTP API. The SPA is its only required client; you can also call it directly. All responses are JSON. Paths are relative to your instance origin (PUBLIC_BASE_URL), or to VITE_API_BASE_URL for a decoupled SPA.

Authentication

  • Session cookie. Sign in via /auth/*; the API accepts the resulting HttpOnly rw_session cookie. Send credentials with cross-origin requests (credentials: 'include') and register the SPA origin in CORS_ALLOWED_ORIGINS.
  • Demo mode. When DEMO_MODE=true, /api/v1/* is served with a synthetic demo viewer — no sign-in needed.
  • First-boot setup mode. In real mode with no usable non-local sign-in provider, only the onboarding/connection allowlist is available without a session. If SETUP_TOKEN is configured, send it in X-Setup-Token. Setup mode closes permanently when a provider becomes usable once.
  • Roles. owner > admin > viewer. Mutating admin endpoints require admin or owner.

Unauthenticated calls to protected endpoints return 401; insufficient role returns 403.

Health

MethodPathAuthDescription
GET/health/livenoneLiveness. { ok: true, version }. No provider or DB calls.
GET/health/readynoneReadiness. { ok, demoMode }; 503 if the DB/migrations aren't ready.

Auth

MethodPathAuthDescription
GET/auth/confignonePublic provider list and bootstrap state: { demo, providers, version, setupMode, setupTokenRequired }.
GET/auth/mecookieCurrent session user and issuing provider, or 401. In demo mode returns the demo viewer.
GET/auth/github/loginnoneBegin GitHub OAuth sign-in (redirect).
GET/auth/github/callbacknoneGitHub OAuth callback; sets the session cookie.
GET/auth/entra/loginnoneBegin Entra OIDC sign-in (redirect). AUTH_MODE=entra.
GET/auth/entra/callbacknoneEntra OIDC callback; sets the session cookie.
POST/auth/logoutcookieClear the session.

Setup

MethodPathAuthDescription
GET/setup/github-appnoneOne-tap GitHub App Manifest flow to create your own App. See providers/github-app.md.

While setupMode=true, the following API operations accept the synthetic setup owner instead of a session (and require X-Setup-Token when configured): onboarding status; connection listing/creation/exchange; workspace discovery, group selection, and monitoring-state selection. No estate data endpoint is opened by setup mode.

For SSRF safety, tokenless setup may connect only to https://gitlab.com. Self-managed/custom GitLab origins require either a normal admin session or a deployment-configured SETUP_TOKEN.

GET /api/v1/onboarding/status returns { demo, setupMode, setupTokenRequired, connections, monitoredWorkspaces, firstRun }.

Estate — read

All require an authenticated session (or demo mode). Prefixed /api/v1.

MethodPathDescription
GET/api/v1/creditsOpen-source attribution (public — no session).
GET/api/v1/overviewCommand Center counts and headline metrics.
GET/api/v1/attentionRepositories needing attention, most severe first.
GET/api/v1/repositoriesEstate repository list (filterable; virtualized in the UI).
GET/api/v1/repositories/:idFull repository detail (activity, branches, CRs, security, capabilities).
GET/api/v1/branchesEstate-wide branch/comparison view.
GET/api/v1/change-requestsEstate pull/merge requests.
GET/api/v1/pipelinesRecent pipeline/workflow runs.
GET/api/v1/securitySecurity findings across the estate.
GET/api/v1/budgetsConfigured budgets, Copilot subscription context, scope attribution, and capability state.
GET/api/v1/usageDaily/monthly actual product and SKU usage, cost, repository attribution, and freshness.
GET/api/v1/activityRecent activity feed.
GET/api/v1/workspacesMonitored workspaces (orgs/groups).
GET/api/v1/platform-healthInstance health: sync jobs, webhooks, provider connection state.
GET/api/v1/about/creditsIn-product credits detail.

Saved views (FR-012)

MethodPathAuthDescription
GET/api/v1/viewssessionList saved views (instance-scoped, shareable).
POST/api/v1/viewssessionCreate a saved view { name, definition }.
DELETE/api/v1/views/:idsessionDelete a saved view.

In demo mode, writes are accepted as no-ops.

Admin

MethodPathAuthDescription
POST/api/v1/admin/syncadmin/ownerTrigger an immediate reconciliation sync.
GET/api/v1/admin/session-policyadmin/ownerRead the effective browser-session or fixed-duration policy and its source.
PUT/api/v1/admin/session-policyadmin/ownerSave an audited browser-session or 5–525600 minute fixed policy.
GET/api/v1/admin/operationsadmin/ownerList discovery, billing, usage, and other operational runs with progress and capability/error evidence.
POST/api/v1/admin/operations/:id/retryadmin/ownerEnqueue an eligible failed operation for retry; enqueueing is not completion.
GET/api/v1/connectionsadmin/ownerList connection-specific provider, credential, scope, health, capability, and activity summaries.
POST/api/v1/connections/:id/reconcileadmin/ownerEnqueue reconciliation for one connection.
PATCH/api/v1/connections/:id/statusadmin/ownerEnable or disable one connection without deleting external environment secrets.
GET/api/v1/connections/:id/workspacesadmin/ownerList workspaces visible or attached to one connection.
POST/api/v1/connections/:id/workspacesadmin/ownerAttach selected provider workspaces to one connection.
DELETE/api/v1/connections/:id/workspaces/:workspaceIdadmin/ownerDetach a workspace from that connection's discovery scope.
GET/api/v1/connections/:id/repositoriesadmin/ownerReview repositories visible through one connection.
GET/api/v1/connections/:id/credentialsadmin/ownerInspect safe credential provenance and capability metadata; never returns secret values.
PUT/api/v1/connections/:id/credentialsadmin/ownerReplace stored connection credentials.
DELETE/api/v1/connections/:idadmin/ownerHistory-preservingly disconnect a connection.

Release and upgrade evaluation

Routes below are mounted under /api/v1/admin/updates and require an administrator or owner. Preparing or enqueueing work is never reported as a completed upgrade.

MethodPathDescription
GET/api/v1/admin/updatesEvaluate the installed version, available immutable release, schema, target, controller, and provenance compatibility.
POST/api/v1/admin/updates/prepareCreate a target/version-bound preflight and short-lived approval challenge.
POST/api/v1/admin/updates/requestSubmit an approved upgrade request to the configured trusted controller.
GET/api/v1/admin/updates/jobs/:idRead durable lifecycle, checkpoint, controller, audit, and safe-error evidence.
POST/api/v1/admin/updates/jobs/:id/prepare-actionPrepare a protected cancel or rollback action.
POST/api/v1/admin/updates/jobs/:id/cancelRequest controller cancellation when supported.
POST/api/v1/admin/updates/jobs/:id/rollbackRequest a verified rollback when supported.

Webhooks (provider → RepoWrangler)

MethodPathAuthDescription
POST/webhooks/githubsignatureGitHub webhook receiver; verified with GITHUB_WEBHOOK_SECRET, idempotent by delivery ID.
POST/webhooks/gitlabsignatureGitLab webhook receiver; verified with GITLAB_WEBHOOK_SECRET.

Export

The SPA offers CSV and Markdown export of the repository list (FR-014); these are generated client-side from the list endpoints above.

Notes

  • Read endpoints reflect the last synced snapshot; freshness metadata is on each record. Trigger /api/v1/admin/sync or wait for the schedule/webhooks.
  • Provider estate and cost operations are read-only against GitHub and GitLab. Administrative writes change only RepoWrangler configuration, monitoring choices, credentials, or external deployment-controller jobs.

Apache-2.0 licensed. Read-only by design.