> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reason.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# Send a message

> Send a message: add a follow-up instruction to a running or finished Session, including an owned subagent Session. Device execution also needs devices:use.

Adds a follow-up instruction to a running or finished Session, including an owned subagent Session. Child continuations retain their original execution permissions. Device execution requires devices:use in addition to run, including continuations and pending Device handoffs.

<sub>Scope: `run`</sub>


## OpenAPI

````yaml /openapi.docs.json post /v3/organizations/{orgId}/sessions/{sessionId}/messages
openapi: 3.1.0
info:
  title: Reason 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.reason.bot
security:
  - reasonApiKey: []
tags:
  - name: Account
    description: Verify a key and resolve the organization it belongs to.
  - name: Reasons
    description: >-
      Start here. A Reason is the long-running agent a person keeps: their main
      Reason and named ones, each with its own instructions, default model and
      repositories, conversation, Loops and Sessions. Give a Reason work by
      messaging it (sendReasonMessage) and read its replies with
      listReasonMessages.
  - name: Loops
    description: >-
      Standing work a Reason does, woken by a schedule or an event: a webhook, a
      GitHub event or a Slack message. Each wake opens or continues a Session of
      the Reason; webhook events that share a correlation key continue one
      Session.
  - name: Memory
    description: >-
      What Reasons remember across Sessions. Each Session starts by reading
      MEMORY.md (a short index) and the list of topic notes, and reads a note
      when its topic comes up. `personal` memory belongs to one person (the API
      key's owner) and only their Sessions read it; `team` memory belongs to the
      Workspace and every member's Sessions read it. memory:read lists, reads
      and searches; memory:write writes and deletes, in team memory only for a
      Workspace owner or admin.
  - name: Sessions
    description: >-
      A Session is one run of work inside a Reason: every Reason message and
      Loop wake runs in one, and createSession starts one directly for a single
      unattended task with a pass/fail outcome. Its transcript, events, result
      and pull request are read here.
  - name: Skills
    description: >-
      Reusable instruction bundles Reason selects semantically from their
      descriptions for matching agent tasks.
  - 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.
  - name: Pages
    description: >-
      The HTML pages Reasons make: charts, dashboards and reports a person reads
      in the chat, opens full size, shares and finds in a Reason's Library. List
      and read the pages you may see, make one in a Reason's conversation or a
      Session, keep it current with updatePage (same id, link and share link, a
      new revision), share it and delete it. pages:read reads; pages:write
      writes. An Experiments feature (pages_api): elsewhere these return 403
      `pages_api_unavailable`.
  - name: Secrets
    description: >-
      Encrypted credentials injected into the agent's sandbox. Write-only:
      values can be set but never read back.
  - name: Attachments
    description: >-
      Files uploaded to the organization and shared with sessions, downloaded
      via short-lived signed URLs.
  - name: Repositories
    description: Connected repositories, their indexing state, and generated wikis.
  - name: Git Connections
    description: Linked source-control accounts and the repositories they expose.
  - name: Machines
    description: >-
      Named Workspace queues served by headless workers. Sessions target a
      Machine by name and wait for a free worker; more workers serve more
      Sessions concurrently.
  - name: Devices
    description: >-
      Owned Mac and headless Device identity, bounded enrollment and root
      grants.
  - name: Cloud Access
    description: >-
      Keyless cloud sign-in for sessions: Reason's OIDC issuer facts and the
      AWS, Google Cloud and Azure connections a workspace trusts, including
      which run triggers each one signs in.
  - name: MCP Servers
    description: >-
      Org-level Model Context Protocol servers exposed to the agent. Secret
      values are write-only.
  - name: Plugins
    description: >-
      The plugin catalog (catalog connectors, custom MCP servers, native app
      connectors): install, browser OAuth sign-in, bundled skills and per-Reason
      settings. Never returns credentials.
  - name: Change Request Reviews
    description: >-
      Automated senior-engineer reviews posted on pull requests and merge
      requests.
  - name: Consumption
    description: 'Billing-aligned usage: daily consumption and billing cycles.'
  - name: Metrics
    description: Aggregate analytics over sessions, change requests, and usage.
  - name: Audit Logs
    description: An append-only record of changes made within the organization.
  - name: Organizations
    description: The top-level tenant. Create, read, update, and delete organizations.
  - name: Members
    description: People in an organization and their pending invites.
  - name: Roles
    description: Role assignments that govern what each member can do.
  - name: Settings
    description: 'Organization configuration: namespaced settings and the run tag policy.'
  - name: Provider credentials
    description: >-
      Configure Bring-Your-Own-Key (BYOK) API keys and subscription credentials
      for model providers. Secret values are write-only.
  - name: Feedback
    description: Report problems with the API or these docs to the Reason team.
  - name: Projects
    description: >-
      Deprecated: a project is a Reason with the same id. Use the Reasons
      operations; these remain for existing clients.
  - name: Automations
    description: >-
      The older form of Loops. Prefer the Loops under a Reason (listReasonLoops,
      createReasonLoop), which take every wake: schedule, webhook, GitHub,
      Slack. Use these for what Loops do not carry yet: a run's MCP and app
      tools, and automations not filed under a Reason.
paths:
  /v3/organizations/{orgId}/sessions/{sessionId}/messages:
    parameters:
      - $ref: '#/components/parameters/orgId'
      - name: sessionId
        description: >-
          The session id, returned as `session_id` by `createSession` and
          `listSessions`.
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - Sessions
      summary: Send a message
      description: >-
        Send a message: add a follow-up instruction to a running or finished
        Session, including an owned subagent Session. Device execution also
        needs devices:use.


        Adds a follow-up instruction to a running or finished Session, including
        an owned subagent Session. Child continuations retain their original
        execution permissions. Device execution requires devices:use in addition
        to run, including continuations and pending Device handoffs.


        <sub>Scope: `run`</sub>
      operationId: sendSessionMessage
      parameters:
        - in: header
          name: X-Reason-Agent
          required: false
          schema:
            type: string
            maxLength: 80
          description: >-
            Optional self-reported caller agent name. If absent, the server uses
            the User-Agent for external callers.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                  description: >-
                    The follow-up instruction for the agent. It reaches the
                    running turn or starts the next one; the response's
                    `delivery` says which.
                delegation:
                  description: >-
                    Opt-in deeper delegation. Without it the Session's tree is
                    unchanged: two levels deep (the Session's subagents may
                    start their own, which cannot), and subagents never create
                    Sessions. The whole tree inherits these limits and its
                    agents can only lower them for what they start. Every tree
                    keeps one cap of 100 live agents, whatever its depth. An
                    omitted field takes the default. A dated runtime release
                    (`experimental_runtime_profile` naming one) keeps the rules
                    it was published with and returns 400
                    `delegation_runtime_unsupported`. On a message it is stored
                    on the Session before the message is delivered and applies
                    to every agent its tree starts afterwards; it persists for
                    later messages until a request sets it again. Only a root
                    Session takes it: a subagent or a Session a tree member
                    created returns 400 `delegation_not_root`.
                  type: object
                  properties:
                    max_depth:
                      type: integer
                      minimum: 1
                      maximum: 5
                      description: >-
                        How deep the Session's subagent tree may nest below it:
                        1 lets only its own subagents run, 2 (the default
                        without this field) lets them start one more level, and
                        each higher value one level more. Counted from the root
                        Session.
                    children_can_create_sessions:
                      type: boolean
                      description: >-
                        Let subagents above the last level create Sessions with
                        sessions_create. Those Sessions join this tree: they sit
                        one level below their creator and count toward the
                        tree's cap of 100 live agents. Default false.
                execution_budget:
                  description: >-
                    The task budget, as createSession takes it. While the
                    Session's task is running, the message joins that task:
                    `spend_limit_usd` lowers the task's shared spending limit
                    for the Session and every agent in its tree, and is never
                    raised (a higher value returns 400
                    `execution_budget_raise_refused` and the message is not
                    sent); the task's deadline stays as it was admitted, so
                    `wall_clock_max_ms` does not change it. A task is running
                    while the Session's turn is queued or running; a task with a
                    spending limit also runs until every Session it started has
                    finished and the limit is not reached, so a message to a
                    finished Session of that task, with or without
                    `execution_budget`, continues it under the same limit and
                    deadline. Otherwise the message starts a new task and both
                    fields set that task's budget. A Session that is part of
                    another Session's running task (a subagent, or a Session
                    that task created) spends from its budget and returns 400
                    `execution_budget_not_root`.
                  type: object
                  properties:
                    wall_clock_max_ms:
                      description: >-
                        Execution deadline in milliseconds from admission,
                        including recovery waits and automatic continuations.
                        Zero or omission selects no deadline for a new task.
                      type: integer
                      minimum: 0
                      maximum: 3600000000
                    spend_limit_usd:
                      description: >-
                        Shared task spending ceiling in US dollars. Omit or set
                        null to retain account limits; concurrent inference
                        costs are reserved before dispatch. Requires a
                        Reason-hosted model: a session whose model runs on the
                        workspace's own provider credential is refused with
                        execution_budget_provider_unsupported.
                      type:
                        - number
                        - 'null'
                      minimum: 0
                      maximum: 1000000
                attachments:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          id:
                            type: string
                            description: >-
                              Caller-chosen identifier for this file, kept with
                              the stored attachment. Omitted, the file is
                              numbered by its position: att-1, att-2 and so on.
                          name:
                            type: string
                            description: >-
                              File name shown with the attachment, for example
                              screenshot.png. It also supplies the content type
                              when none is given; an empty name becomes
                              attachment-1, attachment-2 and so on.
                          content_type:
                            type: string
                            description: >-
                              MIME type of the file, for example image/png.
                              Omitted, the data URL's media type is used; when
                              that is empty or application/octet-stream, the
                              type is inferred from the name's extension.
                          contentType:
                            description: Legacy alias of content_type.
                            type: string
                          data_url:
                            type: string
                            description: >-
                              Base64 data URL. Stored privately with the Session
                              before dispatch.
                        required:
                          - name
                          - data_url
                      - type: object
                        properties:
                          id:
                            type: string
                            description: >-
                              Caller-chosen identifier for this file, kept with
                              the stored attachment. Omitted, the file is
                              numbered by its position: att-1, att-2 and so on.
                          name:
                            type: string
                            description: >-
                              File name shown with the attachment, for example
                              screenshot.png. It also supplies the content type
                              when none is given; an empty name becomes
                              attachment-1, attachment-2 and so on.
                          content_type:
                            type: string
                            description: >-
                              MIME type of the file, for example image/png.
                              Omitted, the data URL's media type is used; when
                              that is empty or application/octet-stream, the
                              type is inferred from the name's extension.
                          contentType:
                            description: Legacy alias of content_type.
                            type: string
                          dataUrl:
                            type: string
                            description: Legacy alias of data_url.
                        required:
                          - name
                          - dataUrl
                  description: >-
                    Up to 10 attachments; maximum 64 MiB per file and 80 MiB
                    total decoded bytes. The endpoint's request-body limit also
                    applies to the encoded payload.
                compaction:
                  $ref: '#/components/schemas/SessionCompaction'
                client_message_id:
                  type: string
                  minLength: 1
                  maxLength: 160
                  description: >-
                    Caller-generated idempotency key. Reusing it for the same
                    Session returns the original accepted turn.
                model:
                  type: string
                  description: >-
                    Optional model id from `GET /agent-auth/models` to retry
                    this session on. A model override always starts a new
                    continuation run, because a run's model is fixed at its
                    first execution. Omit or use `auto` to keep the session's
                    current model.
                model_source_id:
                  type: string
                  minLength: 1
                  maxLength: 256
                  description: >-
                    Switch the Session to this connected account from this turn
                    on (a `source_id` from listAgentModels' groups[].accounts),
                    as choosing an account in the app's model picker does, for
                    example to move a chat off a subscription that ran out.
                    Requires `model`, an id that account serves, so like a model
                    override it needs a finished Session (or `delivery: queue`,
                    whose turn starts on that account when it can serve then,
                    else on that provider's next account, as the app's queue
                    does). An account you cannot select, or one that does not
                    serve `model`, returns 400 `model_source_not_selectable`
                    with `valid_model_sources`. The turn routes from that
                    account (model rollover), so it is refused with
                    `allow_model_rollover: false`. If the account stops serving
                    between admission and the turn's start, the message is kept
                    and the response is 409 `model_source_not_selectable` with
                    `message_saved: true` and its `client_message_id` to resend.
                reasoning_effort:
                  type: string
                  enum:
                    - minimal
                    - low
                    - medium
                    - high
                    - xhigh
                    - max
                  description: >-
                    How much reasoning the model should use for the follow-up
                    turn. Higher effort trades time and token usage for more
                    deliberation; supported levels depend on the selected model.
                    Omit to retain the Session's effort setting.
                speed:
                  type: string
                  enum:
                    - standard
                    - fast
                    - ultrafast
                  description: >-
                    Fast mode for the turn this message starts, as the model
                    picker's: `fast` asks the provider for its priority tier and
                    `ultrafast` for a ChatGPT subscription's Ultrafast tier
                    (today a ChatGPT subscription's models; elsewhere it runs at
                    standard speed). It applies when the message starts a turn
                    (a finished Session, `delivery: queue`, a Reason's first
                    message); a message steered into a running turn joins it at
                    that turn's speed. Omit to keep the Session's current speed,
                    as turns the Session starts itself (a report from a Session
                    it started, a check-in, a pull request event) do; switching
                    `model` without sending `fast` turns Fast off, for that turn
                    and for later turns the Session starts itself. Send
                    `standard` to turn Fast off. A Session started in one of the
                    app's capability modes keeps that mode's standard speed
                    unless the message also sends `model` or `reasoning_effort`.
                allow_model_rollover:
                  type: boolean
                  description: >-
                    Same as the create field, for this and later turns: when the
                    Session's subscription or key runs out, the follow-up goes
                    on with another source in its routing order: another
                    connected account, which may serve another model (including
                    another provider's), or Reason. A Session that already rolls
                    over keeps doing so.
                delivery:
                  type: string
                  enum:
                    - steer
                    - queue
                  description: >-
                    While a turn runs: steer (the default) hands the message to
                    the running turn; queue holds it until the turn ends and
                    then runs it as the next one. A queued message can be sent
                    at once or withdrawn with its message_id (POST
                    .../messages/{messageId}/steer, DELETE
                    .../messages/{messageId}/queued). Not combinable with
                    target.
                question_operation_id:
                  type: string
                  pattern: ^[a-fA-F0-9]{64}$
                  description: >-
                    Answers the question card with this id
                    (`data.question_operation_id` on the question's
                    listSessionEvents event): `message` is the answer, and it
                    goes to the turn that asked, as answering the card in the
                    app does. The first answer wins: a later one returns 409
                    `question_already_answered`, and an id that names no open
                    question returns 409 `question_not_pending`. A question the
                    agent addressed to someone else returns 403
                    `question_for_someone_else`. An answer is idempotent with
                    `client_message_id` (the response returns the one the server
                    made when you send none), always steers the turn that asked
                    (`delivery: queue` returns 400
                    `invalid_question_answer_delivery`), and cannot carry
                    `model`, `model_source_id`, `reasoning_effort`, `speed`,
                    `allow_model_rollover` or `target` (400
                    `question_answer_settings_unsupported`). When the asking
                    turn holds another person's personal secrets or connections,
                    the answer cannot enter it: it is kept as your own message
                    and runs as your next turn when that one ends.
                target:
                  oneOf:
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: cloud
                          description: Run on Reason-managed cloud compute.
                        computer_id:
                          description: >-
                            Start on this cloud computer of the Session's Reason
                            (project_id, else your main Reason): an id from REST
                            createReasonComputer or listReasonComputers (neither
                            is an MCP tool; opt-in computers scopes). It keeps
                            its own size. 409 computer_unavailable when that
                            Reason's Sessions each keep their own computer, or
                            with secret_injection false (such a Session always
                            gets a fresh computer of its own); 404
                            computer_not_found when it is not one of the
                            Reason's computers you may use.
                          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)$
                      required:
                        - kind
                      additionalProperties: false
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: mac
                          description: >-
                            Retired: always refused with 410 mac_device_retired.
                            To run on a Mac, connect it with `reason connect`
                            and use kind headless with the device_id listDevices
                            returns for it.
                        device_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 Mac app Device the request names; it is still
                            parsed only so the request gets 410
                            mac_device_retired. Connect the Mac with `reason
                            connect` and send kind headless with the device_id
                            listDevices returns for it.
                        root_id:
                          description: >-
                            Folder grant on the retired Mac Device. Accepted for
                            older clients, but the request is refused with 410
                            mac_device_retired; use root_id with kind headless
                            instead.
                          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)$
                        cwd:
                          description: >-
                            Folder on the retired Mac Device the Session would
                            work in. Accepted for older clients (not combinable
                            with root_id), but the request is refused with 410
                            mac_device_retired; use cwd with kind headless
                            instead.
                          type: string
                          minLength: 1
                          maxLength: 4096
                          pattern: ^\/[^\x00-\x1f\x7f]*$
                        isolation:
                          description: >-
                            How the retired Mac Device would have held cwd.
                            Accepted for older clients (only with cwd), but the
                            request is refused with 410 mac_device_retired; use
                            isolation with kind headless instead.
                          type: string
                          enum:
                            - worktree
                            - in_place
                      required:
                        - kind
                        - device_id
                      additionalProperties: false
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: headless
                          description: >-
                            Run on a CLI-connected computer or externally
                            provisioned worker.
                        device_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: >-
                            Connected computer or worker ID returned by
                            listDevices.
                        root_id:
                          description: >-
                            Optional on your own computer (`reason connect`):
                            omit it to run on the deepest granted folder holding
                            the cwd, else on its home grant (the folder you last
                            used for the repository there, else a managed
                            checkout), or on a worker's only folder. Required
                            when the worker holds several folders, none is its
                            home folder and no cwd is named (409
                            local_device_root_ambiguous otherwise).
                          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)$
                        workspace_mode:
                          description: >-
                            Defaults to a stable Session-managed checkout.
                            project_root explicitly operates the selected
                            existing root.
                          type: string
                          enum:
                            - managed
                            - project_root
                        workspace_path:
                          description: >-
                            Absolute path of the project_root on the Device, as
                            the client sees it (for example /app). Read only
                            with workspace_mode project_root, as the working
                            directory the default C2 harness names in its model
                            prompt; ignored otherwise, and rejected when the
                            request names experimental_runtime_profile
                            runtime/reason-c2-tools-v7. It grants nothing and
                            never selects a directory.
                          type: string
                          maxLength: 4096
                          pattern: ^\/[^\u0000\r\n]*$
                        cwd:
                          description: >-
                            Your own computer (`reason connect`) only: the
                            absolute folder the Session works in, as for a Mac,
                            in a folder the computer granted Reason (root_id
                            when named, else the deepest one holding it; an
                            older `reason connect`: only inside its home
                            folder). Not combinable with workspace_mode or
                            workspace_path.
                          type: string
                          minLength: 1
                          maxLength: 4096
                          pattern: ^\/[^\x00-\x1f\x7f]*$
                        isolation:
                          description: >-
                            With cwd: worktree (the default for repository work)
                            gives the Session its own git worktree at
                            ~/.reason/workspace/sessions/<id>/<repository> on
                            branch reason/<id>; in_place works directly in cwd.
                          type: string
                          enum:
                            - worktree
                            - in_place
                      required:
                        - kind
                        - device_id
                      additionalProperties: false
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: machine
                          description: >-
                            Queue this Session on a worker belonging to a named
                            Machine.
                        name:
                          description: Machine name (case-insensitive).
                          type: string
                          minLength: 1
                          maxLength: 63
                          pattern: ^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?$
                        id:
                          description: Machine 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)$
                      required:
                        - kind
                      additionalProperties: false
                  description: >-
                    Moves the Session: this message's turn, and every later one,
                    runs on this target instead of the one the Session was on.
                    Same shape and admission as the create `target` (`cloud`, a
                    Device and root, or a named Machine). Only the conversation
                    moves; files on the previous machine do not, unless they
                    were pushed to the Session branch. A move starts a new
                    continuation run, so the Session must have finished its
                    current turn. Any target other than `cloud` needs the
                    `devices:use` scope.
              required:
                - message
            example:
              message: Also bump the timeout to 30s while you're in there.
              client_message_id: follow-up-018f6f3a
      responses:
        '200':
          description: Message accepted and delivered or queued for a continuation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendSessionMessageResponse'
        '400':
          description: >-
            The message was empty, a supplied `model` / `reasoning_effort`
            override was not valid, or a question answer
            (`question_operation_id`) also set a turn setting
            (`question_answer_settings_unsupported`) or `delivery: queue`
            (`invalid_question_answer_delivery`). `error` is open-ended: the
            enum lists the original codes, and clients must accept values
            outside it (decode it as a string).
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
                    enum:
                      - message_required
                      - invalid_model
                      - invalid_reasoning_effort
                  message:
                    type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >-
            Usage is unavailable for this message; reason names why (for example
            credit_exhausted or model_payment_required).
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - reason
                  - message
                properties:
                  error:
                    type: string
                    enum:
                      - quota_exhausted
                  reason:
                    type: string
                  message:
                    type: string
        '403':
          description: >-
            The caller lacks a required scope, including devices:use for Device
            execution, does not own the subagent Session and its parent
            (subagent_message_forbidden), is not a Workspace member
            (`forbidden`; open access grants read-only access), or answered a
            question the agent addressed to someone else
            (`question_for_someone_else`; send it without
            `question_operation_id` to add a message instead).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The subagent Session lineage is invalid (subagent_lineage_invalid),
            its execution target is temporarily unavailable, the Session is
            briefly unavailable while a newly attached repository becomes
            executable, a model override requires a finished Session, the
            message was saved but its continuation could not start yet
            (continuation_start_unavailable: resend with the same
            client_message_id to continue it once), the supplied idempotency key
            was previously used for a different message, or a question answer
            found its question already answered (`question_already_answered`;
            the first answer wins) or no longer open (`question_not_pending`).
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - message
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '413':
          description: >-
            Message limit: 262144 UTF-8 bytes. Total JSON request limit:
            116042412 bytes.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - max_bytes
                properties:
                  error:
                    type: string
                    enum:
                      - message_too_large
                      - request_too_large
                  max_bytes:
                    type: integer
              examples:
                message:
                  value:
                    error: message_too_large
                    max_bytes: 262144
                request:
                  value:
                    error: request_too_large
                    max_bytes: 116042412
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: >-
            Session writes are disabled, runtime preflight is unavailable, the
            message could not be recorded with its required steering audit
            entry, or a question answer could not be recorded
            (`question_admission_unavailable`; resend it with the same
            client_message_id).
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
                    enum:
                      - cloud_agents_disabled
                      - runtime_preflight_unavailable
                      - steering_audit_unavailable
      security:
        - reasonApiKey:
            - run
components:
  parameters:
    orgId:
      name: orgId
      in: path
      required: true
      description: Organization id or slug. Resolve it with `GET /v3/self`.
      schema:
        type: string
  schemas:
    SessionCompaction:
      type: object
      properties:
        threshold_tokens:
          description: >-
            The context size, in tokens, at which the Session folds its earlier
            turns into a summary (automatic compaction). A value past what the
            model can hold (its window less its output room) compacts there
            instead; getSession reports the effective
            `context.compaction_threshold_tokens` and its
            `context.compaction_threshold_source`. null clears the Session's own
            value, leaving the workspace's `compaction` setting (updateSetting)
            or else Reason's recommendation. Reason's recommendation for a
            Reason-paid model with a long-context price tier (GPT-6 Luna: input
            past 272k costs double) compacts about 32k below that tier; a higher
            threshold pays the long-context price for every request past it.
          type:
            - integer
            - 'null'
          minimum: 64000
          maximum: 10000000
      required:
        - threshold_tokens
      additionalProperties: false
      description: >-
        Sets the Session's context compaction policy from now on, for this and
        later turns (and the Sessions it starts afterwards). A turn already
        running keeps the threshold it started with; the next turn uses the new
        one.
    SendSessionMessageResponse:
      type: object
      properties:
        ok:
          type: boolean
          description: 'True: the message was accepted.'
        delegation:
          type: object
          properties:
            max_depth:
              type: integer
              minimum: 1
              maximum: 5
              description: How deep the tree may nest below its root Session.
            children_can_create_sessions:
              type: boolean
              description: >-
                Whether subagents above the last level may create Sessions that
                join the tree.
          required:
            - max_depth
            - children_can_create_sessions
          description: >-
            The Session's delegation limits after this request, when it sent
            `delegation`.
        delivery:
          type: string
          description: >-
            How the message was delivered: queued_for_next_turn (a steer
            accepted into the running turn: the normal receipt, entering at its
            next model step), steered_live (the steer already entered it),
            held_in_queue (waits for the turn to end), started_continuation_run
            or reattached_warm_session (started a new turn),
            applied_to_queued_run, saved_for_follow_up (saved; see held_reason),
            queue_cancelled or continuation_blocked.
        delivery_detail:
          type: string
          description: >-
            What the delivery means for the sender, when it needs saying: for
            queued_for_next_turn, that the steer was accepted and is not to be
            resent or the Session cancelled; for started_continuation_run, that
            the new turn is queued and has not started; for
            applied_to_queued_run, that the turn was queued, waiting to start or
            resume.
        continuation_session_id:
          description: >-
            The stable logical Session id after an accepted follow-up. Continue
            polling this id; Reason may run the turn in a hidden execution
            Attempt.
          type:
            - string
            - 'null'
        message_id:
          type: string
          description: >-
            The accepted message's id, matching listSessionMessages. For
            delivery queue, use it to send the message at once or withdraw it
            while it waits.
        client_message_id:
          type: string
          description: >-
            The message's idempotency key: the client_message_id sent, or the
            one the server gave it. Resending the message with it returns this
            accepted turn instead of adding another.
        held_reason:
          type: string
          description: >-
            Present when delivery is saved_for_follow_up and the message is
            waiting instead of starting. session_machine_transition_pending: the
            Session's machine is changing; the message is delivered when the
            change settles, so do not send it again. If the change has not
            settled after 10 minutes the message is marked not delivered
            instead.
      required:
        - ok
    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.
  responses:
    Unauthorized:
      description: Missing, invalid, or expired key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: missing_bearer
            message: Authorization required
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: session_not_found
    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:
    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).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.