Skip to main content
POST
Create a Loop

Authorizations

Authorization
string
header
required

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, knowledge:read, memory:read, memory:write, skills:read, skills: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. network:read and network:write are opt-in, excluded from default keys. 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).

Path Parameters

orgId
string
required

Organization id or slug. Resolve it with GET /v3/self.

reasonId
string<uuid>
required

The Reason id, returned as id by listReasons and createReason.

Body

application/json

A new Loop filed under the Reason. It is the caller's: its runs act as the Reason, are billed to the workspace as the caller's, and need the caller's access to any Session, computer, repository or Slack channel it names.

prompt
string
required

The instructions the Reason follows on each wake. An event's body reaches it as untrusted data, never as instructions.

Required string length: 1 - 100000
wake_on
object[]
required

Everything that wakes the Loop: at most one schedule, one webhook and one Slack listener, and GitHub events on one repository. A Loop woken by several things at once is in early access for some workspaces (403 wake_on_unavailable elsewhere). On update it replaces what wakes the Loop.

Required array length: 1 - 8 elements

Wake on a schedule.

Example:
name
string

Label in the Reason's Loops list. Defaults to the start of prompt.

Required string length: 1 - 200
enabled
boolean
default:true

Send false to create it paused.

until
string<date-time> | null

End of a scheduled Loop: no wake after this time, then it reads completed. null clears it. A Loop woken by events has no end of its own.

max_runs
integer | null

How many runs a scheduled Loop makes before it reads completed, counted from when it is set. null clears it.

Required range: 1 <= x <= 100000
execution_mode
enum<string>

session continues one Session across wakes, the one in session_id or else one of the Loop's own that its first wake opens; new_session opens a fresh Session on every wake. A Loop woken by events opens a Session per event (events sharing a correlation key continue one), so it takes neither.

Available options:
session,
new_session
session_id
string<uuid> | null

An existing Session of the caller's that each wake continues. null unbinds it.

device_id
string<uuid> | null

A connected computer of the caller's (listDevices) that its runs use; null runs them on a Reason cloud machine.

notification_policy
enum<string>

When the Loop tells the person about a run: on important updates (the default) or only when a run fails.

Available options:
important_updates,
failed_runs_only
timezone
string

IANA time zone a cron schedule is read in, such as America/Los_Angeles. Defaults to UTC, or keeps the Loop's own on update.

Required string length: 1 - 120
model
string | null

Model its runs use, as a Session model id. null or auto runs it on the model of the Session it continues, or the workspace's. An id the workspace cannot pin returns 400 invalid_model.

Required string length: 1 - 200

Response

The new Loop, and its webhook's URL and key when it has one.

The Loop as saved, and the webhook it just gave out, when it did.

loop
object
required

A Loop: standing work a Reason does, woken by a schedule or an event. Each wake opens or continues a Session of the Reason.

webhook
object

The webhook a Loop just gave out, returned once.