Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Reason Workspace events API
version: 3.0.0
description: 'The Reason HTTP API. Drive cloud software-engineering agents: open sessions against your repositories, stream their work, and manage the secrets, skills, and automations they run with.
Authenticate with a Reason API key sent as a bearer token. New keys use `reason_`; legacy `ara_` keys remain accepted. Every resource is scoped to an organization; resolve your `org_id` once with `GET /v3/self`.'
servers:
- url: https://api.reasonmachines.com
security:
- reasonApiKey: []
tags:
- name: Workspace events
description: 'Follow a whole workspace without polling each Session. streamWorkspaceChanges is a Server-Sent Events stream of view revisions: when a topic''s revision moves, re-read that view. streamWorkspaceEvents is a resumable Server-Sent Events stream of what happened (a message added, a turn finished), replayed from Last-Event-ID for 7 days. Event webhooks POST the same events, signed (Standard Webhooks), to endpoints you register. sessions:read reads; webhooks also need automations:read / automations:write; the devices topic also needs devices:read.'
paths:
/v3/organizations/{orgId}/changes:
parameters:
- $ref: '#/components/parameters/orgId'
get:
operationId: streamWorkspaceChanges
x-reason-mcp: false
tags:
- Workspace events
summary: Stream workspace changes
description: 'A Server-Sent Events stream (`text/event-stream`) that says when a workspace view changes, so a client re-reads that view instead of polling it. Requires sessions:read.
Frames, each a JSON `data` line:
- `hello` first: `{"revisions": {topic: revision, ...}, "push": bool}` with every topic this stream carries.
- `rev` when something changed: `{"revisions": {...}}` with only the topics whose revision moved. Re-read those views.
- `pulse` every 45 seconds while nothing changed: `{"push": bool}`. `push` false means the server is detecting changes by polling for a while; frames still arrive, a second or so later.
- `error` before the server ends the stream because the key, its workspace, its IP access list, the account or a watched Session no longer admits the caller: `{"error": code, "message": text}` (`invalid_token`, `missing_scope`, `org_not_found`, `ip_not_allowed`, `session_access_changed`, ...). Reconnect only after fixing the cause; `session_access_changed` reconnects at once and drops that Session.
- `reconnect` when the client should come back: `{"reason": "server_draining", "retry_ms": 0}` when the server restarts, or `{"reason": "auth_unavailable", "retry_ms": 5000}` when the key could not be re-checked for a few minutes. Reconnect after `retry_ms`; the next `hello` carries the current revisions, so compare them with what you last read.
Topics. A revision is an opaque string: compare it for equality, never order it.
- `sessions`: the Session list (a Session started, renamed, archived, moved or changed status or activity). Re-read listSessions.
- `reasons`: the Reasons (a Reason added, archived, renamed or re-instructed). Re-read listReasons.
- `devices`: connected Devices and their roots, online state and sharing. Only with devices:read. Re-read listDevices.
- `connections`: the workspace''s plugins and connections (one installed, removed, enabled, disabled, signed in or out, re-credentialed, edited or checked; a Reason''s own installation, a plugin''s bundled skills or its per-Reason settings changed), from any surface. Only with mcp:read. Re-read listPlugins or listConnections; streamWorkspaceEvents'' `plugin.*` and `connection.*` events say which one changed.
- `incident`: Reason''s own incident banner.
- `session:{id}:workspace`, `:sidechats`, `:machine_target`, `:shared_links`, `:hands_target`, `:pull_requests`, `:machine_runtime`: views of a Session named in `sessions`. `workspace` moves with its record (status, title, privacy); `pull_requests` with its pull requests'' state; `machine_runtime` with its computer parking or waking. `hands_target`, `machine_target` and `machine_runtime` show Devices and computers, so they come only with devices:read.
A Session id in `sessions` the key''s owner may not read through this API is left out, not an error. The stream re-checks the key, its workspace, its IP access list, the account and each watched Session before any frame once 30 seconds have passed since the last check, and at every 45-second pulse, and ends with an `error` frame when one no longer admits the caller.
Scope: `sessions:read`'
responses:
'200':
description: The stream. It stays open until the client leaves, the server restarts (`reconnect` frame) or access ends (`error` frame).
content:
text/event-stream:
schema:
type: string
description: 'Server-Sent Events: `hello`, then `rev`, `pulse`, and finally `error` or `reconnect`.'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: sessions:read is missing.
'429':
$ref: '#/components/responses/RateLimited'
parameters:
- in: query
name: sessions
schema:
type: string
description: Up to 8 comma-separated Session ids whose views this stream also follows (`session:{id}:…` topics). Ids the key's owner may not read are left out.
security:
- reasonApiKey:
- sessions:read
/v3/organizations/{orgId}/event-webhooks:
parameters:
- $ref: '#/components/parameters/orgId'
get:
operationId: listEventWebhooks
x-reason-mcp: false
tags:
- Workspace events
summary: List event webhooks
description: 'List the workspace''s outbound event webhooks, oldest first, with their delivery state and never their secrets. Requires automations:read and sessions:read.
The workspace''s outbound event webhooks, oldest first, with delivery state (`delivered_through` is the last event id delivered or skipped; `last_error` says why a delivery failed). Never their secrets. `url` is whole for its registering member and for workspace owners and admins, and only its origin for other members. Requires automations:read and sessions:read.
Scope: `automations:read`'
responses:
'200':
description: The workspace's event webhooks.
content:
application/json:
schema:
$ref: '#/components/schemas/EventWebhookList'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: A scope is missing.
'429':
$ref: '#/components/responses/RateLimited'
security:
- reasonApiKey:
- automations:read
post:
operationId: createEventWebhook
x-reason-mcp: false
tags:
- Workspace events
summary: Register an event webhook
description: 'Register an https endpoint that receives the workspace''s events from now on, signed with Standard Webhooks headers. Returns its signing secret once.
Registers an https endpoint that receives the workspace''s events from now on: the events about Sessions the registering member may read, and changes to the workspace''s connections and plugins, the member''s own personal ones and those of Reasons that list their plugins for the member (for a webhook, membership decides; no mcp:read is needed), of the `event_types` given (all when omitted). Returns its signing `secret` once; store it now. At most 10 per workspace. Requires automations:write and sessions:read; viewers cannot register. Each delivery is one event, POSTed as JSON (the event frame''s `data` from streamWorkspaceEvents), signed with Standard Webhooks headers: `webhook-id` (the event''s identity, the same on every retry, also sent as `Idempotency-Key`), `webhook-timestamp` (Unix seconds) and `webhook-signature` (`v1,` + base64 HMAC-SHA256 of `..`, keyed by the base64-decoded part of the endpoint''s `whsec_` secret). Verify it with any Standard Webhooks library, or with a Reason Loop webhook that holds the secret. Answer 2xx within 10 seconds; anything else is retried with backoff (10 s doubling to 1 h), in order, and an endpoint failing for 3 days is disabled. Delivery is at least once: drop a repeated webhook-id.
Scope: `automations:write`'
responses:
'201':
description: The new endpoint and its signing secret, shown only now.
content:
application/json:
schema:
$ref: '#/components/schemas/CreatedEventWebhook'
'400':
description: The url or event types are invalid (`invalid_request`).
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: A scope or write permission is missing.
'409':
description: The workspace already has 10 event webhooks (`webhook_limit`).
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateEventWebhook'
security:
- reasonApiKey:
- automations:write
/v3/organizations/{orgId}/event-webhooks/{webhookId}:
parameters:
- $ref: '#/components/parameters/orgId'
- name: webhookId
description: The event webhook id, returned as `id` by `listEventWebhooks` and `createEventWebhook`.
in: path
required: true
schema:
type: string
format: uuid
get:
operationId: getEventWebhook
x-reason-mcp: false
tags:
- Workspace events
summary: Get an event webhook
description: 'Get one event webhook and its delivery state, never its secret. The url is whole for its registering member and for workspace owners and admins.
One event webhook and its delivery state, never its secret. `url` is whole for its registering member and for workspace owners and admins, and only its origin for other members. Requires automations:read and sessions:read.
Scope: `automations:read`'
responses:
'200':
description: The endpoint.
content:
application/json:
schema:
$ref: '#/components/schemas/EventWebhook'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
security:
- reasonApiKey:
- automations:read
patch:
operationId: updateEventWebhook
x-reason-mcp: false
tags:
- Workspace events
summary: Update an event webhook
description: 'Update an event webhook''s url, description or event types, or disable and enable it again. Only its registering member may change the url.
Changes an endpoint''s url, description or event types, or disables it (`enabled: false`) or enables it again (`enabled: true` clears its failures and resumes after the last event it delivered that is still retained; events past the 7-day retention are skipped and named in `last_error`). Requires automations:write and sessions:read; only its registering member or a workspace owner or admin, and only its registering member may change `url`, because deliveries carry the Session, connection and plugin events that member may read.
Scope: `automations:write`'
responses:
'200':
description: The updated endpoint.
content:
application/json:
schema:
$ref: '#/components/schemas/EventWebhook'
'400':
description: The url or event types are invalid (`invalid_request`).
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: Not the endpoint's registering member or a workspace owner or admin, or a `url` change by anyone but its registering member (`webhook_owner_only`), or a scope is missing.
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateEventWebhook'
security:
- reasonApiKey:
- automations:write
delete:
operationId: deleteEventWebhook
x-reason-mcp: false
tags:
- Workspace events
summary: Delete an event webhook
description: 'Delete an event webhook: stops deliveries to the endpoint and deletes it with its secret. Only its registering member or a workspace owner or admin may.
Stops deliveries to the endpoint and deletes it with its secret. Requires automations:write and sessions:read; only its registering member or a workspace owner or admin.
Scope: `automations:write`'
responses:
'200':
description: Deleted.
content:
application/json:
schema:
type: object
properties:
id:
type: string
required:
- id
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: Not the endpoint's registering member or a workspace owner or admin (`webhook_owner_only`).
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
security:
- reasonApiKey:
- automations:write
/v3/organizations/{orgId}/events:
parameters:
- $ref: '#/components/parameters/orgId'
get:
operationId: streamWorkspaceEvents
x-reason-mcp: false
tags:
- Workspace events
summary: Stream workspace events
description: 'A resumable Server-Sent Events stream (`text/event-stream`) of what happens in the workspace''s Sessions, connections and plugins, in the order it happened. Requires sessions:read. Event types: `message.created`, `turn.started`, `turn.finished`, `input_request.created`, `input_request.resolved`, `connection.created`, `connection.updated`, `connection.removed`, `compaction.started`, `compaction.finished`, `plugin.installed`, `plugin.updated`, `plugin.uninstalled`. - `message.created`: a message was added to a Session (a person''s prompt or follow-up, or a message Reason posted). `data`: `message_id`, `role`. Read it with listSessionConversation or listSessionMessages. - `turn.started`: a turn of a Session began executing: a new Session, a follow-up or resume, a scheduled or Loop run, a check-in, a subagent. Once per turn (`run_id`), also when a deploy hands the turn to another server. `data.trigger`: what started it, one of `person`, `api`, `agent`, `subagent`, `loop`, `schedule`, `check_in`, `github`, `slack`, `webhook`, `linear`, `connection`, `system` (treat a value you do not know as `system`). `data.started_by_session_id`: for a subagent, the Session that started it; otherwise null. A turn stopped before it began executing has only `turn.finished`. - `turn.finished`: a turn of a Session ended. `data.status` is the Session''s public status for that turn (`exit`, `error`, `cancelled`, ...). It is not the verdict: read the Session''s `outcome` with getSession. - `input_request.created`: a Session started waiting on a person: a question or a request card (a secret, network hosts, permission rules, a connection). `data`: `request_id` (the id getSessionInputRequest and the answer, approve, deny, cancel and secret operations take), `type` (`question`, `secret`, `network_hosts`, `permission_rules`, `installed_connector`, `endpoint_connector`, `registry_connector`, `connector`, `native_connector`, `source_control`, `device_plugin`, `personal_connector_grant`) and, for a question, `question_operation_id` (sendSessionMessage''s). Read the request itself with getSessionInputRequest. - `input_request.resolved`: a request stopped waiting. `data`: `request_id`, `type`, `status` (an input request''s status other than `pending`, such as `answered`, `timed_out`, `cancelled`, `withdrawn`, `closed`, `allowed`, `declined`, `applied`, `completed`) and `question_operation_id` for a question. Recorded when it is answered, approved, declined or cancelled from any surface (the web app, Slack, this API, the agent). A question that `timed_out` can still be answered later, which records a second `input_request.resolved` with `answered`. A request that ends without anyone acting on it (a card''s 24-hour window passing, a question a later message moved past) records no event: re-read the Session''s input requests on `turn.finished`. - `compaction.started`, `compaction.finished`: a Session''s context compaction began or ended (show "Compacting context…" while one runs; it explains a slower turn). Recorded for a compaction during a turn (automatic, a compactSession request the running turn serves, or recovery after the model refused a request as too long) and for one compactSession runs on a settled Session. `run_id` is the turn it ran in, or for a settled Session its latest turn. `data`: `compaction_id` (the same on both, and on listSessionEvents'' compaction_started / compaction_finished events) and `trigger` (`automatic`, `manual`, `overflow`); on finished also `status` (`completed`, `skipped`, `failed`), `tokens_before`, `tokens_after` and `duration_ms` (integers, each null when unknown). Never the summary. A turn cancelled while it compacts can leave a started event without its finished one: `turn.finished` ends it. Treat a finished event whose start you never saw as already over.'
responses:
'200':
description: The stream. It stays open until the client leaves, the server restarts (`reconnect` frame) or access ends (`error` frame).
content:
text/event-stream:
schema:
type: string
description: 'Server-Sent Events: `hello`, then event frames, `pulse`, `reset`, and finally `error` or `reconnect`.'
'400':
description: '`after` or `Last-Event-ID` is not a non-negative integer (`invalid_request`).'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: sessions:read is missing.
'429':
$ref: '#/components/responses/RateLimited'
parameters:
- in: query
name: after
schema:
type: string
description: Resume after this event id (an earlier frame's `id`); the `Last-Event-ID` header does the same. Omit both to start at the current end.
security:
- reasonApiKey:
- sessions:read
components:
responses:
NotFound:
description: Resource not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: session_not_found
Unauthorized:
description: Missing, invalid, or expired key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: missing_bearer
message: Authorization required
Forbidden:
description: The key lacks the required scope or role.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: missing_scope
required_scope: sessions:read
RateLimited:
description: Too many requests. Retry after the number of seconds in the `Retry-After` response header.
headers:
Retry-After:
description: Seconds to wait before retrying.
schema:
type: integer
minimum: 1
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
type: rate_limited
message: This API key exceeded its request-rate limit
schemas:
Error:
type: object
properties:
error:
oneOf:
- type: string
- type: object
required:
- type
- message
properties:
type:
type: string
message:
type: string
request_id:
type:
- string
- 'null'
message:
type: string
required_scope:
type: string
description: The capability required when the request was denied for a missing scope.
EventWebhook:
type: object
properties:
id:
type: string
url:
type: string
description: 'The endpoint''s URL: whole for its registering member and for workspace owners and admins, only its origin for other members.'
description:
type:
- string
- 'null'
event_types:
type:
- array
- 'null'
items:
type: string
enum:
- message.created
- turn.started
- turn.finished
- input_request.created
- input_request.resolved
- connection.created
- connection.updated
- connection.removed
- compaction.started
- compaction.finished
- plugin.installed
- plugin.updated
- plugin.uninstalled
description: Only these event types; omit (or null) for every type.
status:
type: string
enum:
- active
- disabled
disabled_reason:
description: 'Why it is disabled: by the API, or after failing for 3 days.'
type:
- string
- 'null'
created_by:
type: string
description: The member who registered it; it receives the events about Sessions this member may read.
delivered_through:
type: string
description: The last event id delivered (or skipped as not visible or not wanted).
failures:
type: integer
description: Failed deliveries in a row.
failing_since:
type:
- string
- 'null'
next_attempt_at:
type:
- string
- 'null'
last_delivery_at:
type:
- string
- 'null'
last_status:
description: The HTTP status of the last attempt.
type:
- integer
- 'null'
last_error:
type:
- string
- 'null'
created_at:
type: string
updated_at:
type: string
required:
- id
- url
- description
- event_types
- status
- disabled_reason
- created_by
- delivered_through
- failures
- failing_since
- next_attempt_at
- last_delivery_at
- last_status
- last_error
- created_at
- updated_at
UpdateEventWebhook:
type: object
properties:
url:
type: string
description: A new https URL. Only the member who registered the endpoint may change it.
description:
type:
- string
- 'null'
maxLength: 500
event_types:
type:
- array
- 'null'
items:
type: string
enum:
- message.created
- turn.started
- turn.finished
- input_request.created
- input_request.resolved
- connection.created
- connection.updated
- connection.removed
- compaction.started
- compaction.finished
- plugin.installed
- plugin.updated
- plugin.uninstalled
description: Only these event types; omit (or null) for every type.
enabled:
type: boolean
description: false disables deliveries; true enables them again, clearing failures.
EventWebhookList:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/EventWebhook'
required:
- items
CreatedEventWebhook:
type: object
properties:
id:
type: string
url:
type: string
description: 'The endpoint''s URL: whole for its registering member and for workspace owners and admins, only its origin for other members.'
description:
type:
- string
- 'null'
event_types:
type:
- array
- 'null'
items:
type: string
enum:
- message.created
- turn.started
- turn.finished
- input_request.created
- input_request.resolved
- connection.created
- connection.updated
- connection.removed
- compaction.started
- compaction.finished
- plugin.installed
- plugin.updated
- plugin.uninstalled
description: Only these event types; omit (or null) for every type.
status:
type: string
enum:
- active
- disabled
disabled_reason:
description: 'Why it is disabled: by the API, or after failing for 3 days.'
type:
- string
- 'null'
created_by:
type: string
description: The member who registered it; it receives the events about Sessions this member may read.
delivered_through:
type: string
description: The last event id delivered (or skipped as not visible or not wanted).
failures:
type: integer
description: Failed deliveries in a row.
failing_since:
type:
- string
- 'null'
next_attempt_at:
type:
- string
- 'null'
last_delivery_at:
type:
- string
- 'null'
last_status:
description: The HTTP status of the last attempt.
type:
- integer
- 'null'
last_error:
type:
- string
- 'null'
created_at:
type: string
updated_at:
type: string
secret:
type: string
description: 'The `whsec_` signing secret. Shown only in this response: store it now.'
required:
- id
- url
- description
- event_types
- status
- disabled_reason
- created_by
- delivered_through
- failures
- failing_since
- next_attempt_at
- last_delivery_at
- last_status
- last_error
- created_at
- updated_at
- secret
CreateEventWebhook:
type: object
properties:
url:
type: string
description: The https URL that receives each event as a signed POST. Private and internal addresses are refused when delivering.
description:
description: What the endpoint is for.
type:
- string
- 'null'
maxLength: 500
event_types:
type:
- array
- 'null'
items:
type: string
enum:
- message.created
- turn.started
- turn.finished
- input_request.created
- input_request.resolved
- connection.created
- connection.updated
- connection.removed
- compaction.started
- compaction.finished
- plugin.installed
- plugin.updated
- plugin.uninstalled
description: Only these event types; omit (or null) for every type.
required:
- url
parameters:
orgId:
name: orgId
in: path
required: true
description: Organization id or slug. Resolve it with `GET /v3/self`.
schema:
type: string
securitySchemes:
loopWebhookKey:
type: http
scheme: bearer
description: A Loop's webhook key, returned once by the createReasonLoop or updateReasonLoop call that adds the webhook. It only delivers events to that Loop's webhook; every other operation rejects it.
loopWebhookSignature:
type: apiKey
in: header
name: X-Signature-256
description: 'An HMAC-SHA256 of the exact request body keyed with the Loop''s webhook key or its stored signing secret: hex in `X-Signature-256` (optionally `sha256=`-prefixed), or the sender''s own header (`X-Hub-Signature-256`, `Stripe-Signature`, `Webhook-Signature`, `Svix-Signature`, `Linear-Signature`, `Sentry-Hook-Signature`, `X-Shopify-Hmac-Sha256`).'
reasonMachineToken:
type: http
scheme: bearer
bearerFormat: rmt_<hex>
description: A Machine token from createMachineToken. It can only create enrollment tickets for its own Machine; every other operation rejects it.
reasonUserOAuth:
type: http
scheme: bearer
description: A workspace-bound human user OAuth grant with org:write scope. The user must be an organization owner/admin. API keys and browser sessions are not accepted.
reasonApiKey:
type: http
scheme: bearer
bearerFormat: 'reason_<hex> (legacy: ara_<hex>)'
description: 'Your Reason API key from Settings › API keys. New keys use `reason_`; legacy `ara_` keys remain accepted. Keys are capability-scoped: run, mcp:read, mcp:write, secrets:read, secrets:write, sessions:read, sessions:debug, devices:read, devices:write, devices:use, computers:read, computers:write, ssh:write, knowledge:read, memory:read, memory:write, skills:read, skills:write, pages:read, pages:write, repos:read, repos:write, reviews:read, reviews:write, deployment:read, analytics:read, org:read, org:write, attachments:read, attachments:write, guardrails:read, guardrails:write, network:read, network:write, automations:read, automations:write, agent_auth:read. devices:write, devices:use, computers:read, computers:write, ssh:write, network:read and network:write are opt-in, excluded from default keys. computers:read lists visible cloud and connected computers without waking them or granting execution access. devices:read discovers local Device targets; devices:use separately consents to local execution, so a discover-and-run local workflow needs both. devices:write manages enrollment and device grants; computers:write creates or deletes cloud computers; ssh:write manages retained SSH access. network:read reads the saved workspace network policy; network:write replaces custom allowed hosts and requires a current organization owner/admin. Legacy project PATCH requests containing network_allowed_hosts also require network:write plus their existing run scope and project management permission; saved project hosts do not affect current session egress. Only owners/admins can mint or manage keys with network:write; keys cannot grant themselves more authority. See /docs/network-policies for replacement semantics and runtime applicability. mcp:write manages MCP server configuration only; it does not authorize remote MCP-tool execution. sessions:read reads sessions, including the assistant, reasoning and tool activity in their events. sessions:debug is privileged: only for organization owners/admins, it expands session events to the full diagnostic projection (diagnostic event kinds, status text and raw event metadata).'