Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Reason Onboarding 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: Onboarding
paths:
/v3/organizations/{orgId}/onboarding/import/complete:
parameters:
- $ref: '#/components/parameters/orgId'
post:
operationId: completeOnboardingImport
x-reason-mcp-description: Finishes an approved local secret import, given the `handoff` or a consumed `pairing_id`. `imported_secret_count` must equal the `selected_names` count from getOnboardingImportDecision. Returns `status` completed, also on a same-count repeat; an unapproved or expired one gets 400. Sends no values.
tags:
- Onboarding
summary: Mark an approved local secret import complete
description: 'Records completion after an approved local import finishes. Supply imported_secret_count with handoff or pairing_id. Pairing requires the matching CLI OAuth client and a consumed pairing. This records completion, not secret values. Invalid or unapproved completion state returns 400.
Scope: `org:write`'
responses:
'200':
description: Import recorded.
content:
application/json:
schema:
$ref: '#/components/schemas/OnboardingImportCompleted'
example:
status: completed
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompleteOnboardingImportRequest'
security:
- reasonApiKey:
- org:write
/v3/organizations/{orgId}/onboarding/import/decision:
parameters:
- $ref: '#/components/parameters/orgId'
post:
operationId: getOnboardingImportDecision
x-reason-read-only: true
x-reason-mcp-description: 'Reads, without changing it, the browser''s decision on a local secret import by `handoff` or `pairing_id`: `status` (pending, expired, approved or completed), `selected_names` once approved, `imported_secret_count` once completed. The CLI polls it; secret values never pass through it.'
tags:
- Onboarding
summary: Poll the browser's local secret import decision
description: 'Returns only the approved secret names. Values remain local to the CLI until approval.
Scope: `org:write`'
responses:
'200':
description: The current handoff decision.
content:
application/json:
schema:
$ref: '#/components/schemas/OnboardingImportDecision'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/OnboardingImportDecisionRequest'
security:
- reasonApiKey:
- org:write
/v3/organizations/{orgId}/onboarding/import/pairing/claim-existing:
parameters:
- $ref: '#/components/parameters/orgId'
post:
operationId: claimExistingCliPairing
x-reason-mcp-description: Attaches the current CLI OAuth grant to a browser `pairing_code` and returns the pairing's `pairing_id` (the same one when the same client repeats the claim) and `recovered`. No secrets are imported. Expired or unusable codes return 400 `invalid_cli_pairing`.
tags:
- Onboarding
summary: Attach an existing CLI grant to a browser pairing
description: 'Claims the browser''s pairing_code with the current CLI MCP OAuth grant, not a plain API key. Pairing must match user, workspace and OAuth client. Expired or unusable codes return 400 invalid_cli_pairing. Returns pairing_id and recovered; does not import secrets.
Scope: `org:write`'
responses:
'200':
description: Pairing claimed by the current CLI grant.
content:
application/json:
schema:
type: object
required:
- pairing_id
- recovered
properties:
pairing_id:
type: string
description: Id of the claimed CLI pairing; pass it as `pairing_id` to the other onboarding import tools.
recovered:
type: boolean
description: Currently always false. Repeating the claim from the same OAuth client returns the same `pairing_id`.
example:
pairing_id: 11111111-1111-4111-8111-111111111111
recovered: false
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ClaimCliPairingRequest'
security:
- reasonApiKey:
- org:write
/v3/organizations/{orgId}/onboarding/import/pairing/failure:
parameters:
- $ref: '#/components/parameters/orgId'
post:
operationId: reportCliPairingFailure
x-reason-mcp-description: Records `failure_code` on a claimed CLI pairing whose local secret scan could not finish and signals the waiting browser; it imports nothing and returns `status` failed. Only the OAuth grant that claimed `pairing_id` may call; anything else returns 400 `invalid_cli_pairing`.
tags:
- Onboarding
summary: Report that a paired local scan could not finish
description: 'Records failure_code for a CLI pairing belonging to the current user, workspace and MCP OAuth client. Plain API keys or invalid pairings return 400 invalid_cli_pairing. Records a failed scan, not a successful or partial secret import.
Scope: `org:write`'
responses:
'200':
description: Failure recorded.
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
const: failed
description: The pairing is now marked as a failed scan.
example:
status: failed
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CliPairingFailureRequest'
security:
- reasonApiKey:
- org:write
/v3/organizations/{orgId}/onboarding/import/summary:
parameters:
- $ref: '#/components/parameters/orgId'
post:
operationId: createOnboardingImportHandoff
x-reason-mcp-description: Creates a short-lived browser handoff listing the secret names and coarse sources a local scan found, for a person to approve. Returns the opaque `handoff` token for `getOnboardingImportDecision` and `completeOnboardingImport`. Secret values and local paths are not accepted.
tags:
- Onboarding
summary: Create a local onboarding import handoff
description: 'Creates a short-lived browser handoff containing secret names and coarse source descriptions. Secret values and local paths are never accepted.
Scope: `org:write`'
responses:
'200':
description: A short-lived opaque browser handoff.
content:
application/json:
schema:
$ref: '#/components/schemas/OnboardingImportHandoff'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/OnboardingImportSummary'
security:
- reasonApiKey:
- org:write
components:
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.
OnboardingImportDecisionRequest:
anyOf:
- type: object
properties:
handoff:
type: string
description: The `handoff` that `createOnboardingImportHandoff` returned; names the scan whose approval to read.
required:
- handoff
additionalProperties: false
- type: object
properties:
pairing_id:
type: string
format: uuid
pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
description: The pairing whose approval to read, from pairing authorization or `claimExistingCliPairing`; readable only through the OAuth client that claimed it.
required:
- pairing_id
additionalProperties: false
CliPairingFailureRequest:
type: object
properties:
pairing_id:
type: string
format: uuid
pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
description: CLI pairing ID from pairing authorization or claimExistingCliPairing, belonging to the current user, workspace and OAuth client.
failure_code:
type: string
minLength: 1
maxLength: 80
description: Machine-readable reason the local scan failed; records a failed scan rather than an import.
required:
- pairing_id
- failure_code
additionalProperties: false
OnboardingImportSummary:
type: object
properties:
env_file_count:
type: integer
minimum: 0
maximum: 10000
description: Number of environment files the local scan read. Saved with the handoff and returned with its summary to the browser that reviews the import.
project_count:
type: integer
minimum: 0
maximum: 10000
description: Number of projects the local scan covered. Saved with the handoff and returned with its summary to the browser that reviews the import.
detected_secrets:
description: The secrets the scan found, by name and source, for the person to approve in the browser before any value leaves the CLI. Omitted means none were found.
maxItems: 500
type: array
items:
type: object
properties:
name:
type: string
maxLength: 128
pattern: ^[A-Z][A-Z0-9_]*$
description: Environment variable the scan found, such as DATABASE_URL. The person approves by name; the value stays in the CLI.
description:
type: string
minLength: 1
maxLength: 500
description: Where the secret was found, coarsely, such as a project and file kind; shown beside its name on the approval page.
required:
- name
- description
additionalProperties: false
imported_secret_count:
description: 'Sent only by older CLIs: secrets they imported before approval existed. Current clients omit it and send `detected_secrets`.'
type: integer
minimum: 0
maximum: 10000
required:
- env_file_count
- project_count
additionalProperties: false
OnboardingImportCompleted:
type: object
properties:
status:
type: string
const: completed
description: The import was recorded.
required:
- status
additionalProperties: false
CompleteOnboardingImportRequest:
anyOf:
- type: object
properties:
handoff:
type: string
description: Opaque handoff returned by createOnboardingImportHandoff, after browser approval.
imported_secret_count:
type: integer
minimum: 0
maximum: 500
description: Number of approved secrets actually imported by the CLI.
required:
- handoff
- imported_secret_count
additionalProperties: false
- type: object
properties:
pairing_id:
type: string
format: uuid
pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
description: Consumed CLI pairing ID from pairing authorization or claimExistingCliPairing; use its matching CLI OAuth grant.
imported_secret_count:
type: integer
minimum: 0
maximum: 500
description: Number of approved secrets actually imported by the CLI.
required:
- pairing_id
- imported_secret_count
additionalProperties: false
OnboardingImportDecision:
oneOf:
- type: object
properties:
status:
type: string
const: pending
description: The browser has not decided yet; poll again.
required:
- status
additionalProperties: false
- type: object
properties:
status:
type: string
const: approved
description: The browser approved an import; import the values of `selected_names`, then record it with `completeOnboardingImport`.
selected_names:
type: array
items:
type: string
description: Secret names the person approved for import.
required:
- status
- selected_names
additionalProperties: false
- type: object
properties:
status:
type: string
const: completed
description: The import was already recorded.
selected_names:
type: array
items:
type: string
description: Secret names the person approved for import.
imported_secret_count:
type: integer
minimum: 0
description: How many approved secrets the CLI reported importing.
required:
- status
- selected_names
- imported_secret_count
additionalProperties: false
- type: object
properties:
status:
type: string
const: expired
description: 'The handoff expired: no decision before its deadline, or an approved import not recorded with `completeOnboardingImport` before its completion deadline; start a new one.'
required:
- status
additionalProperties: false
ClaimCliPairingRequest:
type: object
properties:
pairing_code:
type: string
description: Pairing code from the browser-generated CLI setup command; obtain a fresh command if it has expired.
required:
- pairing_code
additionalProperties: false
OnboardingImportHandoff:
type: object
properties:
handoff:
type: string
description: Opaque, short-lived token for this handoff; pass it as `handoff` to `getOnboardingImportDecision` and `completeOnboardingImport`.
required:
- handoff
additionalProperties: false
parameters:
orgId:
name: orgId
in: path
required: true
description: Organization id or slug. Resolve it with `GET /v3/self`.
schema:
type: string
responses:
BadRequest:
description: Invalid request.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: prompt_required
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
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).'