API & MCP reference

Talk to VibeHub from code.

One REST surface, one TypeScript SDK, one MCP server. Capture sessions from any agent, attach them to commits, query your vibes, and trigger workflows.

Quickstart

Capture a commit in three calls.

The most common API flow: open a session, append messages, and attach it to a commit.

bash# 1) Start a session
curl -X POST https://www.vibehub.co/api/sdk/sessions \
  -H "Authorization: Bearer vbh_..." \
  -H "Content-Type: application/json" \
  -d '{"source":"cursor","model":"claude-opus-4-7"}'
# → { "session": { "id": "3f2a…", "status": "open", … }, "reused": false }

# 2) Append one or more messages (server assigns sequence)
curl -X POST https://www.vibehub.co/api/sdk/sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer vbh_..." \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      { "role": "user",      "content": "fix the foo bug" },
      { "role": "assistant", "content": "Looking at src/foo.ts…" }
    ]
  }'
# → { "added": 2, "total": 2 }

# 3) Attach to a commit (closes the session, unless kind: "live")
curl -X POST https://www.vibehub.co/api/sdk/sessions/$SESSION_ID/attach \
  -H "Authorization: Bearer vbh_..." \
  -H "Content-Type: application/json" \
  -d '{
    "sha": "1a2b3c4d…",
    "projectId": "$PROJECT_ID",
    "message": "feat: add waitlist"
  }'

Prefer the SDK or the MCP server for any non-trivial integration — both wrap this surface with typed methods, timeouts, and structured errors. All ids are UUIDs.

Long-running sessions (terminals, agent mirrors) should pass kind: "live" when starting. Attach then links a commit without closing the session, so the same session keeps accumulating messages across many commits.

Authentication

Bearer tokens, vbh_ prefix.

Every API call carries a token from the dashboard at Settings → API tokens. The plaintext is shown once at creation — store it like any other secret.

httpPOST /api/sdk/sessions HTTP/1.1
Host: www.vibehub.co
Authorization: Bearer vbh_3f9c…b21
Content-Type: application/json

{ "source": "cursor" }
  • PREFIXTokens start with vbh_. Anything else is rejected.
  • STORAGEOnly the sha-256 hash is stored. Treat tokens as you would any API key.
  • EXPIRYNew tokens expire after 90 days. An expired token gets 401 with "code": "token_expired"; GET /api/sdk/ping returns the calling token's expiresAt so clients can warn early. Tokens created before expiry shipped never expire.
  • SCOPEEach token has a scope. full can call everything; capture can only send sessions, transcripts, commits and git pushes (plus list or create projects and ping), which is all the Claude Code plugin needs; read can only make GET requests. Anything outside the scope gets 403 with "code": "insufficient_scope". Tokens created before scopes shipped are full.
  • MINTINGCreating a token in the browser asks you to re-confirm: your password, or for GitHub / 1Profile accounts a 6-digit code emailed via POST /api/auth/request-otp {"purpose":"step-up"}. Only a full token can mint another token, and the child never outlives its parent.
  • HOSTCall https://www.vibehub.co. The apex domain redirects to www, and HTTP clients drop the Authorization header on that redirect. The SDK, MCP server and vb rewrite it for you.
  • REVOKEDELETE /api/cli/tokens/:id or the dashboard.
  • DASHBOARDBrowser-based UI requests use session cookies — same surface, different auth.
SDK

vibehub-sdk for TypeScript.

A tiny, typed wrapper around the REST surface. Works in Node 18+, Bun, Deno, and the browser.

Install

npm i vibehub-sdk
# or
pnpm add vibehub-sdk
bun add vibehub-sdk

The npm package is rolling out — until it lands, the SDK ships in the VibeHub repo under sdk/; npm link from a checkout works today.

Create a client

tsimport { createClient } from "vibehub-sdk";

const vb = createClient({
  apiUrl: "https://www.vibehub.co",
  token: process.env.VIBEHUB_TOKEN!,
});

End-to-end capture

ts// 1) start a session
const session = await vb.startSession({
  source: "cursor",
  model: "claude-opus-4-7",
  externalId: "cursor-chat-123", // idempotency key
});

// 2) stream messages
await vb.appendMessages(session.id, [
  { role: "user",      content: "fix the foo bug" },
  { role: "assistant", content: "Looking at src/foo.ts…" },
]);

// 3) attach to a commit
await vb.attachToCommit(session.id, {
  sha: "1a2b3c4d…",
  projectId, // from vb.listProjects()
  message: "fix: foo bug",
});

One-shot capture

For agents that already have the whole conversation in memory by the time they commit.

tsawait vb.captureCommit({
  projectId,
  sha,
  message: "feat: thing",
  committedAt: new Date(),
  diff: gitDiff,
  filesChanged: 3,
  insertions: 42,
  deletions: 7,
  conversation: {
    source: "windsurf",
    messages: [
      { role: "user",      content: "…" },
      { role: "assistant", content: "…" },
    ],
  },
});

Method index

Sessions

ping()

Health + identity probe; returns the user and the token's scope and expiresAt.

startSession(input)

Open a session. Idempotent via externalId. Pass kind:'live' for terminals & agent mirrors.

appendMessages(id, msgs)

Append one or many messages; sequence is server-assigned.

getSession(id, { includeMessages? })

Fetch a session with optional messages.

listSessions({ status?, projectId?, limit? })

List the authenticated user's sessions.

updateSession(id, patch)

Patch summary, status, or endedAt.

attachToCommit(id, params)

Link the session to a git commit; closes it unless kind is 'live'.

captureCommit(input)

Bulk POST: commit + conversation in one call. Repeat calls for a known sha return reused:true.

Projects & history

createProject(input)

Create a project, or reuse yours with the same name. Defaults to private.

listProjects()

List the user's projects.

listCommits({ projectId, limit? })

Recent commits, newest first, with stats and message counts.

getCommit({ sha, projectId })

One commit + its linked conversation. Short sha prefixes (≥4 hex) work.

getCommitDiff({ sha, projectId, path? })

File list, or one file's unified diff.

getBlame({ projectId, path, branch? })

Approximate per-line blame replayed from stored diffs.

Branches & mirror

listBranches / upsertBranch

Tracked branches; upsert advances headSha or swaps the default.

updateBranch(id, patch) / deleteBranch(id)

Rename, move, re-default, or delete a tracked branch.

getMirror / setMirror / removeMirror

GitHub mirror config; the PAT is stored encrypted.

rotateMirrorWebhook({ projectId })

New inbound webhook secret, returned once.

Tokens & credits

listTokens / createToken / revokeToken

Manage API tokens; a token-minted child never outlives its parent.

getBalance({ fresh? })

Credit balance (cached 60s; fresh: true re-reads it).

createClientFromEnv()

Build a client from VIBEHUB_API_URL and VIBEHUB_TOKEN.

REST

Endpoint reference.

All endpoints are JSON-in / JSON-out, return standard HTTP status codes, and live under https://www.vibehub.co. Bearer (vbh_…) tokens authenticate the /api/cli/*, /api/sdk/* and /api/integrations/* groups, plus /api/me and /api/billing/balance, tiers and checkout. Everything else (dashboard projects, vibes, runs, workflows, evals, collections, agent) needs the browser session cookie. List endpoints take limit/offset and return nextOffset (null on the last page). The token-authenticated routes are described in an OpenAPI 3.1 document at /api/openapi.json.

Projects (session)

GET/api/projects

List the user's projects (paginated).

POST/api/projects

Create a project; the slug is made unique. Defaults to public. (The token route POST /api/cli/projects reuses by name and defaults to private.)

GET/api/projects/:slug

One project. PATCH to edit, DELETE to remove.

GET/api/projects/:slug/commits

Commits for the project; /commits/:sha for one with its conversation.

GET/api/projects/:slug/branches

Branches VibeHub tracks for the project.

PUT/api/projects/:slug/mirror

Link the GitHub mirror (GET to read, DELETE to unlink, POST ?action=rotate-webhook for a new webhook secret).

Vibes & commits

GET/api/vibes

Your own vibes (session; paginated). Others' public vibes live at /u/:username/:slug and /explore.

POST/api/vibes

Create a vibe (session).

GET/api/vibes/:id

One vibe with its evals and forks. PATCH to edit, DELETE to remove (session).

POST/api/cli/commits

Capture a commit + conversation (used by vb commit). Free.

GET/api/cli/commits

List a project's commits (?project_id=…&limit=N).

GET/api/cli/commits/:sha

Fetch a commit + conversation by SHA (?project_id=…; short prefixes accepted).

GET/api/cli/commits/:sha/diff

File list for a commit (?project_id=…), or one file's unified diff with &path=….

GET/api/cli/blame

Approximate blame (?project_id=…&path=…[&branch=…]), replayed from stored diffs.

GET/api/evals

Your latest evals, or one vibe's with ?vibeId=… (yours or public). Session auth.

POST/api/evals

Run an eval on a vibe you own. Simulated preview: the result and score are generated, not measured. Free. Session auth.

Git (smart HTTP)

POST/api/git/:owner/:slug.git/git-receive-pack

git push target. HTTP Basic auth with any username and a vbh_ token as the password. Costs 2 credits. Fetch/clone (upload-pack) returns 501.

Sessions (SDK & MCP backend)

GET/api/sdk/ping

Identity + health probe. Canonical Test Connection target for SDK clients.

POST/api/sdk/sessions

Open a new session, or reuse one by externalId. Pass kind:'live' for long-running sessions.

GET/api/sdk/sessions

List the user's sessions. Filter by status or project_id.

GET/api/sdk/sessions/:id

Fetch a session, optionally with messages.

PATCH/api/sdk/sessions/:id

Patch summary, status, or endedAt.

POST/api/sdk/sessions/:id/messages

Append messages. Sequence is server-assigned. Max 500/call.

POST/api/sdk/sessions/:id/attach

Link the session to a commit. Closes the session unless kind is 'live'.

POST/api/mcp

Hosted MCP server (Streamable HTTP, stateless): the vibehub-mcp tools over JSON-RPC. Bearer vbh_ token or a 1Profile access token.

Workflows & runs

GET/api/workflows

List workflows.

POST/api/workflows

Create a new workflow.

GET/api/workflows/:id

Fetch a workflow. PATCH to edit or pause, DELETE to remove.

POST/api/workflows/:id/trigger

Fire an active workflow now (no body). Records the run count and notifies you; 400 if the workflow isn't active.

GET/api/runs

Your recent runs (paginated).

POST/api/runs

Start a run/replay of a vibe ({ vibeId, title?, model? }). Simulated preview: no model is called, and status, tokens and cost are generated. Free.

GET/api/runs/:id

One run with its status, tokens and cost. DELETE to remove.

POST/api/runs/:id/events

Append up to 500 timeline events (messages, tool calls, results) to your run, in order. Session or vbh_ token. GET returns the timeline.

Collections, builders, activity

GET/api/collections

List the user's collections.

POST/api/collections

Create a collection.

GET/api/collections/:id

One collection with its vibes. PATCH to edit, DELETE to remove.

POST/api/collections/:id/vibes

Add a vibe to a collection (DELETE to remove it).

GET/api/builders

Browse public builders & profiles.

POST/api/builders/:id/follow

Follow a builder (DELETE to unfollow).

GET/api/activity

Activity feed for the authenticated user.

GET/api/analytics

Summary across all your vibes and runs.

Marketplace

GET/api/marketplace/listings

Your listings, the platform fee percent, and credits earned.

POST/api/marketplace/listings

List a project for sale ({ projectSlug, title, tagline?, description?, category, tags?, priceCredits }). Goes live after admin review.

PATCH/api/marketplace/listings/:id

Edit a listing. Text changes send it back to review; price changes don't. DELETE delists it.

GET/api/marketplace/listings/:id/status

Live price and whether you own it, are the seller, or have a purchase in progress. Works signed out.

POST/api/marketplace/listings/:id/purchase

Buy and copy the project into your account. Send { expectedPrice }; a changed price returns 409 price_changed with the new price.

GET/api/marketplace/purchases

Listings you've bought, with the project each was copied into.

Agent (dashboard chat)

POST/api/agent/chat

Stream a chat turn as Server-Sent Events ({ conversationId, content }). Writes come back as needs_confirm steps; send approved: [{ tool, input }, …] (up to 20) on the next turn to run them. 1 credit per turn; 20/min.

GET/api/agent/tools

List tools the agent has access to.

GET/api/agent/metrics

Per-conversation usage metrics.

GET/api/agent/conversations

List the user's agent conversations.

POST/api/agent/conversations

Start a conversation.

GET/api/agent/conversations/:id

Fetch a conversation with its turns. PATCH to rename, DELETE to remove.

GET/api/agent/conversations/:id/export

Export a conversation as Markdown.

POST/api/agent/conversations/:id/regenerate

Regenerate the last assistant turn.

Account & tokens

GET/api/me

The authenticated user's profile (session or Bearer). PATCH to update profile and prefs; DELETE closes the account (browser session + step-up only).

GET/api/cli/tokens

List the user's API tokens (metadata only).

POST/api/cli/tokens

Mint a token ({ name, scope? }); scope is full (default), capture or read. Plaintext returned once, expires in 90 days. Browser sessions must step up with `password` or an emailed `code`; a token-minted token never outlives its parent.

DELETE/api/cli/tokens/:id

Revoke a token.

GET/api/cli/projects

List your projects. POST { name } creates one, or reuses yours with that name.

GET/api/cli/branches

Tracked branches (?project_id=…). POST upserts { projectId, name, headSha?, isDefault? }.

PATCH/api/cli/branches/:id

Rename, move, or re-default a branch. DELETE removes it.

GET/api/cli/mirrors

The project's GitHub mirror (?project_id=…[&reveal=1][&reveal_webhook=1]). PUT sets it, DELETE { projectId } removes it, POST ?action=rotate-webhook rotates the secret.

POST/api/cli/mirrors/push

Record the result of a push vb already made ({ projectId, sha, error? }).

POST/api/cli/mirrors/webhook

GitHub push webhook receiver (two-way sync; HMAC verified).

Billing (credit-based, cred.diy)

GET/api/billing/balance

Current credit balance (60s cache, ?fresh=1 to refresh). Session or Bearer.

GET/api/billing/tiers

Credit pack tiers. Session or Bearer.

POST/api/billing/checkout

Start a hosted checkout for a credit pack. Session or Bearer.

GET/api/billing/transactions

Your credit ledger (session).

Integrations & git

POST/api/integrations/import

Import a finished chat from v0, Lovable, Bolt, Copilot, Cursor, Windsurf or other ({ source, messages, externalId? }; up to 2,000 messages; idempotent on externalId).

POST/api/integrations/claude-code/hook

Claude Code hook receiver ({ type: session_start | message | session_end, … }).

GET/api/git/:owner/:slug.git/info/refs

Git smart-HTTP ref discovery for git push. Basic auth with any username and a vbh_ token as the password. Pushes cost 2 credits. Clone and fetch aren't served yet: git shows an error telling you to fetch from your mirror.

Notifications & invites (session)

GET/api/notifications

In-app notifications. PATCH marks read; DELETE clears.

GET/api/invites

Your sent invites. POST to invite by email.

Operations

Errors, idempotency & rate limits.

Predictable failure modes and replay safety for any integration that can't afford double-writes.

  • Status codes — 200/201 success, 400 validation, 401 missing, invalid or expired token, 402 out of credits, 403 not allowed (e.g. failed step-up), 404 not found, 409 conflict (e.g. project slug taken), 429 rate-limited.
  • Error body — always { "error": "human-readable", "code"?: "snake_case_key" }. Auth failures use missing_token, invalid_token or token_expired.
  • Idempotency — session creation accepts an externalId; commit registration is idempotent by SHA + project.
  • Rate limits — session creation, message appends, commit capture, runs and git pushes are capped per user at 30 req/min and 300 req/hour. Agent chat has its own 20/min, 200/hour and a daily token quota. Exceeding a limit returns 429 with a Retry-After header.
  • Credits — premium actions deduct prepaid credits: agent chat turn 1, git push 2. Commit capture is free, and so are runs and evals while they're a simulated preview. Marketplace purchases cost the listing's price. Out of credits → 402 { "code": "insufficient_credits" }.
  • SDK — VibeHubError carries .status, .code and the parsed .body.
MCP

Model Context Protocol server.

vibehub-mcp is a stdio MCP server. Drop it into any MCP-capable IDE and the agent gains a small toolbelt that records the chat and attaches it to commits.

Install

# install globally
npm i -g vibehub-mcp

# or run on demand
npx vibehub-mcp

The server reads two env vars: VIBEHUB_API_URL (defaults to https://www.vibehub.co) and VIBEHUB_TOKEN (required — same vbh_… token as the SDK).

Like the SDK, the npm package is rolling out — until it lands, run it from a repo checkout: node mcp/src/server.js (or npm link inside mcp/).

How sessions work

A session is an open conversation. It starts open, accumulates messages, and becomes attached when linked to a commit, unless it was started with kind: "live", in which case it stays open and current across commits. The current session id is persisted at ~/.vibehub/mcp-state.json so tools like vibehub_append_message can omit sessionId.

Encourage the agent to actually use these tools by adding an instruction to your project rules file (.cursorrules, AGENTS.md, etc) — see the patterns below.

MCP

The vibehub_* toolbelt.

Every MCP-capable agent that mounts the server sees these tools. Each wraps an SDK call, and they persist the “current session” locally so the agent doesn't need to thread an id everywhere.

Session capture

vibehub_whoami

Check the token: returns the signed-in user and when the token expires.

vibehub_start_session

Open a new session and remember it as current. Call once per chat; kind:'live' keeps it open across commits.

vibehub_append_message

Append a single user/assistant/tool/system message.

vibehub_append_messages

Batch-append messages (useful for backfilling).

vibehub_attach_to_commit

Link the session to a SHA (closing it unless live). Creates the commit row if needed.

vibehub_current_session

Return the active session id, status, kind, and message count.

vibehub_list_sessions

Recent sessions, filterable by status or project.

vibehub_list_projects

List the user's VibeHub projects (id, slug, name).

vibehub_create_project

Create (or reuse) a project by name. Sets visibility.

Commit history

vibehub_capture_commit

One-shot commit + conversation capture — the MCP equivalent of vb commit.

vibehub_list_commits

Recent commits for a project, newest first, with stats.

vibehub_get_commit

One commit + linked conversation. Accepts short SHA prefixes (≥4 hex chars).

vibehub_get_commit_diff

File list for a commit, or the per-file unified diff when path is passed.

vibehub_blame

Approximate per-line attribution for a file, replayed from stored diffs.

Branches & GitHub mirror

vibehub_list_branches

Branches VibeHub tracks for a project, with head SHAs.

vibehub_upsert_branch

Create or update a tracked branch; headSha advances the head, isDefault swaps the default.

vibehub_get_mirror

Read the GitHub mirror config and last push/receive status.

vibehub_set_mirror

Configure the mirror. PAT stored encrypted server-side; omit token to keep the existing one.

vibehub_rotate_mirror_webhook

Generate/rotate the inbound webhook secret — plaintext returned once, with the payload URL to register.

Suggested agent instructions

Paste into your IDE's system prompt, project rules, or AGENTS.md:

Use the `vibehub_*` tools to record this conversation.
  • Call vibehub_start_session once at the start with source set to the IDE name.
  • After every assistant response, call vibehub_append_message with role
    "assistant" and the response content.
  • When the user commits, call vibehub_attach_to_commit with the SHA.
MCP

IDE configuration.

Anywhere that accepts a stdio MCP server command + args + env, the same three lines work.

Cursor

~/.cursor/mcp.json

json{
  "mcpServers": {
    "vibehub": {
      "command": "npx",
      "args": ["-y", "vibehub-mcp"],
      "env": {
        "VIBEHUB_API_URL": "https://www.vibehub.co",
        "VIBEHUB_TOKEN": "vbh_…"
      }
    }
  }
}

Claude Desktop

macOS ~/Library/Application Support/Claude/claude_desktop_config.json · Windows %APPDATA%\Claude\claude_desktop_config.json · Linux ~/.config/Claude/claude_desktop_config.json

json{
  "mcpServers": {
    "vibehub": {
      "command": "npx",
      "args": ["-y", "vibehub-mcp"],
      "env": {
        "VIBEHUB_API_URL": "https://www.vibehub.co",
        "VIBEHUB_TOKEN": "vbh_…"
      }
    }
  }
}

Windsurf · Zed · JetBrains · Visual Studio · Continue.dev

Any MCP-capable IDE uses the same command + args + env shape — the exact config file changes, but the contents don't. Ready-made templates for each IDE live under integrations/<ide>/mcp.template.json in the repo, with per-IDE guides on the dashboard's Integrations page.

json{
  "command": "npx",
  "args": ["-y", "vibehub-mcp"],
  "env": {
    "VIBEHUB_API_URL": "https://www.vibehub.co",
    "VIBEHUB_TOKEN": "vbh_…"
  }
}

Windows: npx is a .cmd script there, and editors that launch MCP servers without a shell (Claude Desktop, Zed) fail with spawn npx ENOENT. Use "command": "cmd", "args": ["/c", "npx", "-y", "vibehub-mcp"] instead. The npx vibehub-* installers write this for you.

For zero-friction commits, point your IDE's commit flow at vb commit --attach-session <id> — the CLI calls attach_to_commit for you.

Agent

How often Vibe picks the right tool.

Vibe, the in-app agent, is graded against a fixed set of requests: routing, writes held for approval, refusals of destructive or injected actions, and multi-step chains.

Published agent eval results
ModelPass rateGradedp95 latencyCost / caseMeasured
Keyword router (no model)100.0%39/39 (3 runs)1232 ms$02026-11-12

No Claude model has a published run yet. The keyword router is the built-in mode used without an API key; it is graded only on the cases it is meant to handle, and its latency reflects local streaming, not a model. Fixture: tests/eval/router.json. Model notes and the switching rule live in docs/agent-models.md.

shellnpm run db:seed
ANTHROPIC_API_KEY=… npm run eval:agent -- --model claude-sonnet-4-6 \
  --user-email demo@vibehub.co --publish