Documentation

Integration

How external systems connect to Intent.

Authentication

How external tools and scripts prove their identity when calling Intent's REST API or MCP Server. Both surfaces use the same mechanism: an API key sent as a bearer token. This page covers creating, scoping, and revoking those keys.

Get an API key

API keys are created from Settings → API Keys by a signed-in user of the organisation — there is no self-service signup flow for integrators. Once you have a key, hand it to whatever external tool or script needs it (MCP client, CI job, custom integration).

  1. Open the API Keys pane and click +.
  2. Choose a key type (see below) and give it a descriptive name.
  3. Optionally set an expiration date.
  4. Click Create. The full key is shown exactly once, in the form int_....
  5. Copy it immediately — Intent only ever stores a hash plus the last 4 characters (shown as ••••1234 afterward) and cannot show the raw value again.

Key types

  • Personal — tied to the creating user's account. Any org member can create one. Actions taken with the key are attributed to that user, and the key carries that user's permissions.
  • System — organisation-wide, meant for shared automation (CI, bots). Creating one requires the organization:manage permission (org-admins). Behind the scenes Intent creates a hidden "synthetic" user to own the key; that synthetic user never appears in the member list.

Authenticate requests

Send the key as a bearer token on every request:

Authorization: Bearer int_<your-key>
  • On the REST API (/api/v2/...), this is checked by the same auth middleware used for browser sessions — it accepts either a signed-in user's session token or an API key.
  • On the MCP endpoint (/mcp), only API keys are accepted, and the key's owner must additionally hold the mcp:use permission (see below).
  • Missing or malformed Authorization headers return 401 Unauthorized. A syntactically valid but unknown, expired, or revoked key also returns 401.
  • A valid key whose owner lacks the permission required for the endpoint returns 403 Forbidden.

Permissions and scopes

An API key has no permissions of its own — it inherits whatever permissions its owning user's role grants at the time of the request. Roles and their scopes:

  • org-admin — full access, including organisation and user management, and system-key creation.
  • org-member — read/write on projects, changesets, artifacts, comments, pull requests; can use chat and MCP; cannot manage the organisation or other users.
  • org-user — limited to changesets, comments, and chat on assigned work; no mcp:use, so personal keys owned by an org-user cannot call the MCP server.
  • bug-report-embed — a special role used only by the Bug-Report Widget's embed keys; scoped to widget endpoints only and not usable for general REST or MCP access.

If you need a key that can call MCP tools, it must belong to an org-admin or org-member (personal key) or be a system key (which is created under an org-member-equivalent synthetic user).

Revoke a key

  • Open the API Keys pane, hover the key, and click the trash icon, then confirm.
  • Revocation is immediate: any client still presenting that key gets 401 on its next request.
  • Org-admins can revoke any key in the organisation. Non-admins can only revoke their own personal keys.
  • Revoking a system key also deactivates its underlying synthetic user.

Organisation suspension

If the organisation's subscription has ended, authentication fails for every key and session in that organisation — including org-admins — with a dedicated "subscription ended" error rather than a generic 401. Restore access by resolving billing in the product before retrying.

Related topics

  • REST API
  • MCP Server
  • Bug-Report Widget

REST API

Intent exposes a versioned REST API for managing everything in a project: organizations, projects, repositories, changesets, specs, conversations, pull requests, and more. This page is for developers integrating against that API directly — for example scripting changeset creation from CI, syncing project data into another system, or building a custom client. It assumes you already have a bearer token or API key; see Authentication for how to obtain one.

Base URL and versioning

All endpoints are served under a single versioned prefix on the Intent API host:

https://api.onintent.build/api/v2/...

The API is JSON in, JSON out. Requests that accept a body must send Content-Type: application/json; responses are application/json unless otherwise noted (a few endpoints return text/event-stream for live updates — see Realtime Events).

A small set of routes are unauthenticated and exist for account bootstrapping rather than integration use: /auth/signup, /auth/forgot-password, and the Stripe webhook receiver. Every other route requires a bearer token.

Authenticate requests

Send the token as a standard bearer header:

Authorization: Bearer <token>

Two kinds of tokens are accepted:

  • User session tokens — issued at login, tied to a person and their role.
  • API keys — created via POST /api-keys, tied to either a person (personal) or the organization (system, admin-only). Use GET /api-keys to list keys visible to you and DELETE /api-keys/{id} to revoke one.

Every authenticated request resolves to a CurrentUser with an organization ID and a set of permission strings (e.g. changeset:read, project:write, artifact:write). Each endpoint requires a specific permission; a request from a token that lacks it gets 403 Forbidden. A request with no token, or an invalid/expired one, gets 401 Unauthorized. GET /auth/me returns the identity and permission list for the current token, which is a useful way to confirm what a key can do.

All data is scoped to the token's organization — you cannot read or write another organization's projects, changesets, or files through this API, regardless of ID.

Explore the resources

The API is organized into resource groups, each mounted under /api/v2. The main ones:

Group Base path Covers
Organizations /organizations The tenant boundary; list and fetch org details and supported chat models.
Projects /projects Create, update, deactivate/reactivate projects; per-project design feed.
Repositories /repositories, /projects/{id}/repositories Connect git repositories for code indexing; validate access.
Teams / Users /teams, /users Team and user management within an organization.
Changesets /changesets, /projects/{id}/changesets The core unit of work — create, update status/todos/relations, watch/unwatch.
Changeset files & attachments /changesets/{id}/files, /changesets/{id}/attachments Mockup pages and uploaded files attached to a changeset.
Artifacts /artifacts Specs (reports, drafts, locked specs) linked to changesets.
Comments /changesets/{id}/comments Discussion threads on a changeset.
Conversations / Chat /conversations, /chat Chat sessions backing changesets and documentation topics.
Pull requests /pull-requests PRs opened by agents against linked repositories.
Credentials /credentials, /personal-git-credentials Org-wide and per-user git/provider credentials.
Workflow /workflow Start-work / close-as-not-implemented actions on a changeset.
Documentation /documentation-topics Topics and versioned documents (what powers this Docs section).
Token usage / Billing /token-usage, /billing LLM consumption analytics and billing state.
Notifications /notifications In-app notifications, e.g. from watched changesets.

Every group's endpoints follow the same shape:

  • GET /projects/{projectId}/<resource> — list resources under a project, and GET /<resource>/{id} — fetch one.
  • POST /<resource> — create.
  • PATCH /<resource>/{id} — partial update; only fields present in the body are changed.
  • DELETE /<resource>/{id} — delete, where allowed.

Changesets, in detail

Changesets are the unit most integrations care about. POST /changesets creates one in a project (name and optional team, type, repositories, features); PATCH /changesets/{id} updates status, description, todos, and relations such as blocked_by. Some fields lock once work starts:

  • The name can no longer be changed once the changeset is in_progress, completed, or cancelled.
  • The description can no longer be changed once it's completed or cancelled.
  • Only changesets in draft, backlog, or next status can be deleted.

GET /projects/{projectId}/changesets supports createdBy plus updatedAfter / updatedBefore / createdAfter / createdBefore query filters (ISO timestamps) for pulling incremental changes. Completed changesets in a list response are capped at the 50 most recently completed; active changesets are always returned in full.

Filtering conventions

Several list endpoints (repositories, changesets) accept the same date-range query parameters — updatedAfter, updatedBefore, createdAfter, createdBefore — for polling changes since a checkpoint. A malformed timestamp returns 400 Bad Request.

Data models

The fields below are the ones you'll actually read and write via the API. Every resource also carries id, organizationId, createdBy/updatedBy, and createdAt/updatedAt, which are omitted here for brevity.

Project

The container most other resources live under.

Field Type Notes
name string Display name.
aiLanguage string Language for AI output; defaults to English.
aiModel string null
systemPrompt string Free-text context injected into chat system prompts.
autoImplementationEnabled boolean Whether "Start Work" can offer auto-implementation for this project.
deactivatedAt timestamp null

Repository

A git repository connected to a project for code indexing.

Field Type Notes
projectId UUID Parent project.
name, remoteUrl string Display name and clone URL.
provider enum Git provider (github by default; required explicitly for self-hosted instances).
credentialId UUID Credential used to access the remote.
defaultBranch string Branch that gets indexed; defaults to main.
indexingStatus enum pending, cloning, scanning, chunking, enriching, embedding, ready, or error.
isActive boolean Whether indexing is enabled.
currentHeadSha string null
deletedAt timestamp null

Changeset

The core unit of work — a named change tracked from idea through to a merged pull request.

Field Type Notes
projectId, teamId UUID Parent project and owning team (teamId nullable).
name, description string See the locking rules above.
implementationPlan string null
type enum null
status enum draft, backlog, next, in_progress, completed, cancelled.
repositoryIds, featureIds UUID[] Linked repositories and features.
todos array { id, label, checked, assigneeId } items.
relations array { targetId, type }; currently only blocked_by.
watcherUserIds UUID[] null
effort number null
workStartedAt, completedAt timestamp null
isWatching boolean Computed relative to the calling user; not settable directly.

Artifact

A spec document produced in a conversation and optionally linked to a changeset — what the Docs and spec-locking features are built on.

Field Type Notes
projectId, changesetId, conversationId UUID / null What the artifact belongs to.
lineageId UUID Stable ID shared by every version of the same document.
title, content string The document itself (markdown).
version positive int Increments per lineage; (lineageId, version) is unique.
artifactType enum documentation or rule.
isLocked boolean Locked specs are the ones snapshotted when a changeset completes.

Pull request

A PR opened by an agent against a linked repository, tracked for status and review.

Field Type Notes
repositoryId, changesetId UUID / null What the PR was opened for.
externalId string The provider's PR number/ID.
sourceBranch, targetBranch string Git branches involved.
title string PR title.
status enum open, merged, closed.
draft boolean Whether the PR is a draft on the provider.
lastPolledAt timestamp null
assigneeId, reviewerId UUID null

Handle responses and errors

Errors are returned as JSON with a _tag discriminator and a human-readable message, alongside the matching HTTP status code, for example:

{ "_tag": "ChangesetNotFoundError", "id": "..." }

Common status codes:

  • 400 — malformed request body or query parameter.
  • 401 — missing or invalid bearer token.
  • 403 — token lacks the required permission for that route, or the resource's organization doesn't match the token's.
  • 404 — resource not found (e.g. ChangesetNotFoundError, ProjectNotFoundError).
  • 409 — conflicting state (e.g. creating a duplicate, or exporting a documentation topic with no accepted content).

Deactivated projects return 403 with ProjectDeactivatedError for any endpoint scoped to that project, rather than exposing partial data.

Related topics

  • Authentication
  • Realtime Events
  • MCP Server

Intent exposes an MCP (Model Context Protocol) server so AI agents and MCP-compatible clients — Claude Desktop, Cursor, custom agents — can browse projects, read specs and code, and drive changesets programmatically. This page covers how to connect, what tools are available, and how streaming progress and errors behave.

Authenticate and connect

The server speaks MCP over Streamable HTTP (JSON-RPC 2.0 over HTTP POST) at:

POST https://api.onintent.build/mcp
  1. Create an API key in Intent (personal or system) and grant it the mcp:use permission. See Authentication for how API keys and permissions work.
  2. Send every request with Authorization: Bearer <api-key>.
  3. Send the standard MCP initialize request first. The server returns a session id in the Mcp-Session-Id response header — echo that header on all subsequent requests in the session.
  4. Call tools/list to fetch the tool catalog, then tools/call to invoke a tool by name.

Auth failures:

  • No Authorization header, or a malformed/invalid bearer token → 401 Unauthorized.
  • Valid key but missing mcp:use → 403 Forbidden.
  • If the server responds 404/410 for a session (e.g. it expired), discard the session id and re-run initialize.

OPTIONS /mcp (CORS preflight) is never auth-checked.

Two compatibility behaviors to expect from responses, useful if you're writing a client from scratch:

  • Single-element JSON-RPC batch arrays are unwrapped to a single response object.
  • The initialize response always advertises the logging capability, since tool handlers stream progress via notifications/message (see below) even though the underlying AI SDK doesn't declare it by default.

Available tools

Tools operate on the same projects, changesets, and specs you see in the Intent UI, scoped to the organization the API key belongs to.

  • Projects — list_projects.
  • Changesets — list_changesets (filter by status, type; capped at 50 results), get_changeset (status, todos, comments, linked repos), update_changeset (replace status and/or the full todo list), add_comment.
  • Specs — list_artifacts, get_artifact (full markdown content of a spec).
  • Codebase — read_file (path is repo-name/relative/path, with optional startLine/endLine), explore (see below).
  • Repositories & pull requests — list_repositories, list_pull_requests (includes a ready-to-open PR URL per result), link_repository (links a repo to a draft/backlog/next changeset, or creates a branch and draft PR if the changeset is already in_progress).
  • Changeset authoring — create_changeset and refine_changeset (below).
  • Documentation topics — list_documentation_topics, get_documentation_topic (published content and any pending draft), refine_documentation_topic.

Tool failures come back as typed result objects rather than protocol-level errors — check the result shape (e.g. a _tag field like ChangesetNotFoundError or RepositoryNotFoundError) rather than relying on the JSON-RPC error channel.

Explore the codebase and specs

explore takes a projectId and a natural-language question and returns an AI-synthesized answer, citing sources at the end. Internally it searches code chunks, specs, and changesets, and can fall back to web search — the same investigation flow used by Intent's own chat.

While explore (and the other AI-driven tools below) are running, the server pushes notifications/message log notifications so a client can show live progress. Each notification has a logger field identifying which tool is running (explore, refine_changeset, create_changeset, refine_documentation_topic) and a data string describing the current step, e.g. "Searching code for auth middleware" or "Fetching docs.example.com". A client that doesn't render logging notifications simply waits for the final tool result.

Create and refine changesets from MCP

  • create_changeset turns free text — a bug report, a Slack thread, a feature idea — into a changeset. Pass projectId, raw text, and a mode:
    • headless runs the specify AI to completion in one call. It promotes the changeset to backlog if the API key's owner has a team; if the text doesn't contain enough information, the call fails and nothing is left behind.
    • interactive creates a draft changeset, runs one AI turn, and returns — continue the conversation with refine_changeset or by opening the changeset in the Intent UI.
  • refine_changeset sends a short instruction to an existing changeset's specify AI conversation (e.g. "bring this bug description up to the current format" or "update specs to reflect the API change below"). It reuses the same prompt and tools as the Intent chat UI, so you don't need to spell out section headings or markdown templates — just describe the change.
  • refine_documentation_topic works the same way for a documentation topic's authoring chat: it drafts a pending update but never publishes it — publishing still happens through the Intent UI.

Related topics

  • Authentication
  • REST API

Intent pushes live changes over a per-project Server-Sent Events (SSE) stream, so an integration can react to new changesets, pull requests, artifacts, and conversations without polling the REST API. This page covers how to open that stream, what it sends, and how to reconnect safely.

Subscribe to a project's event stream

Open a GET request against:

GET /api/v2/projects/{projectId}/events
Accept: text/event-stream
  • Use the same authentication as the REST API — see Authentication for how to obtain credentials. The caller needs the project:read permission on {projectId}.
  • The server returns 404 if the project does not exist, and a deactivated-project error if the project has been deactivated.
  • The response is a standard text/event-stream body with Cache-Control: no-cache, no-transform and Connection: keep-alive. Keep the connection open and read it as a stream — do not buffer the whole response before processing.
  • Each project has its own stream. There is no organization-wide or multi-project stream; open one connection per project you need to watch.

Event payload format

Every event is sent as a single SSE data: line containing one JSON object:

data: {"entity":"changeset","action":"updated","data":{...}}

Two shapes exist, depending on the action:

  • created / updated — { "entity": "<type>", "action": "created" | "updated", "data": <full entity object> }. data is the same representation returned by the corresponding REST endpoint for that entity.
  • deleted — { "entity": "<type>", "action": "deleted", "id": "<entityId>", "projectId": "<projectId>" }. Deletions never include the full object, only its id.

The entity field is one of:

  • changeset
  • pullrequest
  • artifact
  • changeset-file
  • conversation
  • notification
  • documentation_topic

A single stream carries all of these entity types for the project — filter client-side on entity (and, for notification, on the recipient) for the ones you care about.

Keepalives, timeouts, and reconnecting

  • The server sends a :ka comment line roughly every 5 seconds as a heartbeat. Treat a long gap with no bytes at all (heartbeat or event) as a dead connection and reconnect.
  • The server closes each stream after 2 hours regardless of activity. This is expected — reconnect and resume.
  • The stream has no replay or backfill: events that occur while you are disconnected are not redelivered when you reconnect. After a reconnect, refetch current state for anything you track (e.g. GET /projects/{projectId} resources you care about) rather than assuming the stream is a complete log.
  • Reconnect with backoff (for example, starting around 1 second and doubling up to a ceiling around 30 seconds) instead of retrying immediately in a loop.

Related topics

  • REST API
  • Authentication

The bug-report widget lets you embed an AI-guided chat into your own application or intranet so your users can report problems directly into a specific Intent project — without ever having an Intent account. This page covers how to obtain a widget token, embed the loader script, and drive the widget from your own page.

What the widget does

Once embedded, the widget opens an AI chat that only accepts bug reports. It asks the reporter targeted follow-up questions, and — unless the person declines — submits a changeset of type bug into the project you configured. It does not accept feature requests, and it cannot access any other part of Intent (no changeset history, no project settings, nothing beyond filing a report).

Get a widget token

Widget tokens are created from the Intent UI, not from the API — an org admin must:

  1. Open Settings → Widget in the Intent app.
  2. Click New widget token and give it a descriptive name (e.g. Intranet Production).
  3. Copy the token shown in the setup guide. It is shown once — store it securely on your side (server-side config, secrets manager, or a build-time environment variable). It is not retrievable again after the dialog closes.

A widget token is scoped to the whole organization, not a single project. The project a report lands in is chosen separately, per embed, via data-project / projectId (see below) — so one token can back widgets for several projects if you set the project per script tag or per open() call.

Revoking a token (from the same settings pane, or by deleting the corresponding widget configuration) disables every widget using it immediately.

Embed the loader script

Add the loader script to any page that should offer the widget:

<script
  src="https://app.onintent.build/widget.js"
  data-token="YOUR_WIDGET_TOKEN"
  data-project="YOUR_PROJECT_ID"
></script>
  • data-token — the widget token from the setup guide.
  • data-project — the ID of the project bug reports should be filed against.

The script exposes a global IntentWidget object with open() and close(). It does not render anything until you call open().

Open and close the widget

IntentWidget.open(document.getElementById('intent-container'), {
  user: {
    name: 'Ada Lovelace',
    email: 'ada@example.com',
  },
  context: [
    { type: 'text', content: 'Error: Something went wrong on /dashboard' },
  ],
})

IntentWidget.open(element, options?)

  • element (required) — a DOM element to render the chat iframe into. The iframe fills its container (width: 100%; height: 100%), so size the container yourself.
  • options.token / options.projectId — override the script tag's data-token / data-project for this call only.
  • options.user — { name?, email? }. Identifies the reporter on the resulting conversation and changeset; omit if you don't have an identity to pass.
  • options.context — an array of context items attached to the reporter's first message (see below).
  • options.theme — 'light' | 'dark' | 'system' (default 'system').

Calling open() again is idempotent: it replaces the existing iframe rather than stacking a second one.

IntentWidget.close() removes the iframe from the DOM. Call it when your own UI (e.g. a modal or panel) is dismissed.

Passing page context

Context items give the AI a head start before the user types anything. Two shapes are supported:

  • { type: 'text', content: string } — free text, e.g. a captured error message, the current URL, or app/browser metadata.
  • { type: 'image', data: string, mimeType: string } — a base64-encoded screenshot. data is the raw base64 payload (no data: prefix); mimeType is the image's MIME type (e.g. image/png).

Both are sent with the reporter's first message only — they don't apply to messages sent later in the conversation. Image context items are uploaded as ordinary chat attachments behind the scenes, so the same size/type limits described below apply to them.

Security and scope

  • A widget token authenticates as a synthetic, organization-scoped user with only two permissions: widget:chat and widget:validate. It cannot read or write anything else in Intent — not other projects, not changesets outside the bug-report flow, not settings.
  • The widget page itself runs in an iframe and validates the token/project pair against the BFF before rendering any chat UI; an invalid or revoked token renders a "This widget is not available" state instead of the chat.
  • Treat the widget token like any other credential: don't commit it to a public repo. Since it's designed to be embedded in client-side HTML, its blast radius if leaked is limited to submitting bug reports to the configured project(s) — but revoke and reissue it if you suspect misuse.

Attachment limits

Reporters can attach files during the conversation (and image context items count against the same limits):

  • Up to 10 attachments per message.
  • Up to 10 MB per file.
  • Allowed types: PNG, JPEG, GIF, WebP images; PDF; Word, Excel, and PowerPoint documents (and their legacy formats); plain text, CSV, Markdown, and HTML.

Oversized or unsupported files are rejected before upload with a descriptive error.

Related topics

  • REST API
  • Authentication