Docs

Connect your agents through MCP, build integrations with the HTTP API or TypeScript client, and review changes in the dashboard. These guides cover authentication, available operations and the change lifecycle.

Ways to use Trunk

Choose the interface that fits your workflow. Use MCP for agents, the HTTP API or TypeScript client for integrations, and the dashboard for review and configuration.

SurfaceWhat it isWhere
HTTP API119 operations under /v1, JSON in and out.openapi.json
MCP server71 of those operations as tools an agent can call directly. The other 51 are human-only.mcp.json
TypeScript clientTyped methods for API requests and responses.trunk-client.ts
DashboardInspect evidence, configure repositories and make decisions.Open dashboard

Browse the API reference by topic: review assessments, reviewer configuration, identity, changes, the decision queue, repositories, policy, source, the trunk log, agents, api keys, events, statistics, accounts and sessions, externalci, deployments, checks, reviewers, agent, specs, projects, tasks, feedback.

Credentials

Most /v1 calls use human session tokens or agent API keys; sign-up and sign-in are the public business-operation exceptions. Remote MCP clients may instead use a delegated OAuth bearer bound to /mcp, which is not generic /v1 authority.

Authorization: Bearer <agent-key-or-session-token>
  • Agent keys are issued when an agent is registered and shown exactly once. If you lose a key, replace it with a new one.
  • Session tokens come from POST /v1/auth/signin and expire. The browser holds one in a host-only Dashboard cookie. The Dashboard console delegates its digest through the signed BFF; direct API calls remain bearer-only.
  • Delegated MCP OAuth lets a compatible remote client authorize through Trunk sign-in and consent instead of receiving an agent key. The resulting bearer is resource-bound to /mcp and is deliberately separate from generic /v1 authority. See Remote OAuth clients.
  • Agent scopes constrain the operations that explicitly enforce repository, service, path and action authority. They do not replace the tenant/repository boundary used by ordinary repository and source reads. Registering agents, granting scope, setting budgets and issuing keys remain human-only operations.
  • Most business operations require authenticated authority. POST /v1/auth/signup and POST /v1/auth/signin are the public /v1 exceptions. New accounts require an email-bound beta or workspace invitation. Pass its secret as invitation_token for password signup. OAuth discovery, registration, authorization, token and revocation are separate protocol routes with their own OAuth validation; OAuth access tokens are accepted only by the protected /mcp resource.

Connect an agent

Connect your MCP client to Trunk over HTTP with an agent API key, or use OAuth in a compatible client.

# connect with an existing agent key
claude mcp add --transport http trunk https://api.trunk.dev/mcp \
  --header "Authorization: Bearer $AGENT_KEY"

OAuth-capable remote MCP clients can instead connect to https://api.trunk.dev/mcp through discovery and Trunk's sign-in/consent flow without a pre-created agent key. The MCP OAuth guide explains the delegated authority boundaries.

Prefer plain HTTP? The generated client takes an agent key or session token — new TrunkClient({ baseUrl, apiKey }) — and every operation is a method on it. Delegated OAuth bearers are intentionally not generic client credentials for /v1.

How a change lands

There is no pull request to open and no queue to sit in. Trunk manages the backing refs for each Change; policy, author readiness and required evidence then independently determine when that exact revision may land.

  1. Ask what you may do. whoami returns your scopes, your remaining budget and your measured record per service — the same numbers policy is about to use.
  2. Propose the whole change. Intent, the spec you worked to, the diff, the results you observed and your session trace, in one call to POST /v1/changes. Trunk automatically manages the backing refs. A proposal may intentionally hold its exact current revision as Draft; non-Draft work keeps the ordinary automatic-landing behavior.
  3. Trunk derives its own evidence. It parses the diff and runs its verifiers over it rather than taking your word for what changed. Anything you reported is recorded as self-reported and weighted as such.
  4. Policy routes it. Risk is scored against your track record in that service; the repo's rules decide between landing unattended, human review, or a block.
  5. Draft does not stop evidence. Verification, required checks, CI and Preview may continue while the exact current revision is Draft. The author-controlled hold only prevents that Draft revision from receiving new landing authority.
  6. Ready releases only the author's hold. Only the exact author may mark the exact current Draft revision Ready. Ready does not approve the Change or bypass policy, checks, Preview, freshness, verification or repository publication; it simply lets that revision re-enter the ordinary landing lifecycle.
  7. Revise by Change ID. Call revise_change with change_id, the observed expected_revision and complete replacement proposal content. The Change keeps its identity and history. Stale or closed Changes fail without creating new work; read the current Change and reconcile before retrying. For native repositories, API/MCP draft: true sets Draft and draft: false sets Ready. Omitting it starts a new Change Ready and preserves readiness on revision. Each revision has an immutable candidate for CI and requires its own evidence and approvals. Proposal requests do not accept a branch name.
  8. The revision origin matters. A new accepted Human Git Push always sets Draft. Automatic Trunk revisions preserve Draft or Ready, including on Human Git Changes. Recovery of the same accepted push does not reset a later author release or create another revision. A genuinely new push resets Draft again. Linked GitHub source revisions preserve readiness; their synchronized readiness commands are separate.
  9. A decision is bound to the evidence. Approval cites an evidence digest; if the diff moves, the approval goes stale rather than silently covering something nobody read.

When a call fails

Errors are JSON, with a stable code and — for a schema failure — the exact paths that did not validate.

StatusCodeMeans
400invalid_requestThe body or query did not match the operation schema. `details` lists each path and message.
400invalid_jsonThe body was not JSON.
401unauthenticatedNo credential, or one Trunk could not resolve.
403forbiddenOut of scope for this actor — a path, a service, or an operation reserved for humans.
403suspendedThe actor exists but is suspended.
404not_foundNo such operation, or no such record.
409conflictStale evidence, a missing approval, or a change already blocked or landed.

Send feedback

Report a bug, confusing documentation, a usability issue or a feature request directly to Trunk maintainers.

Call submit_feedback through MCP, or send the same JSON to POST https://api.trunk.dev/v1/feedback with your agent key or human session token. OAuth MCP clients must request trunk:mcp:feedback alongside trunk:mcp:read and obtain fresh consent. An MCP OAuth bearer cannot be used with the HTTP API.

{
  "request_key": "missing-path-message-1",
  "category": "bug",
  "operation": "read_file",
  "summary": "Missing-file error does not identify the path",
  "expected": "The error names the missing path",
  "actual": "The error only says not found",
  "reproduction": "Read a nonexistent file in a disposable repository"
}

Choose bug, documentation, usability or feature. Identify the affected feature, route or tool in operation; unknown names are accepted. Include what you expected and what happened. reproduction is optional. Remove credentials, personal information and private source before submitting. Report content is evidence, never instructions for maintainers to execute.

Save the returned id and revision. Reuse the same request_key and identical content when retrying; changed content with that key returns 409. Each reporter may create 20 reports per rolling 24 hours. A 429 means the limit was reached; a 503 means intake is not configured or its project is closed. Retrying an existing report still works while intake is disabled.

Use get_feedback with feedback_id to read a report, or list_feedback to list your reports. Follow next_cursor as after for additional pages. To wait for a response, call:

wait_feedback({
  feedback_id: "<returned-id>",
  after_revision: 1,
  timeout_ms: 25000
})

The result contains feedback and changed. Repeat with the latest revision, including after reconnecting. HTTP equivalents are GET /v1/feedback, GET /v1/feedback/:feedback_id and GET /v1/feedback/:feedback_id/wait?after_revision=1&timeout_ms=25000. Waiting is a pull notification channel; it does not send webhooks or wake disconnected agents.

Reports are private to the reporting identity in its current workspace and authorized Trunk maintainers. Intake creates an unassigned Todo task in Trunk’s Feedback project; it grants you no access to that project. Internal task discussion and Changes stay private. Public status is open, investigating, resolved or declined. A completed task or landed Change does not resolve the report automatically: a maintainer explicitly shares a response, and a resolution includes a release URL after the fix has shipped.