# Moxo API reference (version 3.0.0)

Generated from https://api.moxo.com/v1/openapi.json, where each schema named below is defined in full.

The Moxo API lets your own systems start and run flows, act on their steps, build templates and read what happened.

The base URL is your region's API address: `https://api.moxo.com` (US), `https://api.eu.moxo.com` (EU), `https://api.au.moxo.com` (Australia) or `https://api.sg.moxo.com` (Singapore). A token works only in the region your organization is in. Every REST path starts with `/v1`, and requests and responses are JSON.

## Quick start

1. Create a personal access token in **Settings → Personal access tokens**. It needs the **Personal access tokens** permission, which Owner and Admin have and an admin turns on for other groups. It is shown once, so store it in a secret manager.
2. List your templates:

```bash
curl https://api.moxo.com/v1/templates \
  -H "Authorization: Bearer mxo_pat_YOUR_TOKEN"
```

3. Start a flow from one of them, giving each role a person who is already a user in your organization:

```bash
curl -X POST https://api.moxo.com/v1/templates/tmpl_123/start \
  -H "Authorization: Bearer mxo_pat_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme onboarding",
    "roleAssignments": [
      { "roleId": "role-customer", "email": "ana@example.com" }
    ]
  }'
```

The response carries the new flow's `id`. Read the flow with `GET /v1/flows/{id}`. [Run flows from code](/docs/guides/run-flows-from-code) continues from here, in Node.js and Python.

## Authentication

Send a token in the `Authorization` header of every request:

```
Authorization: Bearer mxo_pat_...
```

There are two kinds of token:

- **Personal access token** (`mxo_pat_`): acts as you, with your permissions in Moxo. Use it for scripts, for trying the API and for anything done as yourself. It expires by default.
- **Organization API key** (`mxo_sk_`): your organization's credential for systems that run unattended. It is limited to the scopes you give it, can be limited to IP ranges, and does not depend on any one person's account.

A personal access token sees exactly what its person sees in Moxo, so an admin's token sees what an admin sees. An organization API key sees what an admin sees, within its scopes.

Create a personal access token in **Settings → Personal access tokens**, and an organization API key in **Settings → API keys** (admins). A token is shown once, when you create it, so store it in a secret manager.

### Scopes

Each endpoint names the scope an organization API key needs to call it. A `:write` scope includes its `:read` scope, so `flows:write` covers `flows:read`. Give a key only the scopes it needs.

- `flows:read`: list and read flows, their steps and their history.
- `flows:write`: start, cancel and complete flows and steps.
- `templates:read`: list and read templates, their published versions, outlines and files, and run a template's publish checks.
- `templates:write`: includes `templates:read`. Building, changing, publishing and deleting a template act as a person, so they take a personal access token whatever the key holds.
- `external_users:read`: list and read external users and accounts.
- `external_users:write`: create, change and delete external users and accounts.
- `reports:read`: read dashboards, SLA and bottleneck reports.
- `data_tables:read`: list data tables and read their columns and records.
- `data_tables:write`: create and change tables, columns and records, and import a CSV.
- `relationships:read`: list relationships and read one, by its id or your own external reference.
- `relationships:write`: create a relationship, change one, delete one, and sync or import a batch. A key holding this acts for the whole organization, as an admin does in the app.
- `chat:read`: read the chat inside a flow (`GET /v1/flows/{id}/messages`).
- `conversations:read`: list and read conversations, both group conversations and flow chats.
- `conversations:write`: create, change, archive and delete conversations, manage their members and send messages.
- `actions:read`: list and read the actions your organization has sent or received (`GET /v1/actions`), and the action webhooks (`GET /v1/organization/action-webhooks`).
- `actions:write`: includes `actions:read`. Set the action webhooks and send them a test (`/v1/organization/action-webhooks`). Sending an action, reminding people about it and canceling it act as a person, so they take a personal access token.
- `team:read`: list internal users, pending invitations, personas and permission groups.
- `team:write`: invite internal users, and change an internal user with `PATCH /v1/users/{id}`, their persona included. Creating and changing personas and permission groups themselves acts as a person, so it takes a personal access token.
- `users:email`: change the email an external user signs in with (`email` on `PATCH /v1/users/{id}`), for someone your organization knows by a unique ID. The key also needs `external_users:write`, which every change on `PATCH /v1/users/{id}` takes. `*` does not include it: name it when you create the key.
- `users:unique_id`: change the unique ID of an external user your organization already knows by one (`uniqueId` on `PATCH /v1/users/{id}`). The old ID is recorded in the audit log. The key also needs `external_users:write`, which every change on `PATCH /v1/users/{id}` takes. `*` does not include it: name it when you create the key.
- `audit:read`: read the organization's audit log.
- `ai:generate`: ask the AI builder for a draft template (`POST /v1/ai/generations`) and read your own generation jobs.
- `sdk:mint`: create short-lived SDK session tokens for your users (`POST /sdk/auth/sessions`). A session has its user's own permissions for running and building work, not the key's scopes and never an admin's, and works only in the embedded screens and the `/sdk` calls: `/v1` and the MCP server refuse it.
- `*`: every scope except `users:email` and `users:unique_id`.

A personal access token has no scopes. It can do through the API what its person can do in the app, as set in **People → Orchestrator permissions**, and it works only while that permission includes **Personal access tokens**: turned off, the token answers `403 CAPABILITY_DENIED` until it is turned back on.

### Which token each endpoint takes

Two things are done only in the app, never with a token:

- Managing API keys, so that no token can create another.
- Billing and plan changes.

Every other `/v1` endpoint that takes a token accepts a personal access token, and most accept an organization API key with the right scope. Endpoints that act as a person need a personal access token:

- Completing, declining, preparing or reviewing your own step, or picking a record on it.
- Reading, marking or approving the items you review together.
- Force-completing a step.
- Posting, editing, deleting, resolving, pinning or reacting in a flow's chat, and getting files ready for a message.
- Filling in, writing or restoring a flow's artifacts, and reading a document's versions (an organization API key with `flows:read` reads the artifacts).
- Filing a flow under tags.
- Reading or taking part in a step's document collaboration: the page, sending, approving, drafting, comments and a manager's upload or reminder.
- Reading or changing a Prepare document, the Word file a person prepares before signing.
- Writing a flow note (an organization API key with `flows:read` reads them).
- Starting an adaptive flow with no template.
- Sending an action, reminding people about it or canceling it.
- Deleting a template.
- Restoring a template version.
- Starting a test run.
- Listening for a webhook test event, and reading what it started.
- Making, renaming, moving or removing a template folder.
- Building, changing or publishing a template, with or without AI.
- Reading an AI agent as a file.
- Creating, changing or publishing an AI agent (an organization API key with `templates:read` reads them).
- Changing a template's setup (an organization API key with `templates:read` reads it).
- Setting up how a template starts, and reading its email start (an organization API key with `templates:read` reads its schedules and app triggers).
- Making, renaming or removing folders in a conversation's files.
- Joining a group conversation you can read.
- Leaving a group conversation.
- Handing a group conversation to a teammate.
- Managing a group conversation.
- Opening a relationship’s conversation.
- Creating, changing or deleting personas and permission groups, and taking a persona from someone (an organization API key with `team:read` reads them).
- Listing the steps waiting on you.
- Reading your meetings and linking them to work.
- Reading your own profile (an organization API key reads people with `GET /v1/users`).
- Unread counts and read markers.

The Headless SDK's `/sdk/v1/*` endpoints take only a short-lived SDK session token, created with `POST /sdk/auth/sessions`, and refuse personal access tokens and organization API keys. Self-serve signup's `/v1/provision/*` endpoints take no token: the verified email and its single-use grant are the credential.

## Key concepts

Four words cover most of this reference. The [Glossary](#tag/glossary) defines the rest.

- **Template**: the process you design and publish.
- **Flow**: one run of a template, started for a specific case.
- **Step**: one piece of work in a flow, done by a person, an AI or an automation.
- **Role**: who does a step, such as Client or Reviewer. Each role is filled with real people when a flow starts.

## Pagination

Most lists page with `limit` and `offset`. Each page includes `pagination.total` and `pagination.hasMore`. For the next page, add `limit` to `offset`:

```bash
curl "https://api.moxo.com/v1/flows?limit=50&offset=50" \
  -H "Authorization: Bearer mxo_pat_YOUR_TOKEN"
```

A list filtered by `updatedSince`, and any list that says so, pages with `cursor` instead: send `pagination.nextCursor` back as it is, with the same filters. A changed cursor returns `400 INVALID_CURSOR`.

Every call reads its query parameters as its reference lists them. A parameter the call does not list returns `400 UNKNOWN_PARAMETER` naming it. A `limit` or `offset` outside the listed range, a value a filter does not take, or a parameter sent twice returns `400 VALIDATION_FAILED` naming it. Nothing is clamped or ignored.

## Idempotency

Endpoints that create or send something, such as a flow, a user or an email, accept an optional `Idempotency-Key` header; each one lists it among its parameters. Send a new UUID with each request. If the request fails on the network, retry it with the same key: for 10 minutes, a retry returns the first response and changes nothing. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key returns `400 INVALID_IDEMPOTENCY_KEY` and nothing runs.

- **Still running:** a second request with the same key returns `425 IDEMPOTENT_REQUEST_PENDING` with `Retry-After`. Retry after that many seconds.
- **After a `4xx`:** nothing was saved, so the key is free. Fix the request and send it again with the same key.
- **After a `5xx`:** the change may have been made, so the key stays held for the 10 minutes and retries with it return `425`. To retry sooner, use a new key and accept that the change may happen twice.
- **After 10 minutes:** the same key runs the request again. A late retry can start a second flow or send a second email, so use a new key for it.
- **Reused for a different request:** a key sent again with another body, path, query or method returns `422 IDEMPOTENCY_KEY_REUSED` and nothing runs; the first request's result stays. Use a new key for each request.
- **What the first request made was deleted:** a retry returns `410 IDEMPOTENCY_RESULT_LOST`. Check what happened, then use a new key.
- **Per token:** two tokens can use the same key without affecting each other.

A retry of a call that creates something returns that thing as it is now, read again, not as it was. A retry of a call that sends a reminder or an invitation returns the same `{ "success": true }` as the first call. The guarantee covers the change the first call made, not the delivery of the email it sent.

Endpoints that set something to a fixed state, such as `PATCH`, `DELETE`, activate or skip, ignore the header: repeating them is already safe.

## Response format

A successful response has `success: true` and the result in `data`:

```json
{
  "success": true,
  "data": { "id": "flow_123" }
}
```

Rarely, a change is saved but its full response can't be put together. The response then keeps its success status and carries `success: true`, the `id` of what changed in `data`, and `changed` and `message` when the endpoint returns them. The change is made, so don't send the request again: read the resource to see the rest.

An error response has `success: false` and the details in `error`:

```json
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Flow not found",
    "requestId": "req_abc123"
  }
}
```

## Errors

An error response has an HTTP status, an `error.code` your code can act on, and an `error.message` that says what went wrong. A request that fails its schema check returns `400 VALIDATION_FAILED`, and `error.details` names each field. Each endpoint lists the errors it returns, and [Errors](#tag/errors) lists every code with what to do. Include `error.requestId` when you contact support.

## Rate limits

- 1,000 requests per minute for each token. Past it, a request returns `429 RATE_LIMITED`.
- 10 failed tokens per 15 minutes from one IP address: a token that is mistyped, expired or revoked, or sent from an address the key does not allow. Past it, every request from that address returns `429 AUTH_BRUTEFORCE_LIMIT`, even with a good token, until the window passes.
- 20 actions an hour from one person into each conversation, and 20 from no conversation (`POST /v1/actions`). Past it, the call returns `429 TOO_MANY_REQUESTS` with `error.retryAt`, when sending works again. For this code, wait for `Retry-After`, not the `RateLimit` reset.

Each response carries a `RateLimit` header (`limit`, `remaining`, and `reset` in seconds) and a `RateLimit-Policy` header. A `429` carries `Retry-After`: wait that many seconds, then retry.

## Knowledge limits

- A knowledge file can be up to 100 MB, and about 5 million tokens of text. Text past that is read in part, and the file says so.
- An agent holds up to 500 files and 1 GB of knowledge. Files shared in its setup chat have their own 500 files and 1 GB. A Google Drive folder or a website counts as one source.
- What counts is the agent's draft. A file only a published version still uses does not count: it stays for the flows that run on that version.
- The organization library holds up to 1,000 files and sources and 10 GB.
- A website crawl reads up to 500 pages in 20 minutes, and follows the site's robots.txt.
- These are the standard limits. Moxo can raise an organization's agent and library limits on request.
- A request past a limit answers `400` with a sentence that says the limit, what is used, and what to do next.

## Versioning and changelog

This reference describes version 3.0.0 of the API, which `GET /v1/health` also returns. The [changelog](/v1/changelog) lists every change with its date and, when one applies, how to migrate.

A renamed field keeps working. This reference shows only the new name, but a request that sends the older one is still read as the new one, and its answer carries a `Deprecation` header (`RFC 9745`) with a `Link` to the changelog (`rel="deprecation"`). An answer keeps sending each renamed field beside its new one, marked deprecated here. No date is set for an older name to stop working; send the new one.

A setting that went with a removed feature is ignored, not refused: nothing is stored, and the answer carries a `Warning` header that names it (`299 - "<name> is no longer used; it was ignored."`). An older way to write the same thing, such as a reference written `{Intake / Email}`, is read as the current one and named the same way.

## Guides

- [Run flows from code](/docs/guides/run-flows-from-code): start flows, complete steps and read the results, in Node.js and Python.
- [Build templates from code](/docs/guides/build-templates-from-code): create, change, check and publish templates with a list of changes.
- [Templates as files](/docs/guides/templates-as-files): keep a template in a repository as a `.yaml` file, and push your edits.
- [Agents as files](/docs/guides/agents-as-files): keep an AI agent in a repository as a `.yaml` file, and push your edits to its draft.
- [Webhooks](/docs/guides/webhooks): get an HTTP request when a flow, step or action changes, and verify that it came from Moxo.
- [llms.txt](/llms.txt): the machine-readable index of these docs, for AI coding assistants.
- [The whole reference as markdown](/docs/reference.md)

All guides are at [/docs/guides](/docs/guides). To connect an AI agent, see the [MCP server](/docs/mcp). To put Moxo inside your own app, see the [Web SDK](/docs/sdk) and the [Headless SDK](/docs/headless).

## Flows

Start, list, cancel and manage flows. A flow is one run of a template.

### `GET /v1/flows/{id}/artifacts`: List a flow's artifacts

Returns the flow's artifacts (its deliverables), with the flow's values filled in, as the app shows them to the person the token belongs to: a flow manager reads every artifact, anyone else only the ones shared with their role, and no one reads a block of a step they can't see. Files carry short-lived download links. An organization API key reads them as a flow manager does. Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`).

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string): The flow's id.

**Responses**

- `200` (object): The artifacts you may read, and what you may do with them.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/artifacts/blocks/{blockId}`: Fill in an artifact block

Fills in a field block (`kind: "input"`), or edits an AI block's text (`kind: "ai"`, which then counts as edited by a person). A manager may change any; anyone else only a block shared with them to edit, and not after the flow finished. A block that can't be filled in returns `400`, one you may not change `403`. Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The block's value now.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/artifacts/blocks/{blockId}/generate`: Have AI write an artifact block

Has the AI write an AI block's text from the flow's data, replacing what it held. Only a flow manager can do this (`403`). A block that is not an AI block returns `400`. When the AI can't answer, nothing is written and the call returns `503 AI_UNAVAILABLE` with `Retry-After`: try again. Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.

**Responses**

- `200` (object): The text the AI wrote.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The AI could not answer just now (`AI_UNAVAILABLE`), and nothing was saved. Usually `error.retryable` is `true`: try again after the number of seconds in `Retry-After`. When `error.retryable` is `false` (there is no `Retry-After`), a retry will not help until the AI account is fixed on the Moxo side: contact support with the `requestId`.

### `PATCH /v1/flows/{id}/artifacts/docs/{blockId}`: Save an artifact document

Saves the whole document of a document block (`kind: "richtext"`). Send the `rev` you read as `baseRev`: when someone saved since, it returns `409 STALE_WRITE` with `data.currentRev`; read it again and merge. A document that isn't in the editor's form returns `400 INVALID_DOCUMENT`. A manager may edit any; anyone else only one shared with them to edit, and not after the flow finished. Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The document as saved.
- `400` (ErrorResponse): Refused: `INVALID_DOCUMENT`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `STALE_WRITE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/artifacts/docs/{blockId}/history`: List an artifact document's versions

Lists the versions kept of a document block, newest first. Only a flow manager can do this (`403`). Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`). Needs a personal access token: a document's versions are read by a person (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.

**Responses**

- `200` (object): The versions.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/artifacts/docs/{blockId}/history`: Name a version of an artifact document

Keeps the document as it is now, under a name. An empty document returns `400`. Only a flow manager can do this (`403`). Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The version kept.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/artifacts/docs/{blockId}/history/{snapshotId}`: Read an artifact document's version

Returns one kept version of a document block. Only a flow manager can do this (`403`). Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`). Needs a personal access token: a document's versions are read by a person (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.
- `snapshotId` (path, required, string): The version's id.

**Responses**

- `200` (object): The version.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/artifacts/docs/{blockId}/restore`: Restore a version of an artifact document

Puts a kept version back as the document. What it held before is kept as a version too. Only a flow manager can do this (`403`). Artifacts must be on for your organization's plan (`403 FEATURE_DISABLED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `blockId` (path, required, string): The block's `id`, from `GET /v1/flows/{id}/artifacts`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The document's revision after the restore.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows`: List flows

Returns a paginated list of flows. Filter by status, template, account, people, the current step, the current step's type (`stepType`), health, dates, flow fields, a name or number, what changed since a time, or the flow that started them (`originFlowId`, `rootFlowId`). These filters mean the same thing in the app, here and in the MCP tool list_flows.

Filters about a person take that person’s id (usr_…) from any caller. “me” means the caller, so it works only with a personal access token; with an organization API key it returns 400.

A personal access token lists only the flows its person can open, and never matches a value that **Show progress only** hides from them. An organization API key sees what an admin sees.

**Test runs are never listed**, in any `lifecycle`, archived or not. Read one with `GET /v1/flows/{id}`, by the `flowId` that `POST /v1/templates/{id}/test-runs` returned.

A parameter this list doesn’t know returns `400 UNKNOWN_PARAMETER`, naming it. A template id that names nothing you can see returns `404`, naming the parameter.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `status` (query, string): Filter by flow status. One value, or several as a comma-separated list (a flow matching any of them), for example `IN_PROGRESS,PAUSED`. Supported: `NEW`, `IN_PROGRESS`, `PAUSED`, `COMPLETED`, `CANCELLED`, `WAITING_FOR_ASSIGNEE`, `LIVE`. `NEW` (started, and nobody has opened a step yet), `WAITING_FOR_ASSIGNEE` (an active step with no assignee) and `LIVE` (in progress or paused) are worked out from the flow, so a response never contains them. An unsupported value returns 400 instead of an empty page. To select archived flows, use `lifecycle`.
- `templateId` (query, string): Only return flows started from this template.
- `templateIds` (query, string): Only return flows started from any of these templates, as a comma-separated list (up to 200).
- `templateVersionId` (query, string): Only return flows started from this template version.
- `accountId` (query, string): Only return flows linked to this account. A flow is linked to an account whenever an external participant on the flow belongs to it; the link is automatic.
- `search` (query, string): Part of the flow’s name or number, not case-sensitive.
- `lifecycle` (query, string): Whether to return active or archived flows. `active` (the default) leaves out archived flows, `archived` returns only archived flows, and `all` returns both. `includeArchived=true` also means `all`.
- `originFlowId` (query, string): Only return the flows this flow started directly: its sub-flows, and the flows its Start a flow and Schedule a flow steps started. A flow you can't open returns `404`: "originFlowId: no flow flow_2210 that you can see." Flows below it that you can't open are left out. This is not the same as cancellation: only flows with `startedByKind: sub_flow` are canceled with the flow that started them.
- `rootFlowId` (query, string): Return every flow this flow started, at any depth up to 5 levels, as one flat list. Each row's `originFlowId` and `depth` place it in the tree (1 is a direct child; `depth` is null on lists without `rootFlowId`), `startedByKind` says how it was started and `startedByStepId` which step started it. A flow you can't open returns `404`: "rootFlowId: no flow flow_2210 that you can see." Flows you can't open are left out; a flow below one of them still comes back, with that parent's id.
- `flowIds` (query, string): Only these flows, as a comma-separated list (up to 200). Returns every match on one page.
- `sort` (query, string): `recent` (default): latest activity first, the time each row shows as `lastActivityAt`. `newest`: start date, newest first. `oldest`: start date, oldest first. `due-date`: earliest due first, flows with no due date last. `due-date-latest`: latest due first, no due date last. `completed-newest` / `completed-oldest`: by completed date, flows with none last. `auto-number`: by flow number. Not with `updatedSince`.
- `involved` (query, string): Only flows you started, hold a role on, own the template of, or have a step in. Needs a personal access token.
- `assigneeId` (query, string): Only return flows with an open step assigned to this person. A person’s id (`usr_…`), or `me` for you; `me` needs a personal access token.
- `roleHolderId` (query, string): Only return flows where this person holds a role. Add `roleId` for one role. A person’s id (`usr_…`), or `me` for you; `me` needs a personal access token.
- `roleId` (query, string): With `roleHolderId`: that person in this role (a `roleId` from the template).
- `roleName` (query, string): Only flows where someone holds a role with this name, such as `Reviewer`, on any template.
- `involvedUserId` (query, string): Only return flows this person started, holds a role on, or has a step in. A person’s id (`usr_…`), or `me` for you; `me` needs a personal access token.
- `currentStepId` (query, string): Only flows at this step (the template’s step id).
- `stepType` (query, string): Only flows whose current step is this type. A step type such as `FORM` or `DOCUSIGN`, a group (`group:actions`, `group:ai-utilities`, `group:controls`, `group:automations`, `group:connected-app`), or one connected app (`app:` plus the app id). An External app step matches `config.externalApp.appId`, or `config.appId` when that is absent. An MCP server step for that app matches too. A step with no stored type matches the type on the flow definition. Any step in progress counts, including one of several running together. A finished or upcoming step does not. The same value narrows the app's list and its export.
- `needsAttention` (query, string): Only flows that need your attention. Needs a personal access token.
- `attentionReasons` (query, string): Only flows that need your attention for one of these reasons, comma-separated, for example `YOUR_TURN,STEP_OVERDUE`. Needs a personal access token.
- `health` (query, string): On track, off track, or overdue, as the Process Report computes it.
- `hasFailed` (query, string): Only flows with at least one failed step.
- `startedAfter` (query, string): Only flows started at or after this time.
- `startedBefore` (query, string): Only flows started before this time.
- `completedSince` (query, string): Only flows completed at or after this time.
- `completedUntil` (query, string): Only flows completed at or before this time. Inclusive: a flow completed at this instant is included.
- `completedStatusOnly` (query, string): With a completed-date window: `true` keeps only flows whose status is Completed. A canceled flow also records a completed time. Omit it to count every flow that finished in the window.
- `dueAfter` (query, string): Only flows due at or after this time. The flow’s own due date, not a step’s.
- `dueBefore` (query, string): Only flows due before this time.
- `hasDueDate` (query, string): `false`: only flows with no due date. `true`: only flows that have one.
- `reopenedStepId` (query, string): Only flows where this step (the template’s step id) was reopened.
- `reopenedSince` (query, string): Only flows with a step reopened at or after this time.
- `reopenedUntil` (query, string): Only flows with a step reopened at or before this time.
- `includeArchived` (query, string): The old spelling of `lifecycle=all`: `true` returns active and archived flows. `lifecycle` wins when both are sent.
- `includeSubFlows` (query, string): Has no effect: sub-flows are always listed. Kept so older requests still work.
- `field[key]` (query, string): Only return flows whose field with this key has exactly this value, for example `field[account_id]=ACC-4471`. For a choice field, send the option’s id. Field keys are on `GET /v1/templates/{id}`. A field hidden from you by Show progress only never matches. If no template you can see has the key, the call returns `400 UNKNOWN_FIELD`.
- `updatedSince` (query, string): Only flows with a change at or after this time: a field, an answer, a step, a person or a status. Opening or viewing a flow is not a change. For people who can’t see every part of a flow, only changes they can see count, and it errs toward fewer: a change the app shows them may not count. An archived flow is returned with its `archivedAt`, and a deleted one as `{ id, deleted: true, lastChangedAt }`, only to someone who could see it. Rows come oldest change first, each with its `lastChangedAt`. Page with `cursor`: send `pagination.nextCursor` back as it is, with the same filters, and keep the last one for your next run. Delivery is at least once: a flow can repeat within 5 minutes of your previous run’s end. Rarely, a change is missed: one saved by a background process in Moxo that ran longer than 5 minutes, or by any save that ran longer than 15 minutes. On `GET /v1/templates`, a change is a publish.
- `cursor` (query, string): `cursor` pages a list filtered by `updatedSince`: send `pagination.nextCursor` back as it is. Every other list pages with `offset`: how many flows to skip, the previous `offset` plus `limit`. A cursor that can’t be read returns `400 INVALID_CURSOR`.
- `limit` (query, number): Flows per page, 1 to 100. Defaults to 50. Any other value returns 400.
- `offset` (query, object): How many flows to skip. Defaults to 0. Not with `updatedSince`, which pages with `cursor`.

**Responses**

- `200` (object): A page of flows. With `updatedSince` or `cursor`, `pagination` is `{ limit, hasMore, nextCursor }` and `nextCursor` is always set: keep the last one for your next run.
- `400` (ErrorResponse): Refused: `UNKNOWN_PARAMETER`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/counts`: Count flows

Returns how many flows match, in all and per template, with the same filters and the same visibility as `GET /v1/flows`, in one call instead of paging the list. For example, `GET /v1/flows/counts?status=IN_PROGRESS` counts running flows by template, most first.

Filters about a person take that person’s id (usr_…) from any caller. “me” means the caller, so it works only with a personal access token; with an organization API key it returns 400.

A personal access token counts only the flows its person can open. `updatedSince` is not taken here; page `GET /v1/flows?updatedSince=` for what changed.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `status` (query, string): Filter by flow status. One value, or several as a comma-separated list (a flow matching any of them), for example `IN_PROGRESS,PAUSED`. Supported: `NEW`, `IN_PROGRESS`, `PAUSED`, `COMPLETED`, `CANCELLED`, `WAITING_FOR_ASSIGNEE`, `LIVE`. `NEW` (started, and nobody has opened a step yet), `WAITING_FOR_ASSIGNEE` (an active step with no assignee) and `LIVE` (in progress or paused) are worked out from the flow, so a response never contains them. An unsupported value returns 400 instead of an empty page. To select archived flows, use `lifecycle`.
- `templateId` (query, string): Only return flows started from this template.
- `templateIds` (query, string): Only return flows started from any of these templates, as a comma-separated list (up to 200).
- `templateVersionId` (query, string): Only return flows started from this template version.
- `accountId` (query, string): Only return flows linked to this account. A flow is linked to an account whenever an external participant on the flow belongs to it; the link is automatic.
- `search` (query, string): Part of the flow’s name or number, not case-sensitive.
- `lifecycle` (query, string): Whether to return active or archived flows. `active` (the default) leaves out archived flows, `archived` returns only archived flows, and `all` returns both. `includeArchived=true` also means `all`.
- `originFlowId` (query, string): Only return the flows this flow started directly: its sub-flows, and the flows its Start a flow and Schedule a flow steps started. A flow you can't open returns `404`: "originFlowId: no flow flow_2210 that you can see." Flows below it that you can't open are left out. This is not the same as cancellation: only flows with `startedByKind: sub_flow` are canceled with the flow that started them.
- `rootFlowId` (query, string): Return every flow this flow started, at any depth up to 5 levels, as one flat list. Each row's `originFlowId` and `depth` place it in the tree (1 is a direct child; `depth` is null on lists without `rootFlowId`), `startedByKind` says how it was started and `startedByStepId` which step started it. A flow you can't open returns `404`: "rootFlowId: no flow flow_2210 that you can see." Flows you can't open are left out; a flow below one of them still comes back, with that parent's id.
- `flowIds` (query, string): Only these flows, as a comma-separated list (up to 200). Returns every match on one page.
- `involved` (query, string): Only flows you started, hold a role on, own the template of, or have a step in. Needs a personal access token.
- `assigneeId` (query, string): Only return flows with an open step assigned to this person. A person’s id (`usr_…`), or `me` for you; `me` needs a personal access token.
- `roleHolderId` (query, string): Only return flows where this person holds a role. Add `roleId` for one role. A person’s id (`usr_…`), or `me` for you; `me` needs a personal access token.
- `roleId` (query, string): With `roleHolderId`: that person in this role (a `roleId` from the template).
- `roleName` (query, string): Only flows where someone holds a role with this name, such as `Reviewer`, on any template.
- `involvedUserId` (query, string): Only return flows this person started, holds a role on, or has a step in. A person’s id (`usr_…`), or `me` for you; `me` needs a personal access token.
- `currentStepId` (query, string): Only flows at this step (the template’s step id).
- `stepType` (query, string): Only flows whose current step is this type. A step type such as `FORM` or `DOCUSIGN`, a group (`group:actions`, `group:ai-utilities`, `group:controls`, `group:automations`, `group:connected-app`), or one connected app (`app:` plus the app id). An External app step matches `config.externalApp.appId`, or `config.appId` when that is absent. An MCP server step for that app matches too. A step with no stored type matches the type on the flow definition. Any step in progress counts, including one of several running together. A finished or upcoming step does not. The same value narrows the app's list and its export.
- `needsAttention` (query, string): Only flows that need your attention. Needs a personal access token.
- `attentionReasons` (query, string): Only flows that need your attention for one of these reasons, comma-separated, for example `YOUR_TURN,STEP_OVERDUE`. Needs a personal access token.
- `health` (query, string): On track, off track, or overdue, as the Process Report computes it.
- `hasFailed` (query, string): Only flows with at least one failed step.
- `startedAfter` (query, string): Only flows started at or after this time.
- `startedBefore` (query, string): Only flows started before this time.
- `completedSince` (query, string): Only flows completed at or after this time.
- `completedUntil` (query, string): Only flows completed at or before this time. Inclusive: a flow completed at this instant is included.
- `completedStatusOnly` (query, string): With a completed-date window: `true` keeps only flows whose status is Completed. A canceled flow also records a completed time. Omit it to count every flow that finished in the window.
- `dueAfter` (query, string): Only flows due at or after this time. The flow’s own due date, not a step’s.
- `dueBefore` (query, string): Only flows due before this time.
- `hasDueDate` (query, string): `false`: only flows with no due date. `true`: only flows that have one.
- `reopenedStepId` (query, string): Only flows where this step (the template’s step id) was reopened.
- `reopenedSince` (query, string): Only flows with a step reopened at or after this time.
- `reopenedUntil` (query, string): Only flows with a step reopened at or before this time.
- `includeArchived` (query, string): The old spelling of `lifecycle=all`: `true` returns active and archived flows. `lifecycle` wins when both are sent.
- `includeSubFlows` (query, string): Has no effect: sub-flows are always listed. Kept so older requests still work.
- `field[key]` (query, string): Only return flows whose field with this key has exactly this value, for example `field[account_id]=ACC-4471`. For a choice field, send the option’s id. Field keys are on `GET /v1/templates/{id}`. A field hidden from you by Show progress only never matches. If no template you can see has the key, the call returns `400 UNKNOWN_FIELD`.

**Responses**

- `200` (object): The counts.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}`: Get flow

Returns the full flow: its members, roles, every step with its assignee, the current values of its flow fields, and the version of the template it runs on.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}`: Update flow info

Updates a flow's name, due date or flow field values. Send at least one of `name`, `dueAt` or `customFields`. Send each field by its `key` (`[{ key, value }]`), as `customFields[]` on `GET /v1/flows/{id}` lists it; an id there is refused, naming the key. Sending only values the flow already has changes nothing: the answer says `changed: false`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: UpdateFlowInfoRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{id}`: Delete a flow

Permanently deletes a flow and its history. A deleted flow can't be recovered. To hide a flow instead, archive it.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/tree`: Get flow tree

Returns the flow and every sub-flow in it as one list of rows, in order, with progress counted with its sub-flows. It shows what the flow page shows you: a step hidden from you is left out, and a sub-flow you can't open is one `locked` row with its template's name and status, not counted. Progress counts people's actions only, and a sub-flow only when the flow waits for it. Needs the Sub-flow tree view on your plan (`403 FEATURE_DISABLED` otherwise).

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The flow and its sub-flows as one tree.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/messages`: List flow chat messages

Returns the flow's chat: the messages people exchanged inside the flow (your team, external clients and AI agents), newest first, with threaded replies. What you see follows your access to the flow, and view-only access includes no chat. `internal_only` messages are notes for your team only. This is the flow's chat only, not group conversations or the AI builder's conversation.

**Tokens:** personal access token, organization API key
**Scope required:** `chat:read`

**Parameters**

- `id` (path, required, string)
- `limit` (query, integer): How many top-level messages to return, up to 200. Defaults to 100. Replies are nested inside their message and don't count toward this.
- `cursor` (query, string): The previous page's `pagination.nextCursor`. Leave it out for the first page.

**Responses**

- `200` (object): A page of chat messages, newest first.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/messages`: Post a flow chat message

Posts a message, with or without files, in the flow's chat as the person the token belongs to, with exactly the reach they have in the app: they need participate access to the flow, the flow must not be canceled, and comments must be on for the flow.

**Where it goes.** With `targetStepExecutionId` (`steps[].id` from `GET /v1/flows/{id}`), the message is on that step and its participants see it (`visibility: "all"`). Without it, a team member's message goes to the conversation for the whole flow, which only your team sees (`visibility: "internal_only"`), and an external person's goes on a step they can see. An external person can only choose a step they can see (`403 STEP_NOT_VISIBLE`).

**Files.** Get an upload link from `POST /v1/flows/{id}/messages/upload-init`, `PUT` the file to it, then send its `fileId` in `attachmentFileIds`. Files from the flow's project come from `POST /v1/flows/{id}/messages/from-project`. A message with files can have empty text. A file the message can't carry is refused: not found `404 ATTACHMENT_NOT_FOUND`, uploaded for another flow `400 ATTACHMENT_WRONG_FLOW`, not uploaded yet `400 ATTACHMENT_BAD_STATUS`, already on a message `409 ATTACHMENT_ALREADY_BOUND`, uploaded by someone else `403 ATTACHMENT_NOT_OWNED`, blocked by the virus scan `400 ATTACHMENT_SCAN_FAILED`, or an outside person's file in a message only your team sees `403 ATTACHMENT_VISIBILITY_MISMATCH`.

Needs a personal access token. An organization API key has no person to post as, so it gets `403 ASSIGNEE_REQUIRED`.

**Refusals:** `403 FEATURE_DISABLED` (chat is not on the organization's plan), `403 FLOW_CANCELLED` (the flow was canceled, so its chat is read-only), `403 PROGRESS_ONLY` (the flow is shared with this person to follow its progress only), `403 COMMENTS_DISABLED` (comments are off for this flow; reading still works), `403 STEP_NOT_VISIBLE` (`targetStepExecutionId` names a step this person can't see), `403 FORBIDDEN` (an external participant sent no `targetStepExecutionId` and has no step open on this flow, so name the step they are writing about; also a step that has no chat, such as an automation), `400 BAD_REQUEST` (`targetStepExecutionId` is not a step of this flow), `403 MENTION_NOT_ALLOWED` (`mentions` names someone who isn't on the flow, and this person isn't a flow manager, sent no `targetStepExecutionId`, or the template's Tag anyone in the organization setting is off), `400 MENTION_UNKNOWN` (`mentions` names someone who is not in this organization), `400 MENTION_EXTERNAL` (`mentions` names someone outside the organization who isn't on the flow), `400 MENTION_INACTIVE` (`mentions` names someone who is deactivated), `400 TOO_MANY_MENTIONS` (`mentions` names more than 10 people who aren't on the flow).

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns `201` with the original message instead of posting twice, or `410 IDEMPOTENCY_RESULT_LOST` when that message was deleted since. A retry while the first request is still running returns `425 IDEMPOTENT_REQUEST_PENDING`; wait `Retry-After` seconds and send it again.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The message: the new one, or the original one when this is a retry with the same `Idempotency-Key`.
- `400` (ErrorResponse): Refused: `ATTACHMENT_BAD_STATUS`, `ATTACHMENT_SCAN_FAILED`, `ATTACHMENT_WRONG_FLOW`, `BAD_REQUEST`, `MENTION_EXTERNAL`, `MENTION_INACTIVE`, `MENTION_UNKNOWN`, `TOO_MANY_MENTIONS`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ATTACHMENT_ALREADY_BOUND`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): The first request with this `Idempotency-Key` is still running (`IDEMPOTENT_REQUEST_PENDING`). Retry after `Retry-After` seconds.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/start`: Start a flow

Starts a flow from a published template. Send `roleAssignments`, giving each role (by its `key`, id or name) a person by `uniqueId`, `userId` or `email`, and optionally `name`, `dueAt` and `customFields` (`[{ key, value }]`, each field by its `key`; an id there is refused, naming the key). Returns the new flow, as `GET /v1/flows/{id}` returns it.

Some templates ask for values at the start: the `customFields` with `collectAtStart: true` on `GET /v1/templates/{id}` (`required: true` when the flow can't start without one). A required value left out returns `400 VALIDATION_ERROR`, naming the field.

**Who may hold a role** is the same rule as the incoming webhook and MCP `start_flow`. Someone already in your organization, by `userId` or `email`, is used. An email no one here has adds that person as an external user, or reactivates a deactivated one, when you may add external users (`external_users:write` for an organization key, Invite external users for a person); the answer lists them under `addedUsers`. Without that permission the request returns `403 INSUFFICIENT_SCOPE` and nobody is added. A role internal users fill (a flow manager or meeting host role) takes no one new: a new email there returns `400 ROLE_NEEDS_INTERNAL_USER`. A `uniqueId` or `userId` that is no one here returns `404 USER_NOT_FOUND`. A `uniqueId` returns `403 FEATURE_DISABLED` (`error.feature` is `userUniqueId`) when your organization's plan does not include unique IDs. If someone with an email the start was adding joins your organization while the flow is starting, it returns `409 START_PEOPLE_CHANGED` and nothing is started or added: send it again (the same `Idempotency-Key` is fine).

**An organization API key starts the flow as itself.** No person is the starter: `startedBy` is `{ "method": "api", "apiKey": { … } }`, and a role filled by the person who starts the flow stays empty. To seat a person in that role, name them in `roleAssignments`. A personal access token starts as its person.

**A role filled from the org chart is not set here.** Sending a person for it returns `400 ROLE_FILLED_FROM_ORG_CHART`. When neither a manager nor the template's fallback person can take the role, the flow doesn't start and the response is `422 ORG_CHART_NO_APPROVER`, with the reason.

**Every Custom action step needs an approved page.** A version with one that has none doesn't start: the response is `409 CUSTOM_ACTION_PAGE_NOT_APPROVED`, naming the step. Approve the page in the builder and publish again.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same flow and starts no second flow. See Idempotency in the Introduction.

**Products.** An organization without the Flow product can't start new flows: the response is `403 FEATURE_DISABLED` with `error.feature: "haiFlow"`. Flows already running carry on.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: StartFlowRequest

**Responses**

- `200` (object): The flow started, as `GET /v1/flows/{id}` returns it.
- `400` (ErrorResponse): Refused: `ROLE_FILLED_FROM_ORG_CHART`, `ROLE_NEEDS_INTERNAL_USER`, `VALIDATION_ERROR`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CUSTOM_ACTION_PAGE_NOT_APPROVED`, `START_PEOPLE_CHANGED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `422` (ErrorResponse): Refused: `ORG_CHART_NO_APPROVER`. The description says when; `error.code` says which.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/cancel`: Cancel a flow

Cancels a flow in progress. Its pending steps are dropped and its status becomes `CANCELLED`. The body is optional. Returns the cancelled flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The flow after the change, as `GET /v1/flows/{id}` returns it, so you don't need to read it again.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/archive`: Archive a flow

Hides the flow from the default list and keeps its data. Only a completed or cancelled flow can be archived: cancel a running one first (`POST /v1/flows/{id}/cancel`), or the response is `400 INVALID_STATE`. List archived flows with `GET /v1/flows?lifecycle=archived`. Returns the archived flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The flow after the change, as `GET /v1/flows/{id}` returns it, so you don't need to read it again.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/unarchive`: Unarchive a flow

Returns an archived flow to the default list. Returns the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The flow after the change, as `GET /v1/flows/{id}` returns it, so you don't need to read it again.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/chat-assistant`: Turn the AI assistant on or off in a flow

Turns the template's AI assistant on or off in this one running flow. Needs manage access to the flow, as in the app. Off stays off when the template's assistant is turned off and on again, and when someone turns it on in running flows. The template's own assistant still decides whether it answers at all, and which assistant answers. A finished flow returns `409 FLOW_NOT_RUNNING`. Read the switch as `chatAssistantEnabled` on `GET /v1/flows/{id}`. Turning it to the state it is already in changes nothing: the answer says `changed: false`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The flow's switch after the call.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_NOT_RUNNING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/building-blocks`: Add a building block to a running flow

**Acting as a flow manager.** Adds a published building block to a running flow. The block's steps are added in this save. A new role needs a person (`holderUserId`, a `usr_…` id from List users). An alias names a role of this flow by id. A block that is not published is refused.

The answer names this insert (`data.insertId`) and the steps it added (`data.stepIds`). Undo uses `insertId`.

**Idempotent.** Send an `Idempotency-Key` header. A retry within 10 minutes returns the same insert and adds nothing again. The key belongs to this flow: the same key on another flow adds that flow's own block.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: InsertBuildingBlockRequest

**Responses**

- `200` (object): The insert that was added.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/pause`: Pause a flow

**Acting as a flow manager.** Stops a running flow until someone resumes it. Nothing moves while it is paused: no step completes, reminders and timers wait, and what arrives from connected apps is kept and applied when the flow resumes. `reason` is required; everyone who opens the flow sees it.

A flow that is not running (finished or canceled) returns `400 INVALID_STATE`. A flow that is already paused returns `409 ALREADY_PAUSED` with `error.pauseEpisodeId`. Returns 403 if you don't manage the flow.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns `{ success: true }` again instead of `409 ALREADY_PAUSED`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: PauseFlowRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_PAUSED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/resume`: Resume a flow

**Acting as a flow manager.** Starts a paused flow again. Timers and reminders pick up where they stopped, and what arrived from connected apps while it was paused is applied now. No body.

A flow that is not paused returns `409 NOT_PAUSED`. Returns 403 if you don't manage the flow.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns `{ success: true }` again instead of `409 NOT_PAUSED`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `NOT_PAUSED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/flows/{id}/monitors`: List a flow's flow monitors

**Acting as a flow manager.** The monitors on this flow: waiting, fired, failed, or turned off. Empty when flow monitors are off for the organization. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The flow's monitors.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/monitors/{monitorId}/turn-off`: Turn off a flow monitor

**Acting as a flow manager.** Turns this monitor off for this flow only. It cannot be turned back on. A monitor that already fired returns `409 ALREADY_FIRED`. One that is not waiting returns `400`. Flow monitors off for the organization returns `403 FEATURE_DISABLED`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `monitorId` (path, required, string)

**Responses**

- `200` (object): The monitor is off for this flow.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_FIRED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/roles/{roleId}/assign`: Assign a role

Gives a role on the flow to a user. The `roleId` comes from `roles[]` on `GET /v1/flows/{id}`, which lists every role on the template, including unassigned ones. Name the person with exactly one of `uniqueId`, `userId` or `email`. They replace whoever held the role, and are notified. Naming the person who already holds it changes nothing: the answer says `changed: false`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `roleId` (path, required, string)

**Request body**

- `application/json`: AssignRoleRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/members`: Add a member

Adds a user to the flow. Name the user with exactly one of `uniqueId`, `userId` or `email`. The body decides what access they get:

- `{userId}`: viewer (read-only)
- `{userId, roles:[...]}`: participant in those roles (they do the assigned work)
- `{userId, access:"manager"}`: flow manager (full control)

`role` is accepted as another name for `access`.

Adds one member per call. If the user is already on the flow, the request returns 409: remove them first with `/members/remove`, then add them back with the new access.

**The person must already be a user in your organization.** An `email` that matches nobody returns `USER_NOT_FOUND` instead of inviting anyone. Create new people with `POST /v1/users` first.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same response, without adding the member twice or sending notifications again.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: AddMemberRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied to the resource as it is now. `error.code` says why.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/members/remove`: Remove a member

Removes a user from the flow in one call: their flow manager or viewer access and every role they hold. Name the user with exactly one of `uniqueId`, `userId` or `email`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: RemoveMemberRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/summary`: Get the AI summary of a flow

Returns an AI-written summary of the flow. For a completed flow, it covers the outcome, key decisions and timeline. For a flow in progress, it says what is done, what is blocked and what comes next. For a canceled flow, or one that ended another way, `data` is `null`. When the AI can't write the summary, the call returns `503 AI_UNAVAILABLE` with `Retry-After`: try again.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The summary.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The AI could not answer just now (`AI_UNAVAILABLE`), and nothing was saved. Usually `error.retryable` is `true`: try again after the number of seconds in `Retry-After`. When `error.retryable` is `false` (there is no `Retry-After`), a retry will not help until the AI account is fixed on the Moxo side: contact support with the `requestId`.

### `GET /v1/flows/{id}/audit-log`: Get flow audit trail

Returns what happened on the flow, newest first: who did what, and when. By default this is the flow's activity, as Moxo shows it: steps started and finished, decisions, files, notes, and every change a person made to the running flow (adding, editing, moving or removing a step, pausing and resuming, giving a step to someone, adding a member, changing who holds a role, the flow's settings), each naming what changed. The structural changes reach the flow's managers only; everyone on the flow reads pauses and resumes. Work the system does on its own, such as filling a role when the flow starts, is not on it.

**The full record.** `surface=audit` returns every recorded event instead, the system's own work included (opening links, notifications, reminders, the engine's bookkeeping). Only the flow's managers can read it (`403` otherwise).

Page with `cursor`: pass `nextCursor` back until it is `null`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)
- `surface` (query, string): `activity` (default): the flow's activity, as Moxo shows it. `audit`: every recorded event, for the flow's managers.
- `stepExecutionId` (query, string): Only what happened on this step run (`steps[].id`).
- `limit` (query, integer): Entries per page, 1 to 200. Default 50.
- `cursor` (query, string): The `nextCursor` of the previous page.

**Responses**

- `200` (object): The audit entries.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/bulk-remind`: Send bulk reminders

Reminds everyone each flow is waiting on, as **Remind** does on the flows list in the app: every person assigned to a step that is open now, whether or not it is overdue. Up to 50 flows per call; you need to be able to manage each flow.

There is no overdue-only mode, as there is none in the app. To remind only the flows that are late, list them first with `GET /v1/flows?health=overdue` and send those ids.

`results` answers each id, in the order you sent them: `reminded` (with how many steps), `not_found` (no such flow in your organization, or one you can't see), `no_access` (you can see it but can't manage it, whatever its state), `finished` or `paused` (nothing is waiting), `held` (an action reminded in the last 24 hours; this hold applies to a person signed in to the app, not to a token, and `availableAt` says when), `nothing_to_remind` (open, but no one to remind now) or `failed`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Request body**

- `application/json`: object

**Responses**

- `200` (object): What happened to each flow.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{templateId}/flows/bulk`: Bulk start flows

Starts many flows from one template in one background job, one flow per recipient. Use `bulkRoleId` and `recipients[]` to give one role to many people, each in their own flow, and `sharedRoleAssignments` for roles that are the same in every flow. Returns a `jobId`; poll `GET /v1/bulk-start-jobs/{jobId}` for progress.

As for a single start, permission comes first: a caller who may not run the template gets `403`. A draft or archived template, or one with no steps, returns `400 INVALID_STATE`. A person listed more than once (the same `userId`, the same email in any letter case, or a `userId` and the email of that same person) returns `400 VALIDATION_FAILED` naming them, and nothing starts: each recipient gets one flow.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same job id and starts no second job. See Idempotency in the Introduction.

**Products.** An organization without the Flow product can't start new flows: the response is `403 FEATURE_DISABLED` with `error.feature: "haiFlow"`. Flows already running carry on.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `templateId` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: BulkStartFlowsRequest

**Responses**

- `202` (object): The job was accepted and runs in the background. Poll `GET /v1/bulk-start-jobs/{jobId}` until it finishes.
- `400` (ErrorResponse): Refused: `INVALID_STATE`, `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/bulk-start-jobs/{jobId}`: Get a bulk start job

Returns the progress and results of a bulk start job: what succeeded, what failed and which flows were started.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `jobId` (path, required, string)

**Responses**

- `200` (object): The job.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/export`: Export a flow as a ZIP file

Downloads the flow's data and attachments as a ZIP file, for records, compliance or moving them to another system. The file holds the flow's activity log, so it needs the permission to see the audit trail (`audit:read` for an organization API key) and to manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read` and `audit:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200`: The ZIP file.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{flowId}/files`: List files in a flow

Lists every file you can see in this flow: what people uploaded, what steps produced and files attached in chat. Files on steps you can't see are left out, as are files whose safety check hasn't passed. To download a file a step produced, call `GET /v1/flows/{flowId}/steps/{stepId}/files/{fileId}`. Its `downloadUrl` works for one hour; ask for a new one after that.

Each file says where it came from. `stepId` and `stepName` name the step that produced it, and `fileRole` is `signed` or `certificate` when that step recorded the file as its signed document or signing certificate. `fileRole` comes from what the step recorded, never from the file name.

**Reference files.** Documents that steps show without producing them, such as the document an e-sign step asks people to sign and files attached to a step, are a separate view. Send `folderId=__attachments__` to get them, for example `GET /v1/flows/{flowId}/files?folderId=__attachments__`. `__attachments__` selects that view; it is not a real folder. Each file appears once in that view, and `references` lists every step that shows it. Without `folderId`, `references` is always an empty array.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `flowId` (path, required, string)
- `folderId` (query, string): Send `__attachments__` to list the files steps show as reference material, instead of the flow's own files. Any other value is ignored; the list isn't filtered by folder.

**Responses**

- `200` (object): The files.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/restore`: Reopen a canceled flow

**Acting as a flow manager.** Undoes a cancel: the flow is running again and each step the cancel stopped goes back to where it was. Steps finished before the cancel stay finished. The body is optional. Returns the flow.

Only a flow canceled by a person can be reopened: a flow that is not canceled returns `400 INVALID_STATE`, and one canceled before reopening existed, or ended by an End flow step, returns `409 NO_RESTORE_SNAPSHOT` (start a new flow instead). An archived flow returns `409 FLOW_ARCHIVED` (unarchive it first), and a paused organization `402 ORG_FROZEN`. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The flow after the change, so you don't need to read it again.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): Refused: `ORG_FROZEN`. The description says when; `error.code` says which.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_ARCHIVED`, `NO_RESTORE_SNAPSHOT`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/continue`: Continue a completed flow

**Acting as a flow manager.** Opens a completed flow again so more work can be added to it: it is running again, and every finished step stays finished. Add the next steps with `POST /v1/flows/{id}/steps`. The body is optional. Returns the flow.

A flow that is not completed returns `400 INVALID_STATE`, a test run `400 IS_TEST_RUN` (start a new one), a one-off action (`kind: "action"`) `409 ACTION_ENDED` (send it to someone else instead), an archived flow `409 FLOW_ARCHIVED` (unarchive it first) and a paused organization `402 ORG_FROZEN`. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The flow after the change, so you don't need to read it again.
- `400` (ErrorResponse): Refused: `INVALID_STATE`, `IS_TEST_RUN`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): Refused: `ORG_FROZEN`. The description says when; `error.code` says which.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACTION_ENDED`, `FLOW_ARCHIVED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/mark-goal-met`: Mark an adaptive flow's goal met

**Acting as a flow manager.** Completes an adaptive flow: an adaptive flow never completes on its own when its steps run out, so this is how it ends. Every step still open is closed as no longer needed, and the flow's managers get the usual completion summary. The body is optional. Returns the flow. Calling it on a flow already completed changes nothing.

A flow started from a template with fixed steps returns `400 INVALID_STATE` (it completes when its steps are done), and so does a canceled flow. A paused flow returns `409 FLOW_PAUSED`: resume it first. While any sub-flow beneath the flow, at any depth, is still running or paused, it returns `409 SUB_FLOWS_OPEN` and nothing changes: finish or cancel them first. `error.details.subFlows` lists each one with its `templateName`, and its `id` and `name` when you can open it and every sub-flow above it (else `null`); a sub-flow you can't open stands for everything beneath it. Closing a step that reviews your own work returns `403 OWN_REVIEW`. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The flow after the change, so you don't need to read it again.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `SUB_FLOWS_OPEN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/adaptive`: Start an adaptive flow

Starts an empty adaptive flow toward a `goal`, with no template: you are its manager, and you add its steps as it runs (`POST /v1/flows/{id}/steps`). It stays open until you mark its goal met (`POST /v1/flows/{id}/mark-goal-met`). Returns the new flow.

Needs a teammate's personal access token, and the organization's plan to have adaptive flows (`403 FEATURE_DISABLED` otherwise). A paused organization returns `402 ORG_FROZEN`, and a plan out of flows `402 QUOTA_EXCEEDED`.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same flow and starts no second flow. See Idempotency in the Introduction.

**Products.** An organization without the Flow product can't start new flows: the response is `403 FEATURE_DISABLED` with `error.feature: "haiFlow"`. Flows already running carry on.

**Tokens:** personal access token

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The new flow, or the first one when this is a retry with the same `Idempotency-Key`.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): Refused: `ORG_FROZEN`, `QUOTA_EXCEEDED`. The description says when; `error.code` says which.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/roles`: Add a role to a flow

**Acting as a flow manager.** Adds a role to this running flow only (the template keeps its roles). Put someone on it now with `userId` or `contactId`, or later with `POST /v1/flows/{id}/roles/{roleId}/assign`. A name another role of the flow has returns `409 ROLE_ALREADY_EXISTS`; a flow that is not running returns `400 INVALID_STATE`. Returns the new role and its id.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The role added.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ROLE_ALREADY_EXISTS`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/roles/{roleId}/accounts`: Put an account on a role

**Acting as a flow manager.** Puts an account on one of this flow's roles. For an account whose people follow it, its people join the role. The account must be one the role takes, as at the start of a flow. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `roleId` (path, required, string): The role's id, from `roles[].id` on `GET /v1/flows/{id}`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The change was made.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{id}/roles/{roleId}/accounts/{accountId}`: Take an account off a role

**Acting as a flow manager.** Takes an account off one of this flow's roles. For an account whose people follow it, the people it brought leave the role too, unless another account on the role brought them; their open steps wait for a manager to reassign them, and their finished work keeps their name. Someone who can't leave yet (a signer on a document already sent) refuses the whole change. A canceled flow returns `403 FLOW_CANCELLED`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `roleId` (path, required, string): The role's id, from `roles[].id` on `GET /v1/flows/{id}`.
- `accountId` (path, required, string): The account's id.

**Responses**

- `200` (object): The change was made.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/roles/{roleId}/visibility`: Change what a role sees in a flow

**Acting as a flow manager.** Changes what people in one role see on this running flow only (the template keeps its setting). Send any of the three switches; the others stay. Showing more to a role that includes people outside your organization shows them more of the flow. A role that always sees everything returns `400 ROLE_VISIBILITY_LOCKED`; automations without every action `400 AUTOMATIONS_REQUIRE_SEE_ALL`; progress only for a managing role `400 PROGRESS_ONLY_REQUIRES_VIEWER`, or without every action `400 PROGRESS_ONLY_REQUIRES_SEE_ALL`; `holderUserId` who no longer holds the role `409 ROLE_NOT_HELD`. A flow that is not running returns `400 INVALID_STATE`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `roleId` (path, required, string): The role's id, from `roles[].id` on `GET /v1/flows/{id}`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The change was made.
- `400` (ErrorResponse): Refused: `AUTOMATIONS_REQUIRE_SEE_ALL`, `INVALID_STATE`, `PROGRESS_ONLY_REQUIRES_SEE_ALL`, `PROGRESS_ONLY_REQUIRES_VIEWER`, `ROLE_VISIBILITY_LOCKED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ROLE_NOT_HELD`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/roles/{roleId}/extra-permissions`: Change a role's powers in a flow

**Acting as a flow manager.** Sets the extra powers people in one Assignee role have on this running flow only: send every power they should have. A power the organization's plan doesn't include returns `403 FEATURE_DISABLED`; a role that manages or only views the flow `400 ROLE_NOT_ASSIGNEE`; a flow that is not running `400 INVALID_STATE`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `roleId` (path, required, string): The role's id, from `roles[].id` on `GET /v1/flows/{id}`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The change was made.
- `400` (ErrorResponse): Refused: `INVALID_STATE`, `ROLE_NOT_ASSIGNEE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/participants/{userId}/view`: Change how one person sees a flow

**Acting as a flow manager.** Sets how one person on this running flow sees it. Only this flow and this person change. A flow that is not running returns `400 INVALID_STATE`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `userId` (path, required, string): The person's id (`usr_…`).

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The change was made.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/flows/{id}/tags/{groupId}`: Set a flow's tags in one group

**Acting as a flow manager.** Sets the flow's tags in one tag group, whatever its state, so a flow can be filed again after it ends. Other groups stay as they are. Send `tagIds` for a group of tags, or `value` for a text group. Needs the organization's plan to have tags (`403 FEATURE_DISABLED` otherwise), and a teammate's personal access token: tags are filed by a person (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `groupId` (path, required, string): The tag group's id.

**Request body**

- `application/json`: object or object

**Responses**

- `200` (object): The change was made.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/access-requests`: List requests to join a flow

**Acting as a flow manager.** Lists the open requests to join the flow, oldest first. People in your organization ask to join from the flow's link when its template lets them. A request from someone who left the organization is not listed. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string): The flow's id.

**Responses**

- `200` (object): The open requests.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/access-requests/{requestId}/approve`: Approve a request to join a flow

**Acting as a flow manager.** Adds the person who asked to the flow as a viewer and tells them, the same as `POST /v1/flows/{id}/members` with `access: "viewer"`. Takes no body.

A request someone already approved or declined returns `409 ACCESS_REQUEST_ALREADY_DECIDED`. When the person can't be a viewer of this flow, the call returns the same refusal as adding them, and the request stays open. Returns 403 if you don't manage the flow, and 404 if the request doesn't exist on this flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `requestId` (path, required, string): The request's id, from `requests[].id` on `GET /v1/flows/{id}/access-requests`.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Responses**

- `200` (object): The request was answered.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACCESS_REQUEST_ALREADY_DECIDED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/access-requests/{requestId}/deny`: Decline a request to join a flow

**Acting as a flow manager.** Declines the request. Nobody is told. The person can ask again after 24 hours. Takes no body.

A request someone already approved or declined returns `409 ACCESS_REQUEST_ALREADY_DECIDED`. Returns 403 if you don't manage the flow, and 404 if the request doesn't exist on this flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `requestId` (path, required, string): The request's id, from `requests[].id` on `GET /v1/flows/{id}/access-requests`.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Responses**

- `200` (object): The request was answered.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACCESS_REQUEST_ALREADY_DECIDED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `PATCH /v1/flows/{id}/messages/{messageId}`: Edit a flow chat message

Changes the text of a message you wrote. Someone else's message returns `403 MESSAGE_EDIT_FORBIDDEN`, and a deleted one `410 MESSAGE_DELETED`. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). When the template turns comments off, it returns `403 COMMENTS_DISABLED`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `messageId` (path, required, string): The message's id, from `GET /v1/flows/{id}/messages`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The message after the change, as `GET /v1/flows/{id}/messages` returns it.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): Refused: `MESSAGE_DELETED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{id}/messages/{messageId}`: Delete a flow chat message

Deletes a message you wrote, as the app does: the thread shows that a message was deleted. Someone else's message returns `403 MESSAGE_DELETE_FORBIDDEN`. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). When the template turns comments off, it returns `403 COMMENTS_DISABLED`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `messageId` (path, required, string): The message's id, from `GET /v1/flows/{id}/messages`.

**Responses**

- `204`: The message is deleted.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/messages/{messageId}/resolve`: Resolve a flow chat thread

Marks a thread resolved, or opens it again. Works when comments are off too, so open threads can be closed out. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `messageId` (path, required, string): The message's id, from `GET /v1/flows/{id}/messages`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The message after the change, as `GET /v1/flows/{id}/messages` returns it.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/messages/{messageId}/pin`: Pin a flow chat message

Pins a message, for everyone who can see it. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). When the template turns comments off, it returns `403 COMMENTS_DISABLED`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `messageId` (path, required, string): The message's id, from `GET /v1/flows/{id}/messages`.

**Responses**

- `200` (object): The message's pin.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{id}/messages/{messageId}/pin`: Unpin a flow chat message

Takes a message's pin away. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `messageId` (path, required, string): The message's id, from `GET /v1/flows/{id}/messages`.

**Responses**

- `200` (object): The message's pin.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/messages/{messageId}/reactions`: React to a flow chat message

Adds your reaction with one emoji, or takes it away when you already reacted with it. Anything but a single emoji returns `400`. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `messageId` (path, required, string): The message's id, from `GET /v1/flows/{id}/messages`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Your reaction now, and how many people react with that emoji.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/messages/upload-init`: Get an upload link for a chat file

Returns a signed upload link for one file to send with a message. `PUT` the bytes to `uploadUrl` with every header in `requiredHeaders`; when `completionUrl` is present, `POST` to it after the `PUT`. Then send the `fileId` in `attachmentFileIds` on `POST /v1/flows/{id}/messages`. The file is scanned for viruses after the upload, and counts toward your organization's storage (`402` when it is full). You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). When the template turns comments off, it returns `403 COMMENTS_DISABLED`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The upload link. Send its `fileId` in `attachmentFileIds` on `POST /v1/flows/{id}/messages` after the upload.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): The organization's plan or quota does not allow this now.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/messages/from-project`: Copy project files for a chat message

Copies files of the flow's project, ready to send with a message: send each copy's `fileId` in `attachmentFileIds` on `POST /v1/flows/{id}/messages`. Only a team member on the project can copy its files, and only the current version of each. More than 10 files returns `400 TOO_MANY_ATTACHMENTS`. You act as the person the token belongs to, with the reach they have in the app: participate access to the flow, and only messages they can see (a message on a step they can't see is `404`). The flow must not be canceled (`403 FLOW_CANCELLED`). When the template turns comments off, it returns `403 COMMENTS_DISABLED`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The copies, ready to send.
- `400` (ErrorResponse): Refused: `TOO_MANY_ATTACHMENTS`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/notes`: List a flow's notes

Returns the flow's notes, newest first: the ones written in Notes and the ones people left when they submitted or sent back a step. You see the notes the person the token belongs to sees in the app: a note on a step they can't see is left out, and the template decides who reads Notes at all (`403 FORBIDDEN`). An organization API key reads them as a flow manager does. Notes must be on for your organization and for the flow's template (`404 NOTES_DISABLED`).

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string): The flow's id.
- `cursor` (query, string): The previous page's `nextCursor`. Leave it out for the first page.
- `limit` (query, integer): How many notes to return, up to 100. Defaults to 50.
- `stepId` (query, string): Only the notes on this step.

**Responses**

- `200` (object): A page of notes.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/notes`: Write a flow note

Adds a note to the flow, or to one of its steps, as the person the token belongs to. Everyone who reads the flow's notes sees it. The template decides who may write one (`403 FORBIDDEN`), and a canceled flow takes none (`403 FLOW_CANCELLED`). Notes must be on for your organization and for the flow's template (`404 NOTES_DISABLED`). Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The note.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepExecId}/doc-collab`: Get a step's document collaboration

Returns the document collaboration on a step as the app shows it to the person the token belongs to: whose turn it is, the versions and their documents, their side's draft, the held copies, the sections, and what they may do now (`permissions`). Another side's draft is never in it. A step that is not a document collaboration, or one they can't see, returns `404`. Needs a personal access token: the page is a person's own (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Responses**

- `200` (object): The collaboration as the app shows it to you.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/upload-init`: Get an upload link for a collaboration document

Gets a link to upload a file into this step: the first half of putting a new document in your side's draft, preparing version 1, or a manager's upload for a side. Only a person on a side, a flow manager, or the person preparing version 1 may upload (`403 READ_ONLY`). A file type the collaboration doesn't take returns `422 DOC_COLLAB_FILE_TYPE_NOT_ACCEPTED`. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The upload link. Name its `fileId` in `POST …/doc-collab/draft-documents`, `PUT …/doc-collab/prepare-documents` or `POST …/doc-collab/manager-upload` after the upload.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `DOC_COLLAB_FILE_TYPE_NOT_ACCEPTED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/draft-documents`: Put a document in your side's draft

Puts a file you uploaded (`POST …/doc-collab/upload-init`) into your side's draft as one of the package's documents, starting the draft when there is none. Only your own upload into this step can be used (`404 FILE_REJECTED`), and not a file that failed the virus check (`422 FILE_REJECTED`); `error.fileCode` says why. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `FILE_REJECTED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/documents/{key}/open-draft`: Start your side's draft of a document written in Moxo

Starts your side's draft of a document written in Moxo, from the current version, so your side can change it before sending. Answers the page with the draft's parts. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `key` (path, required, string): The document's `key`, from the page's `documents[]`.

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/suggestions`: Suggest an edit on a PDF

Adds a suggested edit to a passage of a PDF in the current version (strike it through, replace it, or insert text after it), in your side's draft: the other side reads it when your side sends. The passage names its page and boxes; the words are read from the PDF. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/suggestions/{suggestionId}/remove`: Remove a suggested edit

Takes a suggested edit out of your side's draft. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `suggestionId` (path, required, string): The suggestion's id, from the page.

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/discard-draft`: Discard your side's draft

Drops your side's draft and everything in it. It can't be put back. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/go-ahead`: Give the go-ahead on your side's draft

Says the draft you read is ready to send, for a side whose rule needs more than one person's go-ahead. Name the draft as the page showed it (`myDraft.id` and `myDraft.rev`): a draft that changed since returns `409 DRAFT_CHANGED` with its revision now. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `DRAFT_CHANGED`, `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/send`: Send your side's draft as a new version

Sends your side's draft as the next version, with a note to the other side, and passes the turn. Name what the page showed: the version number (`versionNumber`), the draft (`myDraft.id`, `myDraft.rev`) and each part's revision of a document written in Moxo. A version that moved returns `409 ALREADY_SENT`, and a draft that changed `409 DRAFT_CHANGED`; your side keeps its draft. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_SENT`, `DRAFT_CHANGED`, `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/approve`: Approve the current version

Approves the current version for your side. When every side has approved it, the documents are agreed and the step completes. Name the version the page showed (`versionNumber`): one that moved returns `409 ALREADY_SENT`. With suggested edits open on it, say how many you approve without (`withoutSuggestionCount`), or it returns `409 SUGGESTIONS_OPEN` with the count. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_SENT`, `FLOW_PAUSED`, `NOT_YOUR_TURN`, `SUGGESTIONS_OPEN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/approve-content`: Approve the text written together

Approves the documents written together, as the page showed them: the package's revision (`contentRevision`) and each part's. Text someone saved since returns `409 CONTENT_MOVED`. When enough people have approved, the step completes. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONTENT_MOVED`, `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/sections/{sectionId}/done`: Mark a section done

Marks a section done: one your role owns, any section as an editor, or, as a flow manager, a section nobody is on. Anyone else returns `403 NOT_YOUR_SECTION`. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `sectionId` (path, required, string): The section's `sectionId`, from the page's `sections[]`.

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/sections/{sectionId}/reopen`: Reopen a section

Opens a section marked done for writing again. Someone who may not returns `403 NOT_YOUR_SECTION`. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `sectionId` (path, required, string): The section's `sectionId`, from the page's `sections[]`.

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/steps/{stepExecId}/doc-collab/sections/{sectionId}`: Rename a section

Changes a section's heading. Only an editor may (`403 NOT_AN_EDITOR`). You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `sectionId` (path, required, string): The section's `sectionId`, from the page's `sections[]`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/ask-for-approval`: Ask for approval of the text

Ends the writing of the sections and asks everyone to approve the text. Only an editor may, or a flow manager when no editor is on the step (`403 NOT_AN_EDITOR`). You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/held/{heldItemId}/resolve`: Settle a held upload

Settles a late upload or an emailed reply that was held: `applied` once you have used it, or `dismissed`. Only its side, or a manager, may. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `heldItemId` (path, required, string): The held copy's `id`, from the page's `heldItems[]`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/held/{heldItemId}/combine`: Combine a held copy into the draft

Combines a held copy into your side's draft, with a choice for each passage both changed. Name the draft's revision the page showed: a draft that moved returns `409 DRAFT_CHANGED`, and passages that changed since `409 CONFLICTS_CHANGED` with the list now. A copy that can't be combined returns `422 NOT_COMBINABLE`. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `heldItemId` (path, required, string): The held copy's `id`, from the page's `heldItems[]`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONFLICTS_CHANGED`, `DRAFT_CHANGED`, `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `NOT_COMBINABLE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/held/{heldItemId}/use-instead`: Use a held copy instead of the draft

Makes a held copy your side's draft; the draft it replaces is kept aside as a held copy. Name the draft's revision the page showed (`409 DRAFT_CHANGED` when it moved). You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `heldItemId` (path, required, string): The held copy's `id`, from the page's `heldItems[]`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `DRAFT_CHANGED`, `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/flows/{id}/steps/{stepExecId}/doc-collab/prepare-documents`: Save the documents for version 1

Saves the documents the person preparing version 1 has so far (the whole list each time, each a file uploaded into this step) and the values typed for a Word template's placeholders. Only the person preparing it may. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/manager-upload`: Upload a version for a side

A flow manager sends a version for a side (the documents a side sent by email, say), with a note, as if that side had sent it. Name the version the page showed (`409 ALREADY_SENT` when it moved). Only a flow manager may. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_SENT`, `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/remind`: Remind the people who must act

A flow manager reminds everyone who must act now, or, for documents written in sections, one section's owners (`sectionId`). Nobody to remind returns `400 NOTHING_TO_REMIND`. Only a flow manager may. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`). Send an `Idempotency-Key` header to make retries safe: a retry answers the page as it stands.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The page after the act, as the app shows it to you, and what the act produced.
- `400` (ErrorResponse): Refused: `NOTHING_TO_REMIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepExecId}/doc-collab/parts/{partId}/comments`: List the comments on a part

Returns the comments on one part of a document written in Moxo, as the app shows them to the person the token belongs to: a part they can't read is `404`, and a comment kept to another side is left out. Needs a personal access token (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `partId` (path, required, string): The part's `partId`, from the page's `documents[].parts[]`.

**Responses**

- `200` (object): The part's comments you may read.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/parts/{partId}/comments`: Comment on a part

Adds a comment to a part of a document written in Moxo, on a passage (`textAnchor`) or the whole part, or a reply (`parentId`). It is shared with everyone who reads the part, or kept to your side (`audience: "side"`). People it names (`mentionedUserIds`, public ids) who can't read the part are dropped. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `partId` (path, required, string): The part's `partId`, from the page's `documents[].parts[]`.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The comment.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/doc-collab/parts/{partId}/comments/{commentId}/resolve`: Resolve a comment thread

Resolves a comment thread (`resolved: true`), or opens it again (`false`). You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `partId` (path, required, string): The part's `partId`, from the page's `documents[].parts[]`.
- `commentId` (path, required, string): The comment's `id`, from `GET …/parts/{partId}/comments`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The comment.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{id}/steps/{stepExecId}/doc-collab/parts/{partId}/comments/{commentId}`: Delete a comment

Deletes a comment you wrote; the first comment of a thread takes its replies with it. Someone else's returns `403 NOT_AUTHOR`. You act as the person the token belongs to, with what they may do in the app: a side's acts need a seat on that side (`403 NOT_ON_A_SIDE`) and, where it matters, their turn (`409 NOT_YOUR_TURN`); a read-only viewer acts on nothing (`403 READ_ONLY`); a step you can't see is `404`. A paused flow returns `409 FLOW_PAUSED`. Needs a personal access token: an organization API key has no person, side or turn to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The document collaboration step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `partId` (path, required, string): The part's `partId`, from the page's `documents[].parts[]`.
- `commentId` (path, required, string): The comment's `id`, from `GET …/parts/{partId}/comments`.

**Responses**

- `200` (object): The comment deleted.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `NOT_YOUR_TURN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepExecId}/prepared-document`: Get a Prepare document action's document

Returns the document a person is preparing on a running Prepare document action: the latest version, the earlier ones (newest first), whether someone has it open in Moxo's editor, what the signature check found, and the placeholders still to fill. Anyone who may see the step reads it: its assignees, the flow's managers and viewers. A step that is not a Prepare document action prepared by a person, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: the document is read as a person sees it (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Responses**

- `200` (object): The document and its versions, or `notStarted` before the action is the assignee's.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepExecId}/prepared-document/versions/{versionId}/download`: Download a version of a document being prepared

Returns a version's Word file (.docx) as an attachment. Downloading the latest version marks it as your copy: an upload of an older copy then asks first (`OLDER_COPY`). Anyone who may see the step reads it: its assignees, the flow's managers and viewers. A step that is not a Prepare document action prepared by a person, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: the document is read as a person sees it (`403 PERSON_TOKEN_REQUIRED` for an organization API key).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `versionId` (path, required, string): The version's `id`, from `latest` or `earlier` in `GET …/prepared-document`.

**Responses**

- `200` (string): The Word file.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/versions`: Upload an edited copy of a document being prepared

Uploads an edited Word copy as the document's latest version, as Upload your edited copy does on the action's card. Send `multipart/form-data` with the file in a field named `file`, or, after uploading it through `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/upload-init`, JSON naming its `fileId` (`404 FILE_NOT_FOUND` for an upload that isn't yours or isn't in this step, `425 SCAN_PENDING` while its virus check runs). A copy downloaded before newer changes answers `ok: false` with `OLDER_COPY` and keeps nothing; send it again with `confirmOlderCopy=true` to replace those changes. A file that is not a Word document answers `ok: false` with `NOT_WORD`. The same document as the latest version adds no version. Only the assignee whose turn it is changes the document (`403 NOT_YOUR_TURN`); while someone has it open in Moxo's editor it can't be changed (`409 LOCKED`). A step that is not a Prepare document action prepared by a person, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`). `FILE_TOO_LARGE` (413) above 25 MB. `FILE_INFECTED` (422) when the file fails its virus check. `SCAN_UNAVAILABLE` (503) when the check can't run.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `multipart/form-data`: object
- `application/json`: object

**Responses**

- `200` (object): What happened to the upload.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `LOCKED`. The description says when; `error.code` says which.
- `413` (ErrorResponse): The file is larger than 25 MB (`FILE_TOO_LARGE`).
- `422` (ErrorResponse): Refused: `FILE_INFECTED`. The description says when; `error.code` says which.
- `425` (ErrorResponse): Refused: `SCAN_PENDING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Temporarily unavailable. Retry after `Retry-After` seconds.

### `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/versions/{versionId}/restore`: Restore an earlier version of a document being prepared

Makes an earlier version the latest again, as a new `restored` version (nothing is deleted). Restoring the version that already is the latest changes nothing. Only the assignee whose turn it is changes the document (`403 NOT_YOUR_TURN`); while someone has it open in Moxo's editor it can't be changed (`409 LOCKED`). A step that is not a Prepare document action prepared by a person, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `versionId` (path, required, string): The version's `id`, from `latest` or `earlier` in `GET …/prepared-document`.

**Responses**

- `200` (object): The document after the restore.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `LOCKED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/suggestions/{suggestionId}/accept`: Accept an AI suggestion on a document being prepared

Makes the suggested change as a new latest version, as Accept does on the action's card. The change is your own edit: the Word file never says AI. Send an empty body. Answers `ok: false` with `EDITING` while the document is open in Moxo's editor, `STALE` when the text it applies to is gone, and `DECIDED` when it was already accepted or dismissed. `409 NOT_A_CHANGE` for a comment (dismiss it instead). `409 CANT_APPLY` when Moxo can't make the change there, such as inside the signature block. `409 SUBMITTING` while the document is being submitted. Only the assignee whose turn it is changes the document (`403 NOT_YOUR_TURN`); while someone has it open in Moxo's editor it can't be changed (`409 LOCKED`). A step that is not a Prepare document action prepared by a person, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `suggestionId` (path, required, string): The suggestion's `id`, from `suggestions` in `GET …/prepared-document`.

**Responses**

- `200` (object): What happened to the suggestion.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CANT_APPLY`, `LOCKED`, `NOT_A_CHANGE`, `SUBMITTING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/suggestions/{suggestionId}/dismiss`: Dismiss an AI suggestion on a document being prepared

Sets the suggestion aside without changing the document, as Dismiss does on the action's card. Send an empty body. Answers `ok: false` with `DECIDED` when it was already accepted or dismissed. Only the assignee whose turn it is decides it (`403 NOT_YOUR_TURN`). A step that is not a Prepare document action prepared by a person, a suggestion that isn't on it, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.
- `suggestionId` (path, required, string): The suggestion's `id`, from `suggestions` in `GET …/prepared-document`.

**Responses**

- `200` (object): What happened to the suggestion.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/upload-init`: Get a link to upload an edited copy of a document being prepared

Gets a link to upload an edited Word copy into this step: the first half of uploading it without sending the file in the call. `PUT` the file to the link, then send its `fileId` to `POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/versions`. Only a Word document (.docx) is taken (`415 UNSUPPORTED_FILE_TYPE`). Only the assignee whose turn it is changes the document (`403 NOT_YOUR_TURN`); while someone has it open in Moxo's editor it can't be changed (`409 LOCKED`). A step that is not a Prepare document action prepared by a person, or one you can't see, returns `404 NOT_FOUND`. Needs a personal access token: an organization API key has no person to act as (`403 ASSIGNEE_REQUIRED`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The flow's id.
- `stepExecId` (path, required, string): The Prepare document step's run: `steps[].id` from `GET /v1/flows/{id}`. It doesn't take a template step id.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The upload link. Name its `fileId` in `POST …/prepared-document/versions` after the upload.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `LOCKED`. The description says when; `error.code` says which.
- `415` (ErrorResponse): Refused: `UNSUPPORTED_FILE_TYPE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

## Steps

A step is one piece of work inside a flow; the app also calls it an action. This section covers everything you can do to a step: complete it, decline it, give it to someone else, give the assignee the material they need, or step in and move it along yourself.

## Who each endpoint is for

Every step has an **assignee**, the person whose turn it is, and every flow has **flow managers**, who run it. Calling one side's endpoint for the other is the most common mistake here, so the flow manager endpoints are labeled `(manager)`. The rest are the assignee's own actions, or work from either side.

- **Assignee**, doing their own work: `complete`, `decline`, `prepare-complete`, `review-approve`, `review-decline`, `resolve-output`, and uploading to `files`.
- **Flow manager**, acting on someone else's step: `attachments`, `reassign`, `remind`, `skip`, `reopen`, `retry`, `force-complete`.

Either side can read, download and delete a step's files, and `GET` the step itself.

Two things follow from that split:

- **Assignee endpoints need a personal access token.** An organization API key is not a person, so it can't record a person's work. Those endpoints return `403 ASSIGNEE_REQUIRED` to a key. Flow manager endpoints accept either token.
- **`complete` and `force-complete` record different things.** `complete` records that the work was done: by the assignee, or by a flow manager who holds no part in the step, which is recorded as done on the assignee's behalf (`completedOnBehalfOf` on the step, "on behalf of" in the audit log). `force-complete` records that a flow manager closed the step without its work, with a reason. The audit trail shows the difference.

**Naming a step.** `stepId` takes either the step's template id (`step-2`, which exists before the step starts and stays the same when it is reopened) or its execution id (one run of the step). Four endpoints are narrower, and each says so on its own `stepId`:

- `retry` takes an execution id only, because it names the run that failed. Its parameter is `{stepExecId}`.
- `resolve-output` takes an execution id only. A template step id returns `404`.
- `prepare-complete` takes a template id only. To name one run of a repeating step, add `?stepExecutionId=`.
- `GET` on a step finds top-level steps only, so a step that is only inside `steps[].paths[]` returns `404`.

When a step runs once for each item, several runs share one template id. What a template id then means depends on the endpoint, and each endpoint's `stepId` says which. In short: the flow manager actions take the run in progress and return `409 AMBIGUOUS_STEP` while several are open; the review actions take the run awaiting review and return `404` if there is none; `reopen` and `GET` on a step refuse as soon as the step has more than one run (`GET` lists the runs' ids); `prepare-complete` returns `400 EXECUTION_REQUIRED`; `reassign` takes the first run with that id. Naming the run by its execution id avoids the question wherever an execution id is accepted.

## Giving material vs. collecting work

Two endpoints move files in opposite directions:

- **`POST .../steps/{stepId}/files`**: the assignee **hands work in**. The file becomes part of their submission when the step is done, and until then only the person who uploaded it can see it. You act as the assignee.
- **`POST .../steps/{stepId}/attachments`**: you **hand material out**. The file appears as **Reference materials** on the step, and the assignee sees it **immediately**. You act as a flow manager.

**To show someone a document, use `attachments`.** A file uploaded through `files` belongs to a draft submission that only its uploader can see, so a file you upload for an assignee is one they never see. The call still returns `201`.

### Giving each run its own documents

A flow often needs documents that differ each time it runs: a contract, a statement, a personal letter. Attachments on the template can't do this, because they are the same for every run. Attach the documents when the flow starts instead:

```bash
# 1. Start the flow
POST /v1/templates/{templateId}/start {"roleAssignments":[{"roleId":"role-customer","email":"ana@example.com"}]} -> { "data": { "id": "flow_123" } }

# 2. Attach this run's document to the step that needs it.
#    The step doesn't need to have started.
POST /v1/flows/flow_123/steps/step-2/attachments
{ "kind": "file", "fileName": "agreement.pdf", "fileSize": 51200, "mimeType": "application/pdf" }

# 3. Upload the bytes, with requiredHeaders exactly as returned
PUT  {uploadUrl}

# 4. Only if the response included completionUrl:
POST {completionUrl}
```

By the time the client reaches step 2, the document is waiting for them.

> **Steps 3 and 4 are required.** The upload URL's signature covers `requiredHeaders`, so a `PUT` without them is refused. When the response includes `completionUrl`, calling it starts the file's safety check, and without that call nobody is shown the file. Both apply to `files` uploads too.

A web link works the same way, with no upload:

```json
{ "kind": "link", "url": "https://example.com/policy", "title": "Privacy policy" }
```

## Completing a step

The body of `POST /v1/flows/{id}/steps/{stepId}/complete` depends on the step type, and is always a JSON object: send `{}` when there is nothing to say. To see what a step expects, read it with `GET /v1/flows/{id}/steps/{stepId}` (`steps[].id` from `GET /v1/flows/{id}` names it): each type below says where its ids are. Each body below is sent to a real server in Moxo's automated tests.

Call `complete` as the person whose turn it is, with their personal access token, or as someone covering for them. A flow manager, the flow's owner or an admin who holds no part in the step can also complete it with `complete`: it is recorded as done by them on behalf of the step's assignee (`completedOnBehalfOf` on the step, and "on behalf of" in the audit log). To close a step without its work and show that it was forced, use `POST /v1/flows/{id}/steps/{stepId}/force-complete` with a `reason`.

### Form

Send each answer in `resultData`, keyed by the field's `fieldId`. `GET /v1/flows/{id}/steps/{stepId}` lists the fields in `formFields`, each with its `fieldId`, its type and, for a choice, the `value` of each option. A field's `key` or label in place of its id returns `400 VALIDATION_FAILED` naming the id to send. A table takes a list of rows, each cell keyed by its column's id, `key` or label; it is stored under the label. A column named twice in one row, or one the table doesn't have, returns `400 VALIDATION_FAILED` naming it.

```json
{
  "resultData": {
    "fld-company": "Acme",
    "fld-employees": 250
  }
}
```

### Questionnaire

Send each answer in `resultData`, keyed by the question's id. `GET /v1/flows/{id}/steps/{stepId}` lists the questions in `formFields`, each with its id as `fieldId` and, for a choice, the `value` of each option. A question's text in place of its id, or the answers wrapped in `{ "answers": { … } }`, returns `400 VALIDATION_FAILED` naming what to send.

```json
{
  "resultData": {
    "q-risk": "Moderate"
  }
}
```

### Poll

Send your vote in `resultData.answers`: for each question, a list with the option you chose (several when the question allows more than one). A question is named by its `questionId` and an option by its `value`: `GET /v1/flows/{id}/steps/{stepId}` lists them in `pollQuestions`, each question with its `questionId`, `allowMultiple`, `allowOther` and `options` (`value`, `label`). For an "Other" answer, send `"__other__"` and the text in `resultData.otherText`, keyed by the question. Send the step's `askedFingerprint` back beside `resultData`: when the poll changed since you read it, the vote is not recorded and the call returns `409 STEP_CHANGED`. Read the step again and vote on what it asks now.

```json
{
  "resultData": {
    "answers": {
      "q1": [
        "o1"
      ]
    }
  },
  "askedFingerprint": "af1-3b0c9e14a2d75f68"
}
```

A vote is recorded when you send it. The poll completes when everyone has voted, or earlier when the poll is set to close on a majority.

### Checklist

Send each item's status in `resultData.checklistState`, keyed by its `itemId`. `GET /v1/flows/{id}/steps/{stepId}` lists the items in `checklistItems`, each with its `itemId`, `label` and `status`. Every item must be `DONE` or `SKIPPED` (or one of the statuses the template allows, `config.checklist.completionStatuses`); otherwise the call returns `400 CHECKLIST_INCOMPLETE`. An item you leave out keeps the status it has.

```json
{
  "resultData": {
    "checklistState": {
      "item-documents": {
        "status": "DONE"
      },
      "item-signature": {
        "status": "SKIPPED"
      }
    }
  }
}
```

### Approval

To approve, send `"decision": "APPROVED"`. Without it the call returns `400 VALIDATION_FAILED`, and `error.details` says what to send. To send the step back for changes, or to reject it, call `decline`: see "Declining an approval" below.

```json
{
  "resultData": {
    "decision": "APPROVED"
  }
}
```

### Acknowledgement

Send an empty object. Completing the step is the acknowledgement. A call with no body at all returns `400 VALIDATION_FAILED`.

```json
{}
```

### File request

Upload each file with `POST /v1/flows/{id}/steps/{stepId}/files` (then `PUT` the bytes to `uploadUrl` with `requiredHeaders`, and call `completionUrl` when the response has one). Then complete the step with the `fileId`s you got back. With no file, the call returns `400 VALIDATION_ERROR`.

```json
{
  "resultData": {
    "files": [
      "file-statement"
    ]
  }
}
```

### Decision

Send the chosen option's `outcomeId` (its `key` returns `400 VALIDATION_FAILED` naming the id). A step's `outcomes` list its options as `{ outcomeId, key, label }`, on `GET /v1/flows/{id}/steps/{stepId}` and on each step of `GET /v1/flows/{id}`, including a decision added to a running flow.

```json
{
  "resultData": {
    "outcomeId": "o-approve"
  }
}
```

### To-do

Send an empty object when the task is done.

```json
{}
```

### PDF form

Send each answer in `resultData.fieldValues`, keyed by the PDF field's `fieldId`, as text. The fields are in the step's settings, `config.pdfForm.fields` (`GET /v1/flows/{id}/steps/{stepId}/settings`, for a flow manager), and in the template. A required field left out returns `400 VALIDATION_FAILED`. `fieldValues` must be inside `resultData`: at the top level it is not read as the PDF's answers.

```json
{
  "resultData": {
    "fieldValues": {
      "f-company": "Acme Holdings"
    }
  }
}
```

### Document review

Send an empty object when the review is done. Comments on the document are made in Moxo; completing the step makes the reviewed copy from them. If the reviewed copy can't be made, the call returns `500 REVIEWED_COPY_FAILED`: send it again.

```json
{}
```

### Prepare document

Send an empty object to submit the document as it stands. The assignee edits it first with the Prepare document calls: `GET /v1/flows/{id}/steps/{stepExecId}/prepared-document` reads the versions, `POST …/prepared-document/versions` uploads an edited Word copy, and `POST …/prepared-document/versions/{versionId}/restore` makes an earlier version the latest. Completing submits that latest version. The step records the PDF as `prepared_document` and the Word file as `prepared_document_word`. Anything sent in their place is ignored. With no file for the latest version, the call returns `409 PREPARED_DOCUMENT_MISSING`. A placeholder still written as `{{name}}` returns `422 UNFILLED_PLACEHOLDERS`, and `error.details.placeholders` names each one. While someone else has the document open in Moxo, it returns `409 EDITING_BY_OTHER`. While the latest changes are still saving, `409 STILL_SAVING`. While the PDF is still being made, `409 CHECK_PENDING`. When a later e-sign step's signature block is no longer in the document, `422 SIGNATURE_BLOCK`. If the PDF can't be made, `503 PDF_FAILED`: send it again. `force-complete` closes the step with the document as it stands and does not refuse for those checks. When no PDF can be made that way, the step completes with the Word file only and `preparedDocumentPdfMissing` on the result says why.

```json
{}
```

### Web app

Send an empty object when the work in the web app is done. Who may complete it is set on the step: one the web app finishes with its own call (`completionMode: "WEBHOOK"`) returns `409 COMPLETION_REQUIRES_WEBHOOK`, and one set for your team to confirm (`manualCompletedBy: "member"`) is completed by a person of your organization. For a page uploaded to Moxo, the answers are what the person entered on the page; anything sent with `complete` in their place is ignored.

```json
{}
```

### Declining an approval

Call `POST /v1/flows/{id}/steps/{stepId}/decline` with a `reason`, which the audit trail and the requester see. Call `decline` as an approver whose turn it is, with their personal access token: the decline is recorded on their seat. An approver may decline their own approval whether or not they manage the flow. A flow manager, the flow's owner or an admin who isn't one of the step's open approvers gets `410 NO_ACTIVE_SLOT`, and anyone else gets `403 FORBIDDEN`. What it does depends on the approval's `onReject` setting. By default (`approver_decides`, or `revise_and_resubmit`) it sends the step back for changes: the earlier steps it names reopen (`targetStepIds`, each an execution id from `steps[].id` or a template step id, when the approver picks them), and the approval asks again when they are done.

```json
{
  "reason": "The bank statement is missing."
}
```

When the approval's `onReject.action` is `end_flow` (the flow ends) or `rejection_steps` (the steps in `rejectBranch` run), a decline rejects. Send `"action": "reject"` to say so. Each approval offers only what its `onReject` allows: `reject` on an approval that sends back, or `request_changes` on one that rejects, returns `400 VALIDATION_ERROR`, and `error.details` names the `onReject` values that allow it. To make an approval rejectable, set `onReject` on the step when you build the template.

```json
{
  "reason": "Outside our lending policy.",
  "action": "reject"
}
```

### Steps finished another way

These steps finish when their own work is done, in Moxo or in the service they use, and the step records that work (a signature, a payment, a booking). Wait for them: completing one by hand records none of it. A flow manager can still close one early with `force-complete` and a `reason`, recorded as forced, unless that step's line says `force-complete` is refused.

- **Custom action.** Finished on its page in Moxo: each person answers on the page and sends their answers, which become the step's outputs. `complete` from someone who hasn't sent their answers returns `400 CUSTOM_ACTION_NOT_CONFIRMED`, and anything sent with `complete` in place of the answers is ignored. If a required answer is empty it returns `400 CUSTOM_ACTION_ANSWERS_MISSING`, and if the page changed after they answered, `409 CUSTOM_ACTION_PAGE_CHANGED`: they answer on the page again. While the page waits for the person preparing the step, `complete` returns `409 CUSTOM_ACTION_PAGE_WAITING`. `force-complete` closes the step without any answers.
- **E-signature.** Finished by signing: each signer signs from their task, and the step completes when the last one has. `complete` returns `409 ESIGN_SIGNATURE_REQUIRED`.
- **Document collaboration.** When the sides take turns or edit together, the step finishes when everyone agrees on the document. Each side acts with the document collaboration calls: approve the current version (`POST /v1/flows/{id}/steps/{stepId}/doc-collab/approve`, or `…/doc-collab/approve-content` for text written together) or send your draft as a new version (`…/doc-collab/send`). `complete` from someone on the step returns `409 DOC_COLLAB_USE_TURN_ACTIONS`. In Comment only, a reviewer marks the document reviewed with `complete`.
- **DocuSign.** Finished in DocuSign: the step completes when every signer has signed the envelope and DocuSign reports it.
- **Adobe Acrobat Sign.** Finished in Adobe Acrobat Sign: the step completes when every signer has signed and Adobe reports it.
- **Identity verification.** Finished by the verification service: the person verifies from their task, and the step completes with the service's result.
- **Collect payment.** Finished by the payment: the person pays from their task, and the step completes when the payment provider confirms it.
- **Jotform.** Finished in Jotform: the step completes when the person submits the form and Jotform sends the submission.
- **Time booking.** Finished by booking: the person picks a time from their task, and the step completes with the meeting.
- **Watch video.** Finished by watching: the person watches the video from their task, to the end when the step requires it, and confirms the sentence if the step asks for one. `complete` from someone who hasn't watched it returns `409 VIDEO_NOT_WATCHED`, and from someone who hasn't confirmed, `409 VIDEO_NOT_CONFIRMED`. `force-complete` is refused the same way: `409 VIDEO_NOT_WATCHED` while anyone still pending hasn't watched, and `409 VIDEO_NOT_CONFIRMED` while anyone hasn't confirmed.
- **Packet.** Finished on its own buttons: the person does the parts on the packet's pages in Moxo, and a button that finishes it (Submit, or an outcome of the template's own) completes the step with that outcome. `complete` returns `409 PACKET_FINISHES_ON_ITS_BUTTONS`. `force-complete` closes the packet with no outcome and closes every part left.
- **Goal.** Finished in its conversation: the step completes when the conversation has what the goal asks for and the person confirms it.

### Steps that run on their own

Automations (AI, email, webhook, data and API call steps), waits, AI agents and sub-flows finish on their own: `complete` refuses them with `409 STEP_RUNS_ON_ITS_OWN`. A flow manager can still close one early with `force-complete` and a `reason`, recorded as forced. It then ends with only the `resultData` you send, so a later step that reads its output gets nothing unless you send it. If one fails, `POST /v1/flows/{id}/steps/{stepId}/retry` runs it again.

## Which steps accept file uploads

`POST .../steps/{stepId}/files` adds a file to the assignee's submission, so it only matters on a step that collects one:

- **File request**: the upload is the submission. Pass the ids to `complete` as `resultData.files`.
- **Form**: the upload becomes a field's value. Send its id under the `FILE_UPLOAD` field's id when you complete the step; the upload alone does nothing.
- **E-sign, PDF form and Document review**: only while the step is being prepared, as the document to sign, fill in or review.
- **Any other step**: the upload is accepted but not used. Nobody is shown the file and no step refers to it. To give the assignee something to read, use `attachments`.

On any other step the call still returns `201`, so check the step type before you upload.

### `GET /v1/flows/{id}/steps/{stepId}`: Get step

Returns one step with its assignees, current state and result data, plus a `flow` block with context. `stepId` takes the execution id or the template step id of any step that has started, inside branches and paths too. A template step id with more than one run in the flow (the rounds of a For each, or a repeated step) returns `409 AMBIGUOUS_STEP` with the runs’ ids; send one of them.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A step that hasn't started (listed only inside `steps[].paths[]`) returns `404`. Its id still works as `afterStepId` on Add a step. A bare step id is accepted only while exactly one run has it; once a step has more than one run, it returns `409 AMBIGUOUS_STEP` with the runs' ids in `error.runIds`.

**Responses**

- `200` (object): The step.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `AMBIGUOUS_STEP`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flows/{id}/steps/{stepId}`: Edit a step (manager)

**Acting as a flow manager.** Changes a step that hasn't finished, including one that has started. Send any of `name`, `description`, `dueAt` or `stepDue`, `config` and `signers`. Before the step starts, you can also change who it is for: `assignee` gives it to one person (`null` gives it back to its roles), or `roleIds` gives it to roles. These are the changes the step editor in Moxo makes, with the same checks.

**Settings (`config`).** Read them first with Get step settings, then send only what changes, with the same keys. Moxo changes the settings of these step types on a running flow: to-dos, forms, questionnaires, file requests, checklists, web apps, custom actions, e-signatures, acknowledgements, decisions, approvals, polls and PDF forms until the person doing the step submits it; document reviews and document collaborations until the step starts (`editable` in Get step settings). What the step asks changes until the first answer (`locks.content.until`; `locks` says what is locked now and why). Another step type returns `400 STEP_SETTINGS_NOT_EDITABLE`, and a step past its window returns `400 STEP_NOT_EDITABLE`. The step's document changes with Replace a step's document (`POST /v1/flows/{id}/steps/{stepId}/document`): a different document in `config` returns `400 DOCUMENT_REPLACE_REQUIRED`. When the step starts (`skipSequentialOrder`, `dependsOnStepIds`) can't change once it has started (`409 EXECUTION_ORDER_STARTED`). The rules Moxo keeps on a running step apply: a decision keeps at least 2 options, an acknowledgement someone gave can't change (`400 ACK_ALREADY_ACKNOWLEDGED`), and an e-signature can't change once anyone has signed (`400 ESIGN_ALREADY_SIGNED`); before then, a change to its fields or signers sends the signers new links. Once someone has answered, what was asked is fixed: an approval someone decided (its description too), a poll someone voted in, a file request, checklist or to-do someone finished (`409 STEP_ALREADY_ANSWERED`, `error.details.lockReason` says why), and a form, questionnaire or PDF form someone answered or saved a draft of, even when it was sent to several people (`400 FORM_QUESTIONS_LOCKED`). A poll's voter names can still be hidden after a vote. Whether anyone or everyone must answer is fixed once someone responded (`409 COMPLETION_MODE_LOCKED`), and an e-signature's document and fields once a preparer placed the fields (`409 ESIGN_PREPARER_PLACED`). AI help is fixed at send: turning Assist on or off, its agent and what it may read of earlier steps, AI preparation, Advise and Rename files (`config.aiRename`: on or off, AI naming or a naming pattern, and its wording) (`400 LIVE_AI_NOT_EDITABLE`, `error.details.lockReason` is `ai_set_at_send`), and who prepares once the step has started (`400 LIVE_PREPARERS_STARTED`, `error.details.lockReason` is `set_at_send`). AI Review, as on a sent action: an AI reviewer can be added, its agent swapped or the AI swapped out for a person until the step is in review; on a step with several live runs (a For each's items) until any of them is in review or renaming its files. Each live run's reviewer seats then follow, and a finished run keeps its own. After that it returns `400 STEP_NOT_EDITABLE` (`error.details.lockReason` is `under_review`). Switching Review off while the reviewer is AI returns `400 LIVE_AI_NOT_EDITABLE` (`error.details.settings` is `["ai_review"]`). Both list what the save changed in `error.details.settings`, by the names `locks.aiHelp` uses (`prepare`, `preparers`, `assist_switch`, `assist_agent`, `assist_grants`, `advise`, `ai_review`, `ai_rename`). What Assist knows and how it answers still change. A file Assist reads (`config.assist.faqFiles`) must be a file of your organization (`400 ACTION_ASSIST_FILE_NOT_IN_ORG`) and either one the step's Assist already reads or an upload of the token's person (`409 ACTION_ASSIST_FILE_UNAVAILABLE`). A poll has no Anyone or Everyone to set (`400 COMPLETION_MODE_NOT_ALLOWED`). The name, due date and reminders always change, also when the save sends the unchanged settings with them, and the reminders also when they are sent in `config` (`config.customReminders`). A change to what a to-do, acknowledgement, approval or decision asks takes back the one-tap buttons in the email its people have and sends them new ones; a change to what is signed sends the signers new links. `effects` says how many people were sent one. Two saves at once are applied in turn, the later one setting what it sends.

**A started step keeps its assignees here.** Sending `assignee` or `roleIds` for a step that has started returns `409 STEP_STARTED`, unless it started with nobody on it and is waiting for someone: it can still be given its first assignee. Use Reassign a step instead: it gives a person's part to someone else, adds a person beside the current assignees (`addSeat`) or takes one off (`unassign`).

**Refusals.** A finished step returns `400 INVALID_STATE` (`error.details.lockReason` is `finished`; `locks.content` in Get step settings says the same). A due date that has already passed returns `400 DUE_DATE_IN_PAST`. A role id that names no role of this flow returns `404 ROLE_NOT_FOUND`; an e-sign, DocuSign, Adobe Sign or document collaboration step returns `400 ROLE_ASSIGNMENT_NOT_SUPPORTED` for `roleIds`; a step type whose settings Moxo doesn't edit on a running flow (identity verification, an automation) returns `400 ASSIGNMENT_NOT_SUPPORTED` for either: use Reassign. An organization API key counts as a flow manager. Without flow manager access, the call returns 403, and for a flow outside your organization, 404.

Returns the edited step in the shape Get step returns.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: EditStepRequest

**Responses**

- `200` (object): The edited step.
- `400` (ErrorResponse): Refused: `ACK_ALREADY_ACKNOWLEDGED`, `ACTION_ASSIST_FILE_NOT_IN_ORG`, `ASSIGNMENT_NOT_SUPPORTED`, `COMPLETION_MODE_NOT_ALLOWED`, `DOCUMENT_REPLACE_REQUIRED`, `DUE_DATE_IN_PAST`, `ESIGN_ALREADY_SIGNED`, `FORM_QUESTIONS_LOCKED`, `INVALID_STATE`, `LIVE_AI_NOT_EDITABLE`, `LIVE_PREPARERS_STARTED`, `ROLE_ASSIGNMENT_NOT_SUPPORTED`, `STEP_NOT_EDITABLE`, `STEP_SETTINGS_NOT_EDITABLE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACTION_ASSIST_FILE_UNAVAILABLE`, `COMPLETION_MODE_LOCKED`, `ESIGN_PREPARER_PLACED`, `EXECUTION_ORDER_STARTED`, `STEP_ALREADY_ANSWERED`, `STEP_STARTED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{id}/steps/{stepId}`: Remove a step (manager)

**Acting as a flow manager.** Takes a step that hasn't finished off a running flow, as Remove on a step does in Moxo.

**What stays.** A step added to this flow (Add a step) at the top level that the flow hasn't reached yet (its status is still `PENDING`) is deleted: `outcome: "deleted"`. Any other step (one from the template, one the flow has reached, even if nobody has acted on it yet, or one added inside a branch path, as in Moxo) stays in the flow's steps as `SKIPPED` ("Removed by owner"), and the flow moves on past it: `outcome: "skipped"`. A failed automation step can be removed the same way, which lets the flow go on. Links already sent for the step stop working.

**Reason.** The body is optional. Send `{ "reason": "..." }` (1 to 5000 characters) to say why: the audit trail keeps it with the removal.

**Refusals.** A finished step returns `400 INVALID_STATE`. While the flow is paused, only a step that hasn't started can be removed: removing the step it is on would move it forward (`409 FLOW_PAUSED`). The person a review is about can't remove that step (`403 OWN_REVIEW`). Removing a waiting e-signature or PDF form step on a path while its document is being changed returns `503 SIGNING_BUSY`: try again. An organization API key counts as a flow manager. Without flow manager access, the call returns 403, and for a flow outside your organization, 404.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: RemoveStepRequest

**Responses**

- `200` (object): The step is removed.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `SIGNING_BUSY`. The description says when; `error.code` says which.

### `GET /v1/flows/{id}/steps`: List a flow's steps

Returns the step runs of one flow as a flat list, in flow order: each run's ids, name, type, status, the branch or loop run it sits inside, and when it started, finished and is due. Lighter than `GET /v1/flows/{id}` when you only need the steps. Use `status` for what is open now, and send a run's `id` as `{stepId}` to the step endpoints.

A personal access token lists the runs the flow's page shows its person; an organization API key lists every run. Page with `cursor`: send the previous page's `nextCursor` as it is.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string): The flow's id.
- `status` (query, string): Only runs in these statuses, comma-separated, such as `IN_PROGRESS,WAITING_FOR_ASSIGNEE` for what is open now.
- `limit` (query, integer): Runs per page, 1 to 200. Defaults to 100.
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the first page.

**Responses**

- `200` (object): A page of the flow's step runs.
- `400` (ErrorResponse): A query parameter is not valid (`VALIDATION_FAILED`), or `cursor` is not one this list issued (`INVALID_CURSOR`).
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps`: Add a step to a running flow

**Acting as a flow manager.** Adds one new step to a running flow.

**Where it goes, and what it waits for.** To make the step wait for another step, place it after that step with `afterStepId`. It starts when that step is done, like every step in the flow. `config.dependsOnStepIds` is different: the step may start sooner, once these are done, even while the step before it is still open. It never makes the step wait longer, so a step listed there that comes after this one's place is refused.

Send `type` and `name`. Everything else is optional. The step is added at the end unless you send `afterStepId` (`steps[].stepId` or `steps[].id` from `GET /v1/flows/{id}`). An id that names no step of this flow returns `404`, so a typo never adds the step at the end. `afterStepId` can also name a step inside a path. On a path that is running, the new step goes immediately after that step, which has to be the last action that has started or a later action that has not, and the path has to still be open. A finished path, a path the flow didn't take, a Decision that has started and not been answered, a path of a Decision the flow did not take, an approval that has started, an anchor before the last action that has started, or a path nested more than one level deep returns `409 PATH_CLOSED`. On the path a Decision chose, while that path is still open, the new step goes after the last action that has started, the same as on an open parallel path, including a Decision inside a parallel branch, a single choice branch, or a multi choice branch. A repeating section can't be used as `afterStepId`.

**A path that hasn't started.** In a branch, decision or approval that hasn't started yet, the step goes into the path wherever you name, as Edit process places it in Moxo. Its path has no runs yet, so the step has none either: the response has `started: false`, `id: null` and `status: null`, and the step gets its run when its path starts. Its assignees can be roles or people: a person is kept as a role that always goes to them, by the same rule as below. It goes live as an Edit process change does, with the same checks (`422`).

**A branch.** `type: "PARALLEL_BRANCH"` with `paths` adds a branch whose paths all start together when the flow reaches it; the step after it waits for every path. Each path has a `name` and its `steps`: steps of the eight types below, or a sub-flow (`subFlow` with `start: "later"`). The branch goes at the top level of the flow, before or after a step the flow hasn't reached, and goes live as an Edit process change does: a place in front of a step that has started returns `422 STRAND`, an anchor inside a path `400 VALIDATION_FAILED`. `paths[].steps` in the response lists each step's `stepId`. A path can't be added to a branch that has already started.

**A sub-flow on a running path.** `subFlow` with `start: "later"` and an `afterStepId` naming the last action that has started on a running path, or a later action that has not: the sub-flow starts when the step before it is done, and the step after the branch waits for it. A decision or approval can't join a running path.

**Before a step.** `beforeStepId` (not with `afterStepId`) puts the new step right before a top-level step instead, as Edit process does in Moxo. That step must not have started, and the flow must not have moved past it; otherwise the call returns `409 INSERT_BEFORE_STARTED_STEP` and adds nothing, instead of placing the step somewhere else. An id that names no top-level step returns `404`.

**Assignee.** Prefer `assignees`: each entry is exactly one of `{ "uniqueId" }`, `{ "userId" }`, `{ "email" }`, or `{ "roleId" }`. A `uniqueId` must already belong to someone in your organization. An email no one in your organization has adds that person as an external user, which needs the right to add external users (`external_users:write`). A role id comes from `roles[].id` on `GET /v1/flows/{id}`. One person is a list of one. With two or more people, set `completion` to `{ "mode": "ONE" }` or `{ "mode": "ALL" }` (an older flat `completionMode` is still read as it). A deactivated person, an AI agent or a service account is refused. Leave it out to leave the step unassigned.

**Preparers and reviewers.** Optional `preparers` and `reviewers` name people the same way, under `people`, each with an optional `completionMode` (`ONE`: any one person; `ALL`: everyone). Preparers go on `FORM`, `TODO`, `APPROVAL`, `FILE_REQUEST`, `ACKNOWLEDGEMENT`, `DECISION`, `QUESTIONNAIRE` and `CHECKLIST`; reviewers on `FORM`, `FILE_REQUEST` and `QUESTIONNAIRE`. On any other type, either returns `400 VALIDATION_FAILED` naming it.

**The two ids in the response.** `data.id` is this run of the step (also `steps[].id` on Get flow). `data.stepId` is the step on the flow (also `steps[].stepId`). Complete, Decline, Get step, Skip, Reassign, Remind, and Reopen accept either id. Prefer `stepId` as `afterStepId` when you add another step later. `placement` says where the step landed (`reanchored` is true when the requested spot had to move forward).

**Paused, finished, canceled, removed.** A paused flow can take a new step, except one placed before the step the flow is on (`409 FLOW_PAUSED_INSERT_BEFORE_CURRENT`). A finished flow returns `400 INVALID_STATE` unless you send `continueIfCompleted: true`, which continues the flow and then adds the step (`flowReopened: true` on the response). That doesn't continue a flow that was removed (`404`), an organization that is paused (`402 ORG_FROZEN`) or a finished one-off action (`409 ACTION_ENDED`: send a new action instead). A canceled flow returns `403 FLOW_CANCELLED`. A flow that was removed returns `404`.

**Retries.** Send an `Idempotency-Key` (a new UUID). A retry within 10 minutes returns this response again and adds no second step.

**Not on this endpoint.** Inserting inside a repeating section, a For each or another branch inside a path, a new path on an existing branch, and copying a step from a template. Edit a step with `PATCH /v1/flows/{id}/steps/{stepId}`, remove one with `DELETE /v1/flows/{id}/steps/{stepId}`, and reorder with `POST /v1/flows/{id}/steps/{stepId}/move`.

**Step types.** `FORM`, `TODO`, `APPROVAL`, `FILE_REQUEST`, `ACKNOWLEDGEMENT`, `DECISION`, `QUESTIONNAIRE`, `CHECKLIST`. Anything else, including a signature step, is refused. A decision or approval added here is one step and cannot contain other steps (`400 NESTED_STEPS_NOT_ALLOWED`).

**Why only these eight.** They are work a person does, so adding one to work already under way changes nothing else in the flow. Automations (REST API, Code, Wait, AI actions, sending email, updating data) and the rest of the logic (loops, jumps, choice branches) are different: they act on their own, read earlier answers and connections that the publish checks prove exist, and logic changes the route a running flow has already planned. Dropping one into a live flow would skip those checks. Build them into the template instead: author or change it (`POST /v1/ai/generations`, including `mode: "edit"`, or the template builder), publish it, and every flow started afterwards runs them. `GET /v1/templates/{id}` describes each step type's settings.

### Shared `config` keys

These work on every type below when the step supports them:

- `stepDue`: when the step is due. Relative: `{ "type": "RELATIVE", "value": 3, "unit": "DAYS", "dayType": "calendar" }`. Fixed: `{ "type": "FIXED", "date": "2026-10-20" }`. Units: `MINUTES`, `HOURS`, `DAYS`, `WEEKS`.
- `skipSequentialOrder`: `true` starts this step with the previous one when your plan includes Start without waiting.
- `dependsOnStepIds`: `steps[].stepId` values from `GET /v1/flows/{id}`. The step may start sooner, once these steps are done, even while the step before it is still open. It never makes the step wait longer: to make it wait for a task, use `afterStepId`. Needs the same plan feature as `skipSequentialOrder`, and not with it.
- `attachments`: reference materials already in Moxo, or a web link: `{ "kind": "link", "url": "https://example.com/checklist.pdf", "title": "Checklist" }`. Uploading a new file is a second call to Upload an attachment to a step.

### Examples by step type

#### To-do (`TODO`)

```json
{
  "type": "TODO",
  "name": "Call the client",
  "description": "Confirm the wire instructions before we fund.",
  "assignees": [{ "userId": "usr_123" }],
  "afterStepId": "s-kickoff",
  "reason": "Ops asked for a phone confirm.",
  "config": {
    "stepDue": { "type": "RELATIVE", "value": 1, "unit": "DAYS", "dayType": "business" }
  }
}
```

#### File request (`FILE_REQUEST`)

```json
{
  "type": "FILE_REQUEST",
  "name": "Additional documents",
  "description": "Upload your last two business bank statements.",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "fileRequest": {
      "maxFiles": 3,
      "maxFileSizeMB": 25,
      "instructions": "PDF preferred"
    },
    "stepDue": { "type": "RELATIVE", "value": 3, "unit": "DAYS", "dayType": "calendar" },
    "attachments": [
      {
        "kind": "link",
        "url": "https://example.com/document-checklist.pdf",
        "title": "Document checklist"
      }
    ]
  }
}
```

`fileRequest.maxFiles` is 1 to 50 (default 5). `maxFileSizeMB` is 1 to 100.

#### Form (`FORM`)

```json
{
  "type": "FORM",
  "name": "Client details",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "formFields": [
      {
        "key": "legal_name",
        "label": "Legal name",
        "type": "TEXT_SINGLE_LINE",
        "required": true
      },
      {
        "key": "entity_type",
        "label": "Entity type",
        "type": "DROPDOWN",
        "required": true,
        "options": [
          { "label": "LLC", "value": "llc" },
          { "label": "Corporation", "value": "corporation" },
          { "label": "Partnership", "value": "partnership" }
        ]
      },
      {
        "key": "incorporation_date",
        "label": "Date of incorporation",
        "type": "DATE"
      }
    ]
  }
}
```

Common field `type` values: `TEXT_SINGLE_LINE`, `TEXT_MULTI_LINE`, `EMAIL`, `PHONE`, `NUMBER`, `DATE`, `DROPDOWN`, `MULTI_SELECT`, `YES_NO`, `FILE_UPLOAD`, `HEADING`, `PAGE_BREAK`. Give each field a stable `key`. A dropdown or multi-select lists its choices in `options` as `{ "label", "value" }`.

#### Approval (`APPROVAL`)

```json
{
  "type": "APPROVAL",
  "name": "Credit review",
  "description": "Approve funding for this account opening.",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "completion": { "mode": "ONE" },
    "approval": { "assigneeOrder": "PARALLEL" },
    "stepDue": { "type": "RELATIVE", "value": 2, "unit": "DAYS", "dayType": "business" }
  }
}
```

`completion.mode` is `ONE`, `MAJORITY`, or `ALL`. `assigneeOrder` is `PARALLEL` or `SEQUENTIAL`. Don't put other steps under the approve or reject branches on this call.

#### Acknowledgement (`ACKNOWLEDGEMENT`)

```json
{
  "type": "ACKNOWLEDGEMENT",
  "name": "Acknowledge fee schedule",
  "description": "Confirm you have read the attached fee schedule.",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "attachments": [
      {
        "kind": "link",
        "url": "https://example.com/fee-schedule.pdf",
        "title": "Fee schedule"
      }
    ],
    "options": { "requireAttachmentReview": true }
  }
}
```

#### Decision (`DECISION`)

A decision needs at least 2 options in `config.outcomes`, each with a `label` (`400 DECISION_MIN_OUTCOMES` / `DECISION_OPTION_LABEL_REQUIRED`). Leave `outcomeId` out and one is created. Don't put steps inside an option on this call.

```json
{
  "type": "DECISION",
  "name": "Route the application",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "outcomes": [
      { "label": "Approve" },
      { "label": "Send back" },
      { "label": "Decline" }
    ],
    "decision": {
      "completion": { "mode": "ONE" }
    }
  }
}
```

#### Questionnaire (`QUESTIONNAIRE`)

```json
{
  "type": "QUESTIONNAIRE",
  "name": "Risk questionnaire",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "questionnaire": {
      "questions": [
        {
          "questionId": "q-source-of-funds",
          "question": "What is the source of funds?",
          "answerType": "SINGLE_SELECT",
          "options": [
            { "value": "Salary", "label": "Salary" },
            { "value": "Investment", "label": "Investment" },
            { "value": "Inheritance", "label": "Inheritance" },
            { "value": "Other", "label": "Other" }
          ],
          "required": true
        },
        {
          "questionId": "q-pep",
          "question": "Any politically exposed persons?",
          "answerType": "YES_NO",
          "required": true
        },
        {
          "questionId": "q-notes",
          "question": "Additional notes",
          "answerType": "TEXT"
        }
      ]
    }
  }
}
```

`answerType` values: `SINGLE_SELECT`, `MULTI_SELECT`, `TEXT`, `YES_NO`, `DATE`, `TIME`.

#### Checklist (`CHECKLIST`)

```json
{
  "type": "CHECKLIST",
  "name": "Onboarding checklist",
  "assignees": [{ "userId": "usr_123" }],
  "config": {
    "checklist": {
      "items": [
        { "itemId": "id-check", "label": "Verify government ID" },
        { "itemId": "address-check", "label": "Confirm residential address", "description": "Utility bill within 90 days" },
        { "itemId": "sanctions", "label": "Run sanctions screen" }
      ],
      "completionStatuses": ["DONE", "SKIPPED"]
    }
  }
}
```

Give each item a stable `itemId`. `completionStatuses` defaults to `["DONE","SKIPPED"]`. Use `["DONE"]` when skipping is not allowed.

#### Parallel branch (`PARALLEL_BRANCH`)

Three forms worked on at the same time, before the review. Each path runs its own steps in order; the review waits for every path.

```json
{
  "type": "PARALLEL_BRANCH",
  "name": "Process forms",
  "beforeStepId": "s-review",
  "paths": [
    {
      "name": "W-8BEN-E",
      "steps": [
        { "type": "TODO", "name": "Process W-8BEN-E", "assignees": [{ "email": "tax.owner@example.com" }] }
      ]
    },
    {
      "name": "KYC questionnaire",
      "steps": [
        { "type": "TODO", "name": "Process KYC questionnaire", "assignees": [{ "roleId": "role-onboarding-lead" }] },
        { "type": "APPROVAL", "name": "Approve KYC questionnaire", "assignees": [{ "roleId": "role-compliance" }] }
      ]
    },
    {
      "name": "ISDA schedule",
      "steps": [
        { "type": "TODO", "name": "Process ISDA schedule", "assignees": [{ "roleId": "role-onboarding-lead" }] }
      ]
    }
  ]
}
```

The response names the branch and, for each path, its `pathId` and its steps' `stepId`s. Use a path's last `stepId` as `afterStepId` to add a step to that path later, while it is still open.

```json
{
  "success": true,
  "data": {
    "id": "2cf97387-e5e7-4814-8ff1-0a9e128e52e1",
    "stepId": "dynamic_1e06e4c7",
    "type": "PARALLEL_BRANCH",
    "name": "Process forms",
    "status": "PENDING",
    "placement": { "afterStepId": "s-form", "stepIndex": 2, "reanchored": false },
    "paths": [
      { "pathId": "4acacafc-4fc5-4de0-9a3a-987b655e4969", "name": "W-8BEN-E", "steps": [{ "stepId": "dynamic_09d852da", "type": "TODO", "name": "Process W-8BEN-E" }] },
      { "pathId": "deef8af7-401b-40b3-8988-c19e953131bc", "name": "KYC questionnaire", "steps": [{ "stepId": "dynamic_86999229", "type": "TODO", "name": "Process KYC questionnaire" }, { "stepId": "dynamic_aa1692a5", "type": "APPROVAL", "name": "Approve KYC questionnaire" }] },
      { "pathId": "ed105b26-58dd-468d-ba3a-9256e3a57fe0", "name": "ISDA schedule", "steps": [{ "stepId": "dynamic_ff23e60e", "type": "TODO", "name": "Process ISDA schedule" }] }
    ]
  }
}
```

Send 2 to 10 paths. A path's steps take roles (`{ "roleId" }`, from `roles[].id` on `GET /v1/flows/{id}`) or people (`{ "userId" }` or `{ "email" }`, by the same rule as Assignee above); a path has no runs until the branch starts. The branch starts when the flow reaches it, so its steps get their runs (`steps[].id` on `GET /v1/flows/{id}`) only then. A path can be a sub-flow instead: `{ "subFlow": { ..., "start": "later" } }` on its own as the path's step.

### Minimal call

```
curl -X POST "$MOXO/v1/flows/$FLOW/steps" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f2c4a5e-3b8d-4c7f-9a1e-2d6b8e0f4c5a" \
  -d '{"type":"TODO","name":"Collect the signed W-9"}'
```

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string): The flow's id.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: AddFlowStepRequest

**Responses**

- `201` (object): The step was added.
- `400` (ErrorResponse): The body or the flow cannot take this step. `VALIDATION_FAILED` when `type` is missing or not one of the types listed above, when `name` is missing, or when the body contains a field this endpoint does not accept. `NESTED_STEPS_NOT_ALLOWED` when `config` contains other steps. `DECISION_MIN_OUTCOMES` when a decision has fewer than 2 options. `DECISION_OPTION_LABEL_REQUIRED` when a decision option has no label. `DECISION_OPTION_ID_INVALID` when two decision options share an `outcomeId` or `id`, or an id is not text. `ASSIGNEE_NOT_INVITABLE` when a person in `assignees` was deactivated or removed. `ASSIGNEE_NOT_HUMAN` when a person in `assignees` is an AI agent or a service account. `INVALID_STATE` when the flow is not running (it has finished). `ACTION_TEST_ONE_STEP` when the flow is a test its sender sent to themselves: a test is a single request and takes no more steps. `CAPABILITY_DISABLED` when your organization cannot use that step type. `INVALID_STEP_SETTINGS` when a setting cannot be used, including a `config.dependsOnStepIds` step that comes after this one's place (`WAITS_FOR_LATER_STEP` in `error.details`).
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): `ORG_FROZEN` when `subFlow.start` is `now` and your organization is over its flow quota: no step of the flow can start, so nothing is added. Top up first, or send `start: "later"`.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found. `NOT_FOUND` when the flow does not exist, was removed, or is not visible to you, or when `afterStepId`, `beforeStepId` or `config.dependsOnStepIds` names no step of this flow; the message names the parameter. `USER_NOT_FOUND` when a person in `assignees` is not a member of your organization.
- `409` (ErrorResponse): The flow is paused and the requested position is before the step the flow is on (`FLOW_PAUSED_INSERT_BEFORE_CURRENT`). Add the step after that step, or resume the flow first. `PATH_CLOSED` when `afterStepId` names a step in a path that can no longer take one: the path has finished, the flow took another path, a Decision has started and not been answered, a path of a Decision the flow did not take, an approval has started, the anchor is before the last action that has started, the step type cannot be added to a running path, or the path is nested more than one level deep. On the path a Decision chose, the new step goes after the last action that has started. `PATH_NOT_STARTED` when a sub-flow with uploaded start details would go into a path that has not started: its uploads need a run to belong to. `CHANGES_OTHER_STEPS` when a branch or a step into a path that has not started would change other steps of the flow: nothing is added. `INSERT_BEFORE_STARTED_STEP` when `beforeStepId` names a step that has started, or one the flow has moved past: nothing is added. `NOTHING_IN_PROGRESS` when `subFlow.start` is `now` and nothing is in progress on the flow to start beside, and `START_NOW_UNAVAILABLE` when it would wait where it goes instead of starting: nothing is added. Send `start: "later"` with `afterStepId`. `FLOW_PAUSED_START_NOW` when `subFlow.start` is `now` and the flow is paused: a sub-flow never starts under a paused flow, so nothing is added. Resume the flow first, or send `start: "later"`. `ACTION_ONE_ASK` when the flow is a one-off action (`kind: "action"`): an action is one ask, so nothing is added, on any plan. Send a new action instead, or start a flow.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `422` (ErrorResponse): A branch, or a step into a path that has not started, goes live as an Edit process change does, and is refused as Edit process refuses it: nothing is added. `STRAND` when it would go in front of a step that has started. `VIOLATIONS` when it would change a branch, decision or loop that has started. `VALIDATION` when a step it adds fails the checks a step added in Edit process passes (a reference to a step or field this flow does not have, a sub-flow that cannot start). `NOT_EDITABLE` when the flow is not running (paused or finished).
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/steps/{stepId}/complete`: Complete a step

Records that the person whose turn it is finished their work, and advances the flow. The body depends on the step type; see "Completing a step" at the top of this section.

**`{stepId}`.** Send `steps[].id` / Add-step `data.id` (one run), or `steps[].stepId` / Add-step `data.stepId` (the step on the flow). A run's `id` names that run. A `stepId` means the run in progress; while more than one run of a repeating step is open, it returns `409 AMBIGUOUS_STEP` instead of guessing.

Call `complete` as the person whose turn it is, with their personal access token, or as someone covering for them. A flow manager, the flow's owner or an admin who holds no part in the step can also complete it with `complete`: it is recorded as done by them on behalf of the step's assignee (`completedOnBehalfOf` on the step, and "on behalf of" in the audit log). To close a step without its work and show that it was forced, use `POST /v1/flows/{id}/steps/{stepId}/force-complete` with a `reason`.

**What you send is checked.** Answers are `resultData`, keyed by field id (a key or label there is refused, naming the id). A key that is not a field of the step, a choice that is not one of the field's options, or a value of the wrong kind (an object where text belongs, words in a number field) returns `400 VALIDATION_FAILED`, naming the field and listing the field ids or options it takes; nothing is saved.

**Refusals.** A step that is already completed, or your part of it, returns `409 ALREADY_COMPLETED`: on a retry, treat it as success. When two people complete the same step at once, one answer is saved and the other request returns `409 ALREADY_COMPLETED`, never a success whose answer was thrown away. A step in its review (an AI review included) returns `409 STEP_AWAITING_REVIEW`; a step that changed during the request, `409 STALE_ACTION`; an answer to a step whose question changed since you read it (send `askedFingerprint` from `GET /v1/flows/{id}/steps/{stepId}` beside `resultData`; an answer without it is not checked), `409 STEP_CHANGED`, nothing recorded; an answer that met a change of who reviews the step while it was on its way (a reviewer, AI or person, added, swapped or taken away), `409 REVIEW_CHANGED`, nothing recorded: a retry is safe, and the same answer sent again goes to the review as it now stands; a file rename that couldn't be scheduled, `503 SERVICE_UNAVAILABLE` (try again). An e-signature step is finished by signing the document, so completing it here returns `409 ESIGN_SIGNATURE_REQUIRED` (a flow manager can still `/force-complete` it, recorded as forced). The same holds for every step its own event closes (signed in DocuSign or Adobe Sign, an identity verified, a payment made, a Jotform submitted, a time booked): completing it here returns `409 STEP_COMPLETES_ON_ITS_OWN`, naming what closes it, and a flow manager can `/force-complete` it. A Goal step completed without one of its required outputs (keyed by output id in `resultData`) returns `400 REQUIRED_OUTPUTS_MISSING`, naming each, and one with a key it declares no output for returns `400 OUTPUT_NOT_DECLARED`. A paused flow returns `409 FLOW_PAUSED` (don't retry; a person must resume the flow). A step that closes at its due date (`closeAtDue`) and whose close has passed returns `409 ACTION_CLOSED`: what was saved has been sent on, and a flow manager can reopen it. An upload on the step that was flagged as harmful returns `422 FILE_INFECTED`; one the safety check couldn't check, `409 SCAN_UNAVAILABLE`; and one a form answer names that is still being checked, `425 SCAN_PENDING` (try again). A Web App step the team confirms returns `403 COMPLETION_REQUIRES_MEMBER` to anyone who is not an internal user of the organization. If you have no open part in the step and are not one of its flow managers, the call returns `403 NOT_STEP_ASSIGNEE`. A flow busy with another change past a few seconds returns `503 FLOW_BUSY` with a `Retry-After` header: nothing was saved, so send the same request again (the same `Idempotency-Key` is accepted).

**What happens next.** The answer comes once your completion is saved. The steps that follow it normally start before the answer, and always within seconds: a step after it can still read `PENDING` in this answer. Read the flow again, or listen for `step.started`, to see them start.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: CompleteStepRequest

**Responses**

- `200` (object): The step after your completion (the run it completed, when you named a template step id), as `GET /v1/flows/{id}/steps/{stepId}` returns it. A step with an AI reviewer answers `202` with the same body, its status showing the review.
- `202` (object): Sent to its AI review: your answer is saved and the reviewer decides. The step as `GET /v1/flows/{id}/steps/{stepId}` returns it, its status showing the review.
- `400` (ErrorResponse): Refused: `OUTPUT_NOT_DECLARED`, `REQUIRED_OUTPUTS_MISSING`, `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACTION_CLOSED`, `ALREADY_COMPLETED`, `AMBIGUOUS_STEP`, `ESIGN_SIGNATURE_REQUIRED`, `FLOW_PAUSED`, `REVIEW_CHANGED`, `SCAN_UNAVAILABLE`, `STALE_ACTION`, `STEP_AWAITING_REVIEW`, `STEP_CHANGED`, `STEP_COMPLETES_ON_ITS_OWN`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `FILE_INFECTED`. The description says when; `error.code` says which.
- `425` (ErrorResponse): Refused: `SCAN_PENDING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `FLOW_BUSY`, `SERVICE_UNAVAILABLE`. The description says when; `error.code` says which.

### `POST /v1/flows/{id}/steps/{stepId}/decline`: Decline a step

Declines an approval step: sends it back for changes, or rejects it, as the approval's `onReject` setting allows. Send a `reason`: the audit trail and the requester show it. See "Declining an approval" at the top of this section. Call `decline` as an approver whose turn it is, with their personal access token: the decline is recorded on their seat. An approver may decline their own approval whether or not they manage the flow. A flow manager, the flow's owner or an admin who isn't one of the step's open approvers gets `410 NO_ACTIVE_SLOT`, and anyone else gets `403 FORBIDDEN`.

**Already decided.** Sending the decision this round already made again changes nothing: the answer says `changed: false`, and the decision stands. An approval decided another way this round (approved, or declined the other way) returns `409 APPROVAL_DECIDED_OTHERWISE` with `error.decision`, and nothing changes.

**Changed since you read it.** Send the approval's `askedFingerprint` from `GET /v1/flows/{id}/steps/{stepId}`: when what it asks changed since, nothing is saved and the call returns `409 STEP_CHANGED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: DeclineStepRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `APPROVAL_DECIDED_OTHERWISE`, `STEP_CHANGED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): Refused: `NO_ACTIVE_SLOT`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/prepare-complete`: Complete a step's preparation

Some steps are set up by one person before another acts on them: someone supplies the contract to be signed, or fills in part of a form. This marks that setup done and hands the step on. It applies only to steps with a preparer. Needs a personal access token (`403 ASSIGNEE_REQUIRED` for an organization API key).

**A step that runs once for each item** has one copy per item, and all of them share `stepId`. Send `stepExecutionId` (`steps[].id` from `GET /v1/flows/{id}`) to name the copy you are preparing. Without it, the one copy still waiting to be prepared is used. When two or more are waiting, the call returns `400 EXECUTION_REQUIRED` instead of guessing.

**An e-sign step whose template turned on Prevent PDF replacement** keeps its PDF: sending a different document in `overrides.setup.documentRef` returns `409 ESIGN_SOURCE_DOCUMENT_LOCKED`, and nothing is saved. Checking signers and signing fields still works.

**A preparer changes the step for this run, not what the rest of the flow depends on.** Renaming a decision option is fine. Sending an option the step doesn't have returns `422 PREPARE_EDIT_LOCKED`, and so does a custom action file the template doesn't list, a web address for a Web App that runs an uploaded page, or a newer `setup` field meant for a different kind of step. Nothing is saved, and the preparer can send again.

**Not yet, or not as sent.** A step still being set up returns `409 PREPARE_ACTIVATION_PENDING`: try again in a moment. A step whose assignee works on a document (a document review, a PDF form) needs one before its preparation is done: the template's, an earlier step's file, or the preparer's own in `overrides.setup.documentRef`. Without one the call returns `422 PREPARATION_INCOMPLETE`, with what is missing in `error.missing` (`["document"]`), and nothing is saved: the same rule the preparer screen follows. A preparation that can't be completed as sent returns `400 PREPARE_FAILED`, and the message says why. A preparer whose turn has not come yet gets `409 NOT_YOUR_TURN`: on a step whose preparers take turns, another preparer goes first, or the AI is still preparing it.

`stepId` takes the template step id or one copy's own id (`steps[].id`), as the step reads do.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. An execution id names its run. With the template step id, name one run of a repeating step with `?stepExecutionId=`; with two or more still waiting and none named, the call returns `400 EXECUTION_REQUIRED`.
- `stepExecutionId` (query, string): The copy of a step that runs once for each item. `steps[].id` from `GET /v1/flows/{id}`.

**Request body**

- `application/json`: PrepareCompleteRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `EXECUTION_REQUIRED`, `PREPARE_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ESIGN_SOURCE_DOCUMENT_LOCKED`, `NOT_YOUR_TURN`, `PREPARE_ACTIVATION_PENDING`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `PREPARATION_INCOMPLETE`, `PREPARE_EDIT_LOCKED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/review-approve`: Approve a review

Signs off on what the assignee submitted, so the flow can move on. It applies only to steps with a reviewer. The caller must be the reviewer.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run that is waiting for review; if none is waiting, the call returns `404` instead of acting on a finished run.

**Request body**

- `application/json`: ReviewApproveRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/resolve-output`: Pick a record

Chooses one record when a Look up a record step found more than one, so the flow can continue. The caller must be the person asked to pick. `choice` `record` sends `recordId` from the waiting list. `choice` `none` follows the step's no-match setting. Send `round` from that list. When the records changed, the call returns `409 CANDIDATES_CHANGED` and the current list, and nothing is saved. Needs a personal access token (`403 ASSIGNEE_REQUIRED` for an organization API key). `stepId` is the run's id (`steps[].id`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes only a run's `steps[].id` from `GET /v1/flows/{id}`. Unlike the other step endpoints, it doesn't take a `stepId`. Send the run's id (`steps[].id`). A template step id returns `404`. The path names one run, so a repeated step is never guessed.

**Request body**

- `application/json`: ResolveOutputRequest

**Responses**

- `200` (object): The pick was saved.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CANDIDATES_CHANGED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/review-decline`: Send a submission back for changes

Returns the step to the person who submitted it so they can change their answer. `reason` is required: it tells them what to fix. The caller must be the reviewer.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run that is waiting for review; if none is waiting, the call returns `404` instead of acting on a finished run.

**Request body**

- `application/json`: ReviewDeclineRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepExecutionId}/review-group`: Read the items reviewed together

For a step whose reviewers review all items together, the list of every item's copy of the step in that loop: where each stands and what you can do. An item appears only to a reviewer of that item or a flow manager. A run whose step is not reviewed together returns `404 NOT_IN_REVIEW_GROUP`; a caller who reviews no item and does not manage the flow gets `403 REVIEW_GROUP_FORBIDDEN`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepExecutionId` (path, required, string): Any item's run of the step in the loop: a `steps[].id` from `GET /v1/flows/{id}`. Takes only a run's id.

**Responses**

- `200` (object): The list.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecutionId}/review-group/mark`: Mark an item reviewed

Marks (or unmarks) one item's current submission reviewed, as your own progress through the list. It is not an approval and tells nobody. Only while the loop moves items on together, and only on your turn: an item that moved since you read it returns `409 REVIEW_ITEM_CHANGED`, a loop whose items move on one by one `400 REVIEW_GROUP_NOT_APPROVE_ALL`, someone else's turn `403 NOT_ACTIVE_REVIEWER`. `stepExecutionId` is the item's own run.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepExecutionId` (path, required, string): Any item's run of the step in the loop: a `steps[].id` from `GET /v1/flows/{id}`. Takes only a run's id.

**Request body**

- `application/json`: ReviewGroupMarkRequest

**Responses**

- `200` (object): The item as it stands now.
- `400` (ErrorResponse): Refused: `REVIEW_GROUP_NOT_APPROVE_ALL`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `REVIEW_ITEM_CHANGED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepExecutionId}/review-group/approve`: Approve the items reviewed together

Approves the items you name, each with the `invocationEpoch` you read, in a background job, each through its own review approval. Returns `202` with a `jobId`; read the list again for where each item stands: an approved item reads `approved`, and an item that changed since you read it is left for you to review again. While the loop moves items on together, every item must be in first, or the call returns `409 REVIEW_GROUP_NOT_READY`. One approval runs at a time for you (`409 REVIEW_GROUP_APPROVE_IN_PROGRESS`). A job that cannot start returns `503 REVIEW_GROUP_APPROVE_NOT_STARTED`; nothing was approved, so retry.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry returns the same job.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepExecutionId` (path, required, string): Any item's run of the step in the loop: a `steps[].id` from `GET /v1/flows/{id}`. Takes only a run's id.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: ReviewGroupApproveRequest

**Responses**

- `202` (object): The approval runs in the background. Read the list again for where each item stands.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `REVIEW_GROUP_APPROVE_IN_PROGRESS`, `REVIEW_GROUP_NOT_READY`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/flows/{flowId}/steps/{stepId}/files`: List files for a step

Lists the files on this step. A file whose safety check hasn't passed is left out, so a file that was uploaded but never completed (see the upload endpoint) doesn't appear. A completed custom action step lists one PDF per person who sent its page, with their answers.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step on the flow (`step.stepId` in a webhook payload, or `steps[].stepId` from `GET /v1/flows/{id}`, for example `step-1`) or one run of it (`step.stepExecutionId` in a webhook payload, or `steps[].id`); both name the same step.

**Responses**

- `200` (object): The files.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{flowId}/steps/{stepId}/files`: Upload a file to a step

Uploads a file as part of the assignee's own submission on this step. Only the person who uploaded the file can see it until the step is completed, so this endpoint can't give the assignee a document to read: they never see it. Use `POST .../steps/{stepId}/attachments` for that.

After this call, finish the upload:
1. `PUT` the bytes to `uploadUrl`, with every header in `requiredHeaders` exactly as returned. They are covered by the URL's signature, so a `PUT` without them is refused.
2. If the response included `completionUrl`, `POST` to it with no body. That starts the file's safety check; without it, the file is never shown to anyone.

The file is left out of the list and download endpoints until that check passes.

**Where an upload is used:**
- **File request**: the upload is the submission. Pass the returned ids to `/complete` as `resultData.files`.
- **Form**: it becomes a field's value. Send its id under the `FILE_UPLOAD` field's id when you complete the step. The upload alone does nothing.
- **E-sign, PDF form and document review**: only while the step is being prepared, as the document to sign, fill in or review.
- **Any other step**: the upload is accepted but not used. Nobody is shown the file and no step refers to it. The call still returns `201`, so check the step type before you upload.

A step takes files while it is worked on: being prepared, waiting for its assignee, in progress or in review. Refusals: `409 STEP_ALREADY_FINISHED` for a finished step; `409 STEP_NOT_REACHED` for a step the flow hasn't reached yet; `409 STEP_ON_HOLD` for a step on hold (a connection still to make, a paused wait) until it resumes.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step on the flow (`step.stepId` in a webhook payload, or `steps[].stepId` from `GET /v1/flows/{id}`, for example `step-1`) or one run of it (`step.stepExecutionId` in a webhook payload, or `steps[].id`); both name the same step.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The upload is ready: send the bytes to `uploadUrl`.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `STEP_ALREADY_FINISHED`, `STEP_NOT_REACHED`, `STEP_ON_HOLD`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{flowId}/steps/{stepId}/files/{fileId}`: Download a step file

Returns a short-lived download URL for the file. `flowId`, `stepId` and `fileId` must match: a file from one step can't be fetched through another step's URL.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step on the flow (`step.stepId` in a webhook payload, or `steps[].stepId` from `GET /v1/flows/{id}`, for example `step-1`) or one run of it (`step.stepExecutionId` in a webhook payload, or `steps[].id`); both name the same step.
- `fileId` (path, required, string)

**Responses**

- `200` (object): A short-lived download URL.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{flowId}/steps/{stepId}/files/{fileId}`: Delete a step file

Removes a file from a step.

Returns `409` while anything still uses the file, so a deletion never leaves a broken reference behind. The error code names what uses it:
- `FILE_REFERENCED_BY_STEP`: a completed step's answer includes it. Reopen that step, or archive the flow.
- `FILE_IN_DOCUMENT_COLLABORATION`: the file belongs to a Document collaboration step (a draft, a file held there for someone to use or dismiss, or a sent version and its PDFs). It can't be deleted with this endpoint.
- `FILE_REFERENCED_BY_ATTACHMENT`: it is shown to someone as reference material. Remove it with `DELETE .../steps/{stepId}/attachments/{attachmentId}`.
- `FILE_REFERENCED_BY_CHAT_MESSAGE`: it is attached to a message. Delete the message.
- `FILE_REFERENCED_BY_FIELD`: a flow field points at it. Clear or replace that field.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step on the flow (`step.stepId` in a webhook payload, or `steps[].stepId` from `GET /v1/flows/{id}`, for example `step-1`) or one run of it (`step.stepExecutionId` in a webhook payload, or `steps[].id`); both name the same step.
- `fileId` (path, required, string)

**Responses**

- `200` (object): The file was deleted.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied to the resource as it is now. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{flowId}/steps/{stepId}/files/{fileId}/pages`: Download pages of a step file

Returns the pages you ask for of a PDF on this step, in page order, as one PDF. Ask with `pages`: one page (`12`), a range (`12-14`), or a list (`3,7,12-14`), at most 50 pages in all. The `X-Moxo-Pages` header names the pages it holds and `X-Moxo-Page-Count` the pages the whole file has. The same rules as downloading the file apply: a file you can only view answers 403 `VIEW_ONLY`, and a file a step watermarks is stamped with your name, or answers 422 `WATERMARK_UNAVAILABLE` for a key that names no person.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step on the flow (`step.stepId` in a webhook payload, or `steps[].stepId` from `GET /v1/flows/{id}`, for example `step-1`) or one run of it (`step.stepExecutionId` in a webhook payload, or `steps[].id`); both name the same step.
- `fileId` (path, required, string)
- `pages` (query, required, string): Pages and ranges, separated by commas. Pages are numbered from 1.

**Responses**

- `200` (string): The pages, as a PDF.
- `400` (PageRangeErrorResponse): `pages` is missing or not written as pages and ranges (`PAGE_RANGE_INVALID`), or names a page the file does not have (`PAGE_RANGE_OUTSIDE_DOCUMENT`, with `pageCount`).
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The file was deleted under the organization's retention rules.
- `422` (ErrorResponse): The file is not a PDF (`PAGES_NOT_A_PDF`), its pages could not be opened (`PAGES_UNREADABLE`), or it must be watermarked and cannot be (`WATERMARK_UNAVAILABLE`).
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/skip`: Skip a step (manager)

**Acting as a flow manager.** Passes over a step that is waiting or in progress, without anyone finishing it, and moves the flow on. Nothing is recorded as completed. A failed automation step can be skipped to unblock the flow; a step that is already completed or skipped returns `400 INVALID_STATE`. A skipped step can't be reopened, and skipping the last open step finishes the flow. When the same step is skipped twice at once, the second request returns `409 CONFLICT`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: SkipStepRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONFLICT`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepId}/settings`: Get step settings (manager)

**Acting as a flow manager.** Returns a step's settings as Moxo's step editor shows them: `config` with the keys Edit a step takes, the due-date rule as `stepDue`, whether the settings can change now and until when (`editable`), what a save would refuse now and why (`locks`: what the step asks, anyone or everyone, and AI help), and for an e-sign step its signers and who can be added. A file is named by its `fileId`, a person by their id. Send a setting back unchanged and nothing changes. An organization API key counts as a flow manager. Without flow manager access, the call returns 403, and for a flow outside your organization, 404.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Responses**

- `200` (object): The step's settings.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flows/{id}/steps/{stepId}/monitors`: Get step monitors (manager)

**Acting as a flow manager.** Returns each monitor on a step (its escalation and the other automatic actions set on it): whether it is armed, when it checks next (`nextCheckAt`) and what it last did on this round of the step (`lastFired`). A monitor whose kind is not turned on for your organization reads `off`: it is never armed and never fires. Escalation needs escalation turned on for your organization; the other monitors need monitors turned on. An overdue timer arms when the step has a due date, and moves when the due date does. An organization API key counts as a flow manager. Without flow manager access, the call returns 403, and for a flow outside your organization, 404.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Responses**

- `200` (object): The step's monitors.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/items`: Add an item to a running For each (manager)

**Acting as a flow manager.** Adds one item to a For each that is running. The item gets its own run of the loop's steps, and the step after the loop waits for it too. A parallel loop starts it now (with a start interval, at its slot); a one-at-a-time loop starts it after the items before it; a loop with Sync steps across items starts it at its first step, and the other items wait for it before their next step. The item is not added to the list the loop came from. **Refusals.** `409 LOOP_NOT_STARTED`: the loop has not started. `409 LOOP_CLOSED`: every item finished and the flow moved on; add a step instead. `409 LOOP_LIMIT_REACHED`: the loop is at its limit. `409 FLOW_PAUSED`: resume the flow first. `409 LOOP_ITEM_UNSUPPORTED`: a loop over uploaded files. `400 INVALID_ITEM`: the item does not match the loop's item fields. `400 NOT_A_LOOP`: the step is not a For each.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same answer and adds no second item.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: AddLoopItemRequest

**Responses**

- `201` (object): The item was added.
- `400` (ErrorResponse): Refused: `INVALID_ITEM`, `NOT_A_LOOP`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`, `LOOP_CLOSED`, `LOOP_ITEM_UNSUPPORTED`, `LOOP_LIMIT_REACHED`, `LOOP_NOT_STARTED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/steps/{stepId}/move`: Move a step (manager)

**Acting as a flow manager.** Puts a step that hasn't started right after (`afterStepId`) or right before (`beforeStepId`) another step, as dragging it in Edit process does in Moxo, with the same checks.

Both steps must be at the top level, or inside the same branch, decision or loop while it has not started (any of its paths, as Edit process allows). A step inside one that has not started has no run yet: name it, and the other step, by `steps[].stepId` (listed under `steps[].paths[]`). `data.id` is then `null`.

**Refusals.** A step that has started can't move, and nothing can move in front of a step that has started (`422 STRAND`). Moving a step into or out of a branch, decision or loop, or inside one that has started, returns `422 VIOLATIONS`. A flow that is not running returns `422 NOT_EDITABLE`. A move changes only the order of steps: one that would change anything else returns `409 CHANGES_OTHER_STEPS` (use Edit process). A step moved next to a step inside it returns `409 ANCHOR_INSIDE_MOVED_STEP`. An `afterStepId` or `beforeStepId` that names no step of this flow returns `404 NOT_FOUND`. An organization API key counts as a flow manager. Without flow manager access, the call returns 403, and for a flow outside your organization, 404.

The step's milestone follows it, as on the canvas in Moxo: it joins the milestone of the step now above it (or below it, when it is first). Moving a step to where it already is changes nothing and returns `moved: false`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: MoveStepRequest

**Responses**

- `200` (object): The step is in its new place.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ANCHOR_INSIDE_MOVED_STEP`, `CHANGES_OTHER_STEPS`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `NOT_EDITABLE`, `STRAND`, `VIOLATIONS`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/reassign`: Reassign a step (manager)

**Acting as a flow manager.** Gives a waiting or in-progress step to someone else. Name the new assignee with `toUserId` or `toEmail`. On a step with several assignees, also send `fromUserId` to say who is being replaced. `role` defaults to `executor`.

**Add or remove one person.** `addSeat: true` adds `toUserId` or `toEmail` beside the current assignees, on this step only, as **Add to this step only** does in Moxo. It is refused on e-sign, DocuSign, Adobe Sign and identity verification steps, and on a document collaboration step (`400 ADD_SEAT_NOT_SUPPORTED`): add the person to a side's role there. `fillLoopItem: true` puts that person on the step as the person for the current row of a parallel For each, beside the roles already on it, as **Assign** does on a row that still needs a person. It is refused when the step is not assigned to the current person (`400 NOT_A_LOOP_ITEM_STEP`). `unassign: true` with `fromUserId` takes that person off the step, as **Remove from step** does; everyone else keeps their place. A part they have already done, or that is no longer needed, stays: with nothing else left to take off, `unassign` returns `409 SEAT_ALREADY_DONE`. Giving such a part to someone else is refused the same way (`409 SEAT_ALREADY_DONE`): reopen the step to have it redone. `role: "reviewer"` on a step with no review returns `409 STEP_HAS_NO_REVIEW` and seats no one: a reassign never adds a review.

**The person must already be a user in your organization.** An `email` that matches nobody returns `USER_NOT_FOUND` instead of inviting anyone. Create new people with `POST /v1/users` first.

**Already theirs.** Giving the step to the person who already has it changes nothing: the answer says `changed: false`.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same response and doesn't notify the assignee again.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: ReassignStepRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `ADD_SEAT_NOT_SUPPORTED`, `NOT_A_LOOP_ITEM_STEP`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `SEAT_ALREADY_DONE`, `STEP_HAS_NO_REVIEW`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/steps/{stepId}/remind`: Send a reminder (manager)

**Acting as a flow manager.** Reminds the step's current assignee. A step that is not open (waiting, finished or skipped) returns `400 INVALID_STATE`; a paused flow, `409 FLOW_PAUSED`.

**Or as a participant whose role can send reminders.** A personal access token of someone in a role with **Can send reminders** (and the organization's **Advanced participant permissions** on) may remind on a step they can see that someone else still has to do. Everyone the step waits on is reminded, never the caller; naming one person (`userId`) or one section (`sectionId`) stays a flow manager's and returns `403 SEAT_REMIND_MANAGER_ONLY`. A step id that more than one run shares names the open run, as for a flow manager. Any other step returns `403`.

**Nobody to remind.** When the reminder would reach nobody, nothing is sent or recorded and the answer is `400 NOTHING_TO_REMIND` with `error.reason`: the step is still being prepared (`preparing`), no one has anything to do on it yet (`nobody_acting`), the person named has nothing to do on it (`seat_not_acting`), or everyone on it has turned off their own reminders (`muted`). The template's reminder settings, such as Due date approaching, only turn off automatic reminders: they never stop this one. A reminder that was tried and reached nobody returns `502 REMINDER_NOT_SENT`, and nothing is recorded: try again.

**Remind one person.** With no body, everyone the step is waiting on is reminded. Send `userId` to remind only that person, as the per-person Remind in the app does, or `sectionId` on a document written together in sections to remind only that section's writers. The step and the flow are checked first, as above, whoever is named. A person who is not on the step returns `400 SEAT_NOT_ON_STEP`, the same for an id in no organization and one in another. A person on the step it isn't waiting on (their part is done, or their part comes in another phase or later in a sequence) is not reminded: `400 NOTHING_TO_REMIND` with its `error.reason`, and nothing is recorded. `sectionId` on any other step returns `400 SECTIONS_NOT_SUPPORTED`.

**Idempotent.** Send an `Idempotency-Key` to make retries safe: a retry within 10 minutes sends no second reminder. A retry after 10 minutes sends another one.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (object or ErrorResponse): Nobody to remind (`NOTHING_TO_REMIND`, with `error.reason`), the step is not open (`INVALID_STATE`), the person named is not on the step (`SEAT_NOT_ON_STEP`), or a section was named on a step without sections (`SECTIONS_NOT_SUPPORTED`).
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_PAUSED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `502` (object): The reminder was tried and reached nobody (`REMINDER_NOT_SENT`). Nothing was recorded. Try again.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/remind`: Remind everyone a flow is waiting on (manager)

**Acting as a flow manager.** Sends the people the flow is waiting on the same reminder as each waiting step's own Remind. No body.

Not idempotent: each call sends another reminder. The app's 24-hour wait between reminders doesn't apply to API calls. A paused flow returns `409 FLOW_PAUSED`. A flow with nobody waiting returns `400 NOTHING_TO_REMIND`. A send that reached nobody returns `502 REMINDER_NOT_SENT`.

`200` returns `data.reminded` (how many waiting steps were reminded) and `data.lastReminderSentAt` (the ISO time of the newest reminder on an active step, or `null`).

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `400` (object): Nobody is waiting on this flow (`NOTHING_TO_REMIND`). People who turned off their own reminders are this case; a role with due-date reminders turned off is not.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): The flow is paused (`FLOW_PAUSED`).
- `429` (ErrorResponse): Too many requests.
- `502` (object): A recipient was tried and the reminder reached nobody (`REMINDER_NOT_SENT`). Nothing was recorded. Try again.

### `POST /v1/flows/{id}/steps/{stepExecId}/retry`: Retry a failed step (manager)

**Acting as a flow manager.** Runs a failed automation step again (an AI step, a webhook or a scheduled email). A step a person does never fails; if someone isn't acting, send a reminder or reassign the step. Send `{ "omitMissingAttachments": true }` to send an email that stopped because a file is not available, leaving those files off. That flag is refused for any other step.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepExecId` (path, required, string): The step to act on. Takes only a run's `steps[].id` from `GET /v1/flows/{id}`. Unlike the other step endpoints, it doesn't take a `stepId`. It names the run that failed, which is why this parameter is named `{stepExecId}`.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/reopen`: Reopen a step (manager)

**Acting as a flow manager.** Sends a finished step back so its assignee can change what they submitted. The step returns to `IN_PROGRESS` and they are notified again. With `sendBackTo: "preparers"` it goes back to the people preparing it instead (the step returns to `PREPARING`), from a finished step or one still with its assignee.

**Or as a participant whose role can reopen completed actions.** A personal access token of someone in a role with **Can reopen completed actions** (and the organization's **Advanced participant permissions** on) may reopen a finished step they can see on a running flow, except a payment or a signature step. It goes back to whoever did it: `sendBackTo: "preparers"` stays a flow manager's and returns `403 SEND_BACK_MANAGER_ONLY`. Any other step returns `403`.

**Every step after it starts over.** The later steps that started or finished go back to waiting, and run again once this step is done again. Three kinds stay as they are: a payment already taken, a signature step everyone signed (one signed part of the way waits with its signatures), and a step a person removed from the flow.

`stepId` is `steps[].id` or `steps[].stepId`. Either works when the step ran once. When the step runs once for each item, every copy shares `stepId`, so that shared id returns `409 AMBIGUOUS_STEP` and reopens nothing. Send `steps[].id` for the copy you want.

**A step that closed at its due date** (`closeAtDue` in its settings) reopens only for a flow manager; a participant gets `403 REOPEN_CLOSED_ACTION_MANAGER_ONLY`.

**An action that has finished stays finished.** A step in a one-off action (`kind: "action"`) whose action has completed returns `409 ACTION_ENDED`: send it to someone else instead. A step in an action that is still open can be sent back as before.

**A step that reopens but cannot start** returns `409 REOPENED_STEP_FAILED`: the reopen happened, and the step is now `FAILED` with the reason on the step (a signature step whose signing document can't be opened, say). Fix what the message names. A failed signature step starts over when a step before it is reopened (to send a new document, for example).

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes doesn't reopen the step a second time, and gets the same answer, `409 REOPENED_STEP_FAILED` included.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id is accepted only while exactly one run has it; once a step has more than one run, it returns `409 AMBIGUOUS_STEP` and reopens nothing.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: ReopenStepRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACTION_ENDED`, `AMBIGUOUS_STEP`, `REOPENED_STEP_FAILED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `PUT /v1/flows/{id}/steps/{stepId}/custom-status`: Set a step status

**Acting as a flow manager.** Puts one of the template's own step statuses (like "Awaiting counterparty") on an open step, or takes it off with `status: null`. The status shows beside the step's `status` to everyone who sees the step; it never changes `status`. Send the status's `key` from the template's `stepStatuses` (`GET /v1/templates/{id}`) or from a step's `customStatus.key`.

**It belongs to the step's current round.** Reopening the step, or a loop running it again, clears it.

**Or as a participant whose role can update step statuses.** A personal access token of someone in a role with **Can update step statuses** may set it on an open step they can see. Any other step returns `403`.

A key the flow's template doesn't list returns `400 UNKNOWN_STEP_STATUS`; a step that hasn't started or is finished, `409 STEP_NOT_OPEN`; a flow that isn't running, `409 FLOW_NOT_RUNNING`; an organization whose plan doesn't have Custom step statuses, `403 FEATURE_DISABLED`. Setting the status the step already has changes nothing.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes answers with the step's status as it is then.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The step's status after the call.
- `400` (ErrorResponse): Refused: `UNKNOWN_STEP_STATUS`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FLOW_NOT_RUNNING`, `STEP_NOT_OPEN`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/flows/{id}/steps/{stepId}/force-complete`: Force-complete a step (manager)

**Acting as a flow manager.** Closes the step for the assignee, usually because they are unavailable or the work happened outside Moxo. Records `forceCompleted=true` with your reason, so the audit trail shows that a flow manager closed it instead of the assignee finishing it. Use `/complete` when the assignee really did the work. Send `resultData` to record the step's result, in the same shape as `/complete`, keyed by field id. Fields may be left blank, but every key must be a field of the step and every value one its field can hold, or the call returns `400 VALIDATION_FAILED` and nothing changes; a body key this call doesn't take is refused the same way. A force-complete names the person who closed the step, so an organization API key gets `403 ORG_KEY_NOT_SUPPORTED` before anything else is checked: use a flow manager's personal access token. A step the flow hasn't reached yet returns `409 STEP_NOT_REACHED`: a step is not closed by hand out of order. A step with a reviewer still goes to its reviewer, who approves it or asks for changes; send `skipReview: true` to complete it now without its review. `data.outcome` says which happened: `completed` or `sent_to_review`; a step that could not go to its reviewer yet returns `409 STEP_NOT_SENT_TO_REVIEW` (read it again). A step already with its reviewer returns `409 STEP_AWAITING_REVIEW` unless you send `skipReview: true`. Returns 403 if you don't manage the flow, `409 ALREADY_COMPLETED` if the step was completed first by someone else, `409 FOR_EACH_SOURCE_UNRESOLVABLE` for a For each step that still cannot read the list it repeats over (skip it, or fix its list and retry), `409 SUB_FLOW_OPEN` for a sub-flow step the flow waits for while its sub-flow is still running or paused (finish or cancel the sub-flow first; `error.details` has `childFlowId`, `childFlowName` and `remainingActions` when you can open the sub-flow, else `null`, and `templateName`), and `409 STALE_ACTION` if the step changed while it was being closed (on a document collaboration, a side sent a newer version); re-read the flow and retry.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Request body**

- `application/json`: ForceCompleteStepRequest

**Responses**

- `200` (object): What happened to the step.
- `400` (ErrorResponse): Refused: `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_COMPLETED`, `FOR_EACH_SOURCE_UNRESOLVABLE`, `STALE_ACTION`, `STEP_AWAITING_REVIEW`, `STEP_NOT_REACHED`, `STEP_NOT_SENT_TO_REVIEW`, `SUB_FLOW_OPEN`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/close-now`: Close a step now (manager)

**Acting as a flow manager.** For a form or file request that closes at its due date (`closeAtDue` in its settings): closes it now, exactly as its close would. A form keeps every valid answer saved so far, a file request every uploaded file, and the flow moves on (a step with a reviewer goes to its reviewer). The people who submitted count as done; the rest are no longer needed. `data.outcome` is `completed` or `sent_to_review`. A step that has no close, or isn't open, returns `409 ACTION_NOT_OPEN`; one with its reviewer, `409 STEP_IN_REVIEW`; a paused flow, `409 FLOW_PAUSED`. Returns 403 if you don't manage the flow.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id means the run in progress; while more than one run is open, the call returns `409 AMBIGUOUS_STEP` instead of guessing.

**Responses**

- `200` (object): What happened to the step.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ACTION_NOT_OPEN`, `FLOW_PAUSED`, `STEP_IN_REVIEW`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/meeting/cancel`: Cancel a booked meeting

For a Time Booking step that booked a meeting: cancels it before it starts. The host's calendar event is canceled first, which frees the time (and a meeting room booked on it) and tells the guests; if the calendar can't be reached nothing changes and the call returns `409 CALENDAR_RECONNECT_NEEDED` or `503 CALENDAR_UNAVAILABLE`. Then the meeting reads `Canceled` in the step's `meet.status` output, its reminders stop, and its Zoom, Teams or Moxo meeting is removed where Moxo can (`data.onlineMeeting`). When the step is set to end the flow (`onMeetingCanceled: end_flow`) the flow is canceled too. A flow's managers can cancel; with the step's `bookerCanCancel`, so can the host and an internal user who booked. Returns `409 MEETING_NOT_BOOKED`, `409 MEETING_ALREADY_CANCELED` or `409 MEETING_STARTED` when there is nothing to cancel, `409 MEETING_CANCEL_BOOKING_TOO_OLD` for a meeting booked with no calendar before Moxo kept who to tell, and 403 `MEETING_CANCEL_FORBIDDEN` otherwise.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id is accepted only while exactly one run has it; once a step has more than one run, it returns `409 AMBIGUOUS_STEP` and cancels nothing.

**Responses**

- `200` (object): The meeting is canceled.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CALENDAR_RECONNECT_NEEDED`, `MEETING_ALREADY_CANCELED`, `MEETING_CANCEL_BOOKING_TOO_OLD`, `MEETING_NOT_BOOKED`, `MEETING_STARTED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `CALENDAR_UNAVAILABLE`. The description says when; `error.code` says which.

### `GET /v1/flows/{id}/steps/{stepId}/meeting/slots`: List free times to move a booked meeting to

For a Time Booking step that booked a meeting: the host's free times on one day, under the step's booking rules (its hours, booking buffer and length), with the meeting's own time not counted as busy and a booked meeting room free too. Who may read them is who may reschedule: a flow's managers, and with the step's `bookerCanReschedule`, the host and an internal user who booked (403 `MEETING_RESCHEDULE_FORBIDDEN` otherwise). Returns `409 MEETING_RESCHEDULE_NOT_SUPPORTED` for a Calendly or Zoom Scheduler booking, `409 MEETING_RESCHEDULE_BOOKING_TOO_OLD` for a booking made before Moxo kept its host and calendar, and `409 MEETING_RESCHEDULE_NO_HOURS` when the booking has no hours or calendar to read.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id is accepted only while exactly one run has it; once a step has more than one run, it returns `409 AMBIGUOUS_STEP` and moves nothing.
- `date` (query, required, string): The day, `YYYY-MM-DD`.
- `timezone` (query, required, string): The IANA time zone the day is read in, such as `Asia/Kuala_Lumpur`.

**Responses**

- `200` (object): The host's free times on that day.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `MEETING_RESCHEDULE_BOOKING_TOO_OLD`, `MEETING_RESCHEDULE_NOT_SUPPORTED`, `MEETING_RESCHEDULE_NO_HOURS`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{id}/steps/{stepId}/meeting/reschedule`: Reschedule a booked meeting

Moves a Time Booking step's booked meeting to one of the free times List free times offers, before it starts. The same calendar event on the host's calendar moves and the guests get the calendar's update; if the calendar can't be reached nothing changes (`409 CALENDAR_RECONNECT_NEEDED`, `503 CALENDAR_UNAVAILABLE`), and an event deleted from the calendar is never recreated (`409 MEETING_NOT_ON_CALENDAR`). Then `meet.startTime` and `meet.endTime` give the new time, `meet.status` reads `Rescheduled`, the reminder is replaced, the people who got Meeting confirmed get Meeting rescheduled, and a separate Zoom, Teams or Moxo Meet meeting moves where Moxo can (`data.onlineMeeting`). A time that is no longer free returns `409 MEETING_TIME_NOT_FREE`; the time it already has, `409 MEETING_SAME_TIME`. While someone else moves or cancels it, `409 MEETING_CHANGE_IN_PROGRESS`; if the step changed during the move, the event is moved back and the call returns `409 MEETING_CHANGE_STEP_CHANGED`. A flow's managers can reschedule; with the step's `bookerCanReschedule`, so can the host and an internal user who booked.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string): The step to act on. Takes either id from `GET /v1/flows/{id}`: `steps[].stepId`, which names the step on the flow and exists before it starts, or `steps[].id`, which names one run of it. A bare step id is accepted only while exactly one run has it; once a step has more than one run, it returns `409 AMBIGUOUS_STEP` and moves nothing.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The meeting moved.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CALENDAR_RECONNECT_NEEDED`, `MEETING_CHANGE_IN_PROGRESS`, `MEETING_CHANGE_STEP_CHANGED`, `MEETING_NOT_ON_CALENDAR`, `MEETING_SAME_TIME`, `MEETING_TIME_NOT_FREE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `CALENDAR_UNAVAILABLE`. The description says when; `error.code` says which.

### `GET /v1/flows/{flowId}/steps/{stepId}/attachments`: List attachments for a step (manager)

**Acting as a flow manager.** Lists everything this step shows its assignee as reference material, whether it came from the template or was added to this flow later.

Entries with `removable: false` can't be changed on this flow. Either they came from the template the flow started from, or they are a `dynamic` reference to whatever an earlier step produced, which is a different file on every run and has no fixed file id.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step's template id (`step-2`) or its execution id; both name the same step. A step inside a loop is the exception, and neither id works there. Attachments belong to the step, and every copy of a looped step is the same step, so adding or removing one would change what every copy shows. Both id forms return `409 STEP_REF_AMBIGUOUS`.

**Responses**

- `200` (object): The step's attachments.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{flowId}/steps/{stepId}/attachments`: Upload an attachment to a step (manager)

**Acting as a flow manager.** Gives the step's assignee something to consult, a document or a web link, shown to them as **Reference materials** on the step.

Use this endpoint when each run of a flow needs its own documents. It works on a step that has not started, so the usual pattern is: start the flow, then attach this run's document to the step that will need it. By the time the assignee gets there, it is waiting for them.

**This is not `POST .../steps/{stepId}/files`**, which uploads the assignee's own submission, visible only to whoever uploaded it. A file you put there is one the assignee never sees.

**To attach a file, send it directly.** Use `multipart/form-data` with the file in a part named `file`. That is the whole call: the response is the finished attachment, with `fileName` and `fileSize`, and there is nothing to upload afterwards. A file sent this way is checked for safety as part of the call, so it can be at most 100 MB. For a larger file, use the JSON form below, which allows up to 2 GB because the bytes go straight to storage. An empty file (0 bytes) is refused with `400 EMPTY_FILE`.

```
curl -X POST "$MOXO/v1/flows/$FLOW/steps/$STEP/attachments" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@engagement-letter.pdf"
```

**The two-step upload also works.** A JSON body of `{kind:"file", fileName, fileSize, mimeType}` returns upload details instead: `PUT` the bytes to `uploadUrl` with every header in `requiredHeaders` exactly as given, then `POST` to `completionUrl` if one is returned. Prefer the form upload above: with the two-step upload, a file whose bytes never arrive stays invisible to everyone, with no error.

Each file attachment is separate. Two documents can share a name, so a repeated call adds a second attachment instead of replacing the first. If a call times out and you aren't sure whether it went through, list the step's attachments and delete the extra one by its id. Repeating a **link** that is already on the step changes nothing and returns `200` instead of `201`.

A step can hold 20 attachments. Refusals: `400 STEP_TYPE_NO_ATTACHMENTS` for a step type that shows its assignee no reference materials (automations, controls and document review steps, whose document has its own place); `409 STEP_ALREADY_FINISHED` for a step nobody will act on again. An approval's, a decision's or an acknowledgement's files are what the person decides on or acknowledges: after the first answer they are refused as editing the step is (`409 STEP_ALREADY_ANSWERED` or `400 ACK_ALREADY_ACKNOWLEDGED`, with `error.details.lockReason` and `error.details.stepId`).

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step's template id (`step-2`) or its execution id; both name the same step. A step inside a loop is the exception, and neither id works there. Attachments belong to the step, and every copy of a looped step is the same step, so adding or removing one would change what every copy shows. Both id forms return `409 STEP_REF_AMBIGUOUS`.

**Request body**

- `multipart/form-data`: object
- `application/json`: AddStepAttachmentRequest

**Responses**

- `200` (object): The link was already on the step, so nothing was added: `attachmentId` names the existing entry. A link is the same entry when its URL is.
- `201` (object): The attachment was added.
- `400` (ErrorResponse): Refused: `ACK_ALREADY_ACKNOWLEDGED`, `EMPTY_FILE`, `STEP_TYPE_NO_ATTACHMENTS`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `STEP_ALREADY_ANSWERED`, `STEP_ALREADY_FINISHED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flows/{flowId}/steps/{stepId}/attachments/{attachmentId}`: Delete an attachment (manager)

**Acting as a flow manager.** Stops showing this reference material to the step's assignee. A file uploaded to this flow is deleted with it.

Material from the template can't be removed here (`409 ATTACHMENT_NOT_REMOVABLE`). Change the template so new flows leave it out; a running flow keeps what it started with.

If two entries point at the same address, they share an id, and removing one would be a guess. That returns `409 AMBIGUOUS_ATTACHMENT` instead. Give them different addresses in the template to tell them apart.

An approval's, a decision's or an acknowledgement's files are refused after the first answer, as editing the step is (`409 STEP_ALREADY_ANSWERED` or `400 ACK_ALREADY_ACKNOWLEDGED`, with `error.details.lockReason` and `error.details.stepId`).

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step's template id (`step-2`) or its execution id; both name the same step. A step inside a loop is the exception, and neither id works there. Attachments belong to the step, and every copy of a looped step is the same step, so adding or removing one would change what every copy shows. Both id forms return `409 STEP_REF_AMBIGUOUS`.
- `attachmentId` (path, required, string): The `id` from the step's list of attachments. For a document, this is its file id.

**Responses**

- `200` (object): The attachment was removed.
- `400` (ErrorResponse): Refused: `ACK_ALREADY_ACKNOWLEDGED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `AMBIGUOUS_ATTACHMENT`, `ATTACHMENT_NOT_REMOVABLE`, `STEP_ALREADY_ANSWERED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flows/{flowId}/steps/{stepId}/document`: Replace the document on a step (manager)

**Acting as a flow manager.** Replaces the PDF that a **PDF Form**, **E-Sign** or **Document Review** step is built around, on a running flow.

Use it to give each run its own document. The usual pattern: publish a template with a blank form, start a flow, then send that person's copy of the form, already filled in with their details. When the assignee opens the step, their own document is waiting.

**Send the file directly.** This takes `multipart/form-data` with the PDF in a field named `file`, and returns the finished result. There is no upload URL to call afterwards and nothing to poll.

**The same call adds a document to a step that has none yet**, such as a step waiting for someone to prepare it.

**What happens to the fields.** On an **E-Sign** step the signature fields are kept exactly where they were, because they are positions on a page and nothing about them can be recovered from a different PDF. Send a document with the same layout as the one it replaces. On a **PDF Form** step the fields are matched up by their name inside the PDF: settings you configured (the label, whether it is required, who fills it, what it prefills from) carry across, and the response tells you which fields the new document added or dropped. A **Document Review** step has no fields. The new PDF replaces the one under review.

**When.** In the window Moxo's step editor changes the step in: a PDF Form or E-Sign step until the person doing it submits it, a **Document Review** step until it starts (before anyone can have commented on or reviewed the file). A later step returns `STEP_NOT_EDITABLE` (409). The document a replacement takes the place of stays a file of the flow.

**One writer.** The new document is put on the step by Moxo's step editor, the same one Edit a step and the app use, so the checks, the signer emails and the record (one "document replaced" entry) are the same. If the document can't be put in place (what the person doing the step is shown could not be updated, or the signing document could not be rebuilt), the step keeps its previous document and signing files and the call returns `500 DOCUMENT_REPLACE_FAILED` or `500 ESIGN_REINIT_FAILED`. Try again.

**Refusals.** `ESIGN_ALREADY_SIGNED` (409) once anyone has signed. From that moment the document is a signed record and cannot be swapped. `ESIGN_PREPARER_PLACED` (409) while a preparer's placed signing fields exist on an e-sign step: they sit on the document they were placed on, so it stays. `ESIGN_SOURCE_DOCUMENT_LOCKED` (409) when the template turned on Prevent PDF replacement for this e-sign step. Later signature steps placed their fields on that PDF, so it stays as it is for the whole flow. `STEP_NOT_EDITABLE` (409) for a step past its window. `STEP_REF_AMBIGUOUS` (409) when the step runs once per item. `STEP_TYPE_NO_DOCUMENT` (400) for a step that is not built around a document, naming what to do instead. `DOCUMENT_UNREADABLE` (400) when the PDF cannot be opened. `UNSUPPORTED_FILE_TYPE` (415) for anything that is not a PDF. `FILE_TOO_LARGE` (413) above 20 MB. `FILE_INFECTED` (422) if the file fails its safety check, in which case nothing was stored and nothing on the step changed. `SCAN_UNAVAILABLE` and `SCAN_BUSY` (503) when the safety check can't run. `SIGNING_BUSY` (503) when someone is signing at the same moment. `DOCUMENT_REPLACED` (409) when someone else saved a different file while yours was saving. The step keeps their file. Look at the step and send yours again if it is still the one you want.

**Everyone signing gets told.** Replacing the document on an E-Sign step that has already been sent out replaces the links the signers are holding, since those point at the old document, and emails them a fresh one. The email goes out through Moxo's notification queue, which retries delivery.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:write`

**Parameters**

- `flowId` (path, required, string)
- `stepId` (path, required, string): Either the step's template id (`step-2`) or its execution id; both name the same step. A step inside a loop is the exception, and neither id works there. The document belongs to the step, and every copy of a looped step is the same step, so replacing it would change what every copy shows. Both id forms return `409 STEP_REF_AMBIGUOUS`.

**Request body**

- `multipart/form-data`: object

**Responses**

- `200` (object): The document was replaced.
- `400` (ErrorResponse): The file or the step cannot take this document. `NO_FILE` when the form field is missing. `DOCUMENT_UNREADABLE` when the PDF cannot be opened. `STEP_TYPE_NO_DOCUMENT` when this step is not built around a document.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): The step can't be changed. `STEP_NOT_EDITABLE` when it is past the window its document changes in. `ESIGN_ALREADY_SIGNED` when someone has signed. `ESIGN_PREPARER_PLACED` when a preparer placed the signing fields on this document. `ESIGN_SOURCE_DOCUMENT_LOCKED` when the template prevents replacing this PDF. `STEP_REF_AMBIGUOUS` when several copies share this step. `DOCUMENT_REPLACED` when someone else saved a different file first.
- `413` (ErrorResponse): The PDF is larger than 20 MB (`FILE_TOO_LARGE`).
- `415` (ErrorResponse): The file is not a PDF (`UNSUPPORTED_FILE_TYPE`).
- `422` (ErrorResponse): The file failed its safety check (`FILE_INFECTED`). Nothing was stored and the step is unchanged.
- `429` (ErrorResponse): Too many requests.
- `500` (ErrorResponse): Refused: `DOCUMENT_REPLACE_FAILED`, `ESIGN_REINIT_FAILED`. The description says when; `error.code` says which.
- `503` (ErrorResponse): Try again. `SCAN_UNAVAILABLE` or `SCAN_BUSY` when the safety check cannot run. `SIGNING_BUSY` when someone is signing this document.

### `GET /v1/steps`: List steps across flows

Returns step runs across every flow you can see, newest first, narrowed by flow, name, status, due date, start time, account, or whether they are overdue or were reopened. Use it for questions such as "what is overdue?" or "which approval steps are open?". For the steps waiting on you, use `GET /v1/users/me/steps`.

A personal access token sees the steps of the flows on its person's Flows list, as each flow's page shows them, and `name` matches the names they see. An organization API key sees every step.

Each call reads up to 1,000 steps to fill its page, so a page can be empty while `hasMore` is `true`: keep sending `nextCursor` as `cursor`, with the same filters, until it is `null`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read`

**Parameters**

- `flowId` (query, string): Only the steps of this flow.
- `name` (query, string): Only steps whose name, as you see it, contains this text. Not case-sensitive.
- `status` (query, string): Only steps in this status.
- `customStatus` (query, string): Only steps with this step status: its `key` from the template's `stepStatuses`, the same across every template that uses the key. Matches nothing when the organization's plan does not have Custom step statuses.
- `isOverdue` (query, boolean): `true` for open steps past their due date.
- `hasReopens` (query, boolean): `true` for steps reopened at least once.
- `dueBefore` (query, string): Only steps due on or before this time (ISO 8601).
- `startedAfter` (query, string): Only steps that started on or after this time (ISO 8601).
- `accountId` (query, string): Only steps of flows for this account.
- `limit` (query, integer): Steps per page, 1 to 100. Defaults to 25.
- `offset` (query, object): Matching steps to skip, up to 10,000. Use `cursor` for the next page instead: each call reads at most 1,000 steps past the offset.
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the first page.

**Responses**

- `200` (object): A page of steps.
- `400` (ErrorResponse): A query parameter is not valid (`VALIDATION_FAILED`), or `cursor` is not one this list issued (`INVALID_CURSOR`).
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/users/me/steps`: List the steps waiting on you

Returns the steps waiting on you now: the same list as **Your actions** in the app, in its order (overdue first, then soonest due, then most recent activity). It includes steps you prepare or review and steps you cover for someone who is away, and each says why it is yours in `seat`. Steps a desk could give you are not in it until you have them.

Needs a personal access token: an organization API key is not a person, so it gets `403 PERSON_TOKEN_REQUIRED`. Page with `cursor`: send the previous page's `nextCursor` as it is.

**Tokens:** personal access token

**Parameters**

- `limit` (query, integer): Steps per page, 1 to 200. Defaults to 50.
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the first page.

**Responses**

- `200` (object): A page of the steps waiting on you.
- `400` (ErrorResponse): A query parameter is not valid (`VALIDATION_FAILED`), or `cursor` is not one this list issued (`INVALID_CURSOR`).
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Actions

Send one request to a person outside any flow, such as a signature, an approval, a form or a file, then list them, remind people and cancel them. These are not a flow's steps, which are under Flows and Steps.

### `GET /v1/actions`: List actions

Returns every action your organization has sent or received: a signature, an approval, a form or a file. Flows are not listed here; they are on `/v1/flows`.

You see only what you may see. `scope=all` returns the whole organization only to a caller who can see every action in it; anyone else gets the actions they have a part in: sent, asked, preparing or reviewing, as the Actions page shows them.

Actions must be on for your organization's plan (`403 FEATURE_DISABLED`, `error.feature: "actions"`), for every caller.

**Tokens:** personal access token, organization API key
**Scope required:** `actions:read`

**Parameters**

- `scope` (query, string): Which actions to return: `waiting_on_them` is what you asked of others and are still waiting for, and `waiting_on_me` is what others asked of you. Defaults to `all`.
- `q` (query, string): Text to search for in the title.
- `limit` (query, integer)
- `offset` (query, object)

**Responses**

- `200` (object): A page of actions
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/actions`: Send an action

Sends one request to one or more people, such as a signature, an approval, a form or a file. They get an email with a link and need no account, portal or app. When it is answered, they get a copy, and both sides keep the record. Sent from no conversation, Actions must be on for your organization's plan (`403 FEATURE_DISABLED`, `error.feature: "actions"`); sent into a conversation, its own features decide instead (below).

No template or setup is needed. The email comes from your organization. The action belongs to the person behind the token: it is on their Actions list, and they can remind people about it or cancel it.

To send it in a group conversation, as Request in a conversation does in Moxo, name the conversation in `conversationId`. It is then listed in the conversation (`GET /v1/conversations/{id}/actions`), and the conversation's rules apply instead of the permission to send actions: the token's person must be in the conversation (otherwise `404`), it must not be archived (`409 CONVERSATION_UNAVAILABLE`), everyone asked must be in it (`400 ASSIGNEE_NOT_IN_CONVERSATION`), and where your organization lets only conversation managers send actions, the person must be one (`403 ACTIONS_LIMITED_TO_MANAGERS`). Your plan must include group conversations and actions in them (`403 FEATURE_DISABLED`).

What runs once the action is done is `config.automations`: an app (`kind: "app"`) or an agent (`kind: "agent"`). An AI instruction (`kind: "ai"`) is no longer taken (`400 AUTOMATION_AI_INSTRUCTION_RETIRED`).

**An hourly limit.** One person can send 20 actions an hour into each conversation, and 20 from no conversation. Past it, the call returns `429 TOO_MANY_REQUESTS` with `Retry-After`: `error.limit` is the number an hour, `error.home` is where they were counted (`conversation` or `standalone`), `error.retryAt` is when sending works again, and `error.retryAfterSeconds` is the wait.

**Idempotent.** An action emails the people asked, so send an `Idempotency-Key` header to make retries safe: a retry with the same key within 10 minutes answers the action the first call sent, and nobody is asked twice. See Idempotency in the Introduction.

**Products.** An organization without the Actions product can't send new actions: the response is `403 FEATURE_DISABLED` with `error.feature: "haiActions"`. An organization that sends actions in its chats today keeps doing so, and actions already sent carry on.

**Tokens:** personal access token

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: CreateAction (required)

**Responses**

- `201` (object): The action, as sent
- `400` (ErrorResponse): Refused: `ASSIGNEE_NOT_IN_CONVERSATION`, `AUTOMATION_AI_INSTRUCTION_RETIRED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONVERSATION_UNAVAILABLE`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/actions/{id}`: Get action

Returns one action: who it went to, where each of them stands and whether each has opened it.

Actions must be on for your organization's plan (`403 FEATURE_DISABLED`, `error.feature: "actions"`), for every caller.

**Tokens:** personal access token, organization API key
**Scope required:** `actions:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The action
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/actions/{id}/remind`: Send a reminder

Reminds everyone who hasn't answered. Nobody who has answered is contacted.

This sends one reminder now, on top of the action's own reminders: your organization's defaults (Settings → Defaults), or the schedule set when it was sent.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): How many people were reminded
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/actions/{id}/cancel`: Cancel an action

Withdraws an action, as **Delete** does in the app. It is removed from every list and read: a later `GET /v1/actions/{id}` answers 404, and so does a second cancel. When it was still open (or paused), it is also canceled, so the people it was sent to are told it was withdrawn: `cancelled: true`. When it was already done, nothing more happens to it and nobody is told: `cancelled: false`. `deleted` is always `true`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): What happened to the action.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Templates

Read, publish, version and manage templates: the processes flows are started from. To create a template or change its steps, see Build templates.

### `GET /v1/templates`: List templates

Returns the templates the caller can see. With a personal access token, the person needs permission to view templates or to start flows, as for the template list in the app; without either, the response is `403`. An organization API key needs the `templates:read` scope.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `status` (query, string)
- `search` (query, string)
- `kind` (query, string): Which kind of template to list. Defaults to `process`. Send `action` for saved requests. An `action` template is one saved request with its wording and the people it asks for, named by their place (for example Client). You choose who fills each place every time you send it. Send those with `POST /v1/actions`; `POST /v1/templates/{id}/start` accepts process templates only and returns `400 WRONG_TEMPLATE_KIND` for an action template. Every row has `kind`, so a list you filter yourself is never ambiguous.
- `uses` (query, string): Only templates that use this, as `<kind>:<id>`: `connection:<id>` (an app account, AI provider, Secret or MCP server from `GET /v1/connections`), `agent:<id>`, `data_table:<id>`, `template:<id>` (a template this one starts or includes; each says how in `startedByKind`: `sub_flow`, `start_flow`, `scheduled` or `building_block`), or `host:<name>` (an address that a REST API step, an outgoing webhook or a monitor that fires a webhook calls). Each row then adds `runningFlows`, the unfinished flows from that template whose steps use it; `uses`, those steps; and `canEdit`, whether you can change the template. A template whose current version no longer uses it is still listed, with an empty `uses`, while flows run an earlier version that does. Templates you can't open are left out, and flows you can't open are not counted. An organization API key sees what an admin sees. An id that names nothing you can see returns `404 NOT_FOUND`, naming the parameter; a malformed value returns `400`. With `updatedSince`, it narrows the list of changes to the templates that use it, on the same cursor.
- `updatedSince` (query, string): Only templates published at or after this time; saving a draft is not a change. Rows come oldest publish first, each with its `lastChangedAt`. Page with `cursor`: send `pagination.nextCursor` back as it is, with the same filters, and keep the last one for your next run. Delivery is at least once: a template can repeat within 5 minutes of your previous run’s end. Rarely, a change is missed: one saved by a background process in Moxo that ran longer than 5 minutes, or by any save that ran longer than 15 minutes.
- `cursor` (query, string): The `pagination.nextCursor` of the previous page, with the same filters: of an `updatedSince` list, or of a list paged with `limit`.
- `limit` (query, number): Templates per page, 1 to 100; defaults to 50 on a paged list. Without `updatedSince`, sending `limit` or a `cursor` pages the list newest created first, and every template is reachable however many there are. Without either, the list is not paged and stops at 500 templates.

**Responses**

- `200` (object): List of templates. With `updatedSince`, `limit` or `cursor`, the response adds `pagination: { limit, hasMore, nextCursor }`.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}`: Get a template

Returns the full template: its steps, roles, milestones and flow fields.

**Steps inside other steps.** `steps[]` is the top level. A step that contains others keeps them in its own `config`, each a full step, at any depth: `SINGLE_CHOICE_BRANCH`, `MULTI_CHOICE_BRANCH` and `PARALLEL_BRANCH` in `config.paths[].steps`; `DECISION` in `config.outcomes[].steps`; `APPROVAL` in `config.approveBranch.steps` and `config.rejectBranch.steps`; `FOR_EACH` and `REPEAT_WHILE` in `config.steps`. To visit every step in the order the builder shows them:

```js
function* walk(steps) {
  for (const s of steps) {
    yield s;
    const c = s.config ?? {};
    for (const lane of [...(c.paths ?? []), ...(c.outcomes ?? [])]) yield* walk(lane.steps ?? []);
    for (const b of [c.approveBranch, c.rejectBranch]) if (b) yield* walk(b.steps ?? []);
    if (s.type === 'FOR_EACH' || s.type === 'REPEAT_WHILE') yield* walk(c.steps ?? []);
  }
}
```

What each step's `config` keys mean is in its `StepConfig_<TYPE>` component, or `get_build_context` view `action_types` on the MCP server.

**Where the settings are.** Each step's settings are in `steps[].config`, at every depth. A step with nothing beyond its name, assignees and completion has an empty `config`. `definition` is deprecated: it repeats `customFields[]`, which you should read instead. To change a template, send a list of changes to `POST /v1/templates/{id}/changes`. Some settings are sent in a different form from the one `config` returns: see [Build templates from code](/docs/guides/build-templates-from-code).

**Secrets.** A Secret's value is never returned. A step names the Secret it signs in with by id, and `GET /v1/connections` lists connections and Secrets by name and id. A credential typed into a step instead of a Secret is removed from every response. That includes a key in an address: the sign-in part of a URL, a query parameter named like a credential (such as `api_key`, `token`, `code` or `sig`), or a query value shaped like a known key. An address that is itself the secret, such as a Slack, Teams, Discord or Zapier webhook or an address with a key in its path, reads `null`. The step names the setting in `typedInCredentials`. For a short, readable summary of a template, use `GET /v1/templates/{id}/outline`.

**What a template uses.** Send `expand=dependencies` to add `dependencies[]` instead of walking the steps yourself. This is not `dependsOnStepIds`, which lets a step start sooner.

**Which copy.** The read answers the published copy, what a start uses (`copy: "published"`). Someone who may change the template sends `copy=working` for the working copy, the one `POST /v1/templates/{id}/changes` changes, with its `draftRevision` to send as `baseVersion`: any part of it sent back unchanged changes nothing. Only a working read carries `draftRevision`, so a change is always made on the working copy. Anyone else asking for it answers `403 WORKING_COPY_NOT_ALLOWED`. A template never published has only its working copy, which the read answers.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)
- `expand` (query, string): `dependencies` adds `dependencies[]`: every connection (an app account, AI provider, Secret or MCP server), AI agent, data table, sub-template and outside address the template uses, each with the steps that use it in `actions[]`. An AI agent lists the connections its tools use in `uses[]`. Connections and Secrets come by name and id, never a credential, and with a name only when you can see it in the app. An address built from an answer in the flow has `host: null` and `dynamic: true`. Any other value returns `400`.
- `copy` (query, string): `published` (the default): the published copy, what a start uses. `working`: the working copy, the one the change list changes, with its unpublished changes and its `draftRevision`. For someone who may change the template; anyone else answers `403 WORKING_COPY_NOT_ALLOWED`.

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/templates/{id}`: Update template info

Updates a template's name and description. To change its steps, roles or milestones, use Build templates: `POST /v1/templates/{id}/changes`. Sending the name and description it already has changes nothing: the answer says `changed: false`. While someone else is editing the template in Moxo, the call answers `409 TEMPLATE_BEING_EDITED` and changes nothing: `error.editingBy` names them, and editing frees up after 5 minutes without activity. The editor's own token is never refused for this.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `TEMPLATE_BEING_EDITED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/templates/{id}`: Delete a template

Deletes the template. It disappears from every list and read (`GET /v1/templates/{id}` returns 404), it can't be restored through the API, and no new flow can start from it. This is not archiving: an archived template can be brought back, a deleted one can't.

Flows already running from it keep running to the end. Its schedules, its incoming webhook, its start link and its place in portal catalogs are removed; its version history is kept.

**Two calls when work depends on it.** If the template still has running flows, active schedules or data table triggers, the first call deletes nothing and returns `requiresConfirmation: true` with the counts. Repeat it with `?force=true` to delete. Without such work, the first call deletes and returns `{ "deleted": true }`.

Only an organization admin or one of the template's owners can delete it (403 otherwise). Needs a personal access token: an organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`, because the audit trail records the person who deleted it.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `force` (query, string): Deletes the template even when flows are running, or when schedules or data table triggers would stop.

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/archive`: Archive a template

Archives the template: it leaves the template lists (`GET /v1/templates?status=ARCHIVED` lists it), no new flow can start from it, and it leaves every portal catalog. Flows already running keep running. A template already archived returns `409 CONFLICT`. Bring it back with `POST /v1/templates/{id}/unarchive`. No body. Returns the template.

Only an organization admin or one of the template's owners can archive it (403 otherwise). Needs a personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONFLICT`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/unarchive`: Unarchive a template

Brings an archived template back to the template lists, as a draft (`status: "DRAFT"`): publish it (`POST /v1/templates/{id}/publish`) before flows can start from it again. Add it to a portal catalog again in the app. No body. Returns the template.

Only an organization admin or one of the template's owners can unarchive it (403 otherwise). Needs a personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/template-folders`: List template folders

Returns the folders of your organization's template library, by name. Folders can hold folders, up to 5 levels deep: `parentFolderId` names the folder each one is in (null at the top level). `templateCount` counts the flow templates you can see directly in a folder; `totalTemplateCount` counts those anywhere under it. Put a template in one with `PUT /v1/templates/{id}/folder`; every template read names its `folder`. Make a folder with `POST /v1/template-folders`, and rename, move or remove one with `PATCH` or `DELETE /v1/template-folders/{id}`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/template-folders`: Make a template folder

Makes a folder in your organization's template library, as **New folder** does in Moxo: at the top level, or inside `parentFolderId`. Folders go 5 levels deep: a folder at level 5 can't hold a folder (`409 FOLDER_TOO_DEEP`), and a parent your organization doesn't have answers `404 FOLDER_NOT_FOUND`. Put templates in it with `PUT /v1/templates/{id}/folder`. Two folders may have the same name; to put a template in one of them, send its `folderId`.

Runs as the person who owns the token, with their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`. The person needs permission to create templates (`403` otherwise).

**Tokens:** personal access token

**Request body**

- `application/json`: TemplateFolderCreateBody (required)

**Responses**

- `201` (object): The folder, with no templates in it yet.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FOLDER_TOO_DEEP`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/template-folders/{id}`: Rename a template folder

Renames a folder in your organization's template library, moves it with everything in it (`parentFolderId`), or both in one change. Leave `parentFolderId` out to keep the folder where it is; send null to move it to the top level. A move into the folder itself or one of its own folders answers `409 FOLDER_CYCLE`; one that would put a folder past level 5 answers `409 FOLDER_TOO_DEEP`; a target your organization doesn't have answers `404 FOLDER_NOT_FOUND`. Nothing changes when a part is refused. A folder your organization doesn't have answers `404`.

Runs as the person who owns the token, with their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`. The person needs permission to edit templates (`403` otherwise).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The folder's id, as `GET /v1/template-folders` lists it.

**Request body**

- `application/json`: TemplateFolderChangeBody (required)

**Responses**

- `200` (object): The folder, as `GET /v1/template-folders` lists it.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FOLDER_CYCLE`, `FOLDER_TOO_DEEP`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/template-folders/{id}`: Remove a template folder

Removes a folder from your organization's template library. Nothing in it is deleted: its templates and its folders move up to the folder it was in (the top level, for a top-level folder). A folder your organization doesn't have answers `404`.

Runs as the person who owns the token, with their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`. The person needs permission to edit templates (`403` otherwise).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The folder's id, as `GET /v1/template-folders` lists it.

**Responses**

- `200` (object): The folder is gone.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/publish`: Publish a template

Publishes the draft. When the draft has changes the live version lacks, they become a new version and new flows start from it; flows already running keep the version they started on. Only published templates can have flows started from them. While someone else is editing the template in Moxo, the call answers `409 TEMPLATE_BEING_EDITED` and changes nothing: `error.editingBy` names them, and editing frees up after 5 minutes without activity. The editor's own token is never refused for this.

Send `changeNote` to say what this version changes: it is stored on the version and shown wherever the version is read. It is optional.

Returns the template, as `GET /v1/templates/{id}` returns it, with `published`: `true` when a new version was made. When the draft has nothing new, nothing is written and no version is made: `published` is `false` and `message` says so. A real publish moves the draft revision on by one, so read `draftRevision` again (from the outline or a check) before your next change. `warnings` lists what publishes but may not do what you expect, such as an escalation while escalation is off for your organization.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: PublishTemplateRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `TEMPLATE_BEING_EDITED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/duplicate`: Duplicate a template

Copies a template into a new draft, owned by the calling person. The copy takes the template's current content, including unpublished changes, with new ids for its steps, roles, milestones, paths and outcomes; its fields keep theirs, so a reference to a field reads the same in the copy. Send `name` to name the copy; without it, the copy is called "<original name> (Copy)". The body is optional and takes no other key (400 otherwise).

Returns **201** with the new template in the same shape as `GET /v1/templates/{id}`. A personal access token needs its person to be able to see the template (404 otherwise). An organization API key gets 403 `PERSON_TOKEN_REQUIRED`: a copy has an owner, and a key has no person behind it.

Each call makes a new copy, so send an `Idempotency-Key`: a retry within 10 minutes returns the first copy instead of making another.

**Products.** A new template needs the product it belongs to: a process template needs the Flow product and an action template needs the Actions product. Without it, the response is `403 FEATURE_DISABLED` with `error.feature` `"haiFlow"` or `"haiActions"`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: DuplicateTemplateRequest

**Responses**

- `201` (object): Template duplicated. `data` is the new draft.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/versions`: List template versions

Returns the template's published versions, newest first. The live version has `isCurrent: true` and is always listed; any other version is kept once a flow starts on it. Read one version's content with `GET /v1/templates/{id}/versions/{versionId}`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Version history
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/versions/{versionId}`: Get one template version

Returns one published version with its steps, roles and fields, for example to compare before a restore.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)
- `versionId` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/kept-drafts`: List kept drafts

Returns the drafts restores replaced on this template, newest first (at most 20), so a restore can be undone: restore one by its `id`. A kept draft is a draft, so only a person who can edit the template sees any; anyone else gets an empty list.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/versions/{versionId}/compare`: Compare a template version

Returns what restoring this version would change, one line per change: steps and roles only in one side, each changed step's settings, form fields, options and document fields, from the draft to the version. A person who can edit the template compares with their draft; an API key, or a person who can only view the template, compares with what is live. Send `against=live` to compare with what is live instead of your draft. `same` is true when a restore would change nothing.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)
- `versionId` (path, required, string)
- `against` (query, string): `draft` (the default) compares the version with your draft; `live` compares it with the version that is live, for example to see how it differs from what running flows start on. Only a person who can edit the template reads the draft: anyone else always gets `live`.

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/versions/{versionId}/restore`: Restore a previous version

Replaces the current draft with a previously published version. The version is not live until the template is published again. Needs a personal access token: the restore is recorded as the person's, and an organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`. Send `baseDefinitionVersion` (the draft revision you read) to have the restore refused with 409 `TEMPLATE_VERSION_CONFLICT` if someone changed the draft since: nothing is changed, and `currentVersion` is the draft revision to read again. Without it, the restore replaces the draft as it is now. Restoring the version the draft already is changes nothing: the answer says `changed: false`. A version listed with `restorable: false` returns 404. While someone else is editing the template in Moxo, the call answers `409 TEMPLATE_BEING_EDITED` and changes nothing: `error.editingBy` names them, and editing frees up after 5 minutes without activity. The editor's own token is never refused for this.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `versionId` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `TEMPLATE_BEING_EDITED`, `TEMPLATE_VERSION_CONFLICT`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/export`: Export a template

Downloads the template as an encrypted `.moxo` file, or as a `.moxo-bundle` with `?bundle=true`, which also includes the AI agents its steps use. The file moves a template into another Moxo organization, for example from a test organization to production: import it there with `POST /v1/templates/import-init` and `POST /v1/templates/import`. It is encrypted so that it can't be read or edited outside Moxo; to read a template's structure, use `GET /v1/templates/{id}`. Credentials and Secrets never leave the organization: connections are reconnected after import.

Template export must be turned on for the organization (403 otherwise). A personal access token needs edit permission on the template; `bundle=true` also needs permission to manage AI agents.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)
- `bundle` (query, string): Includes the AI agents the template uses, as a `.moxo-bundle`.

**Responses**

- `200` (string): The encrypted file, as an attachment (`Content-Disposition: attachment; filename="<name>.moxo"`).
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/import-init`: Start a template import

The first of two calls that bring an exported template file (`.moxo`, or `.moxo-bundle` with its AI agents) into this organization, for example from a test organization into production.

1. Call this with the file's name, size and type. 2. `PUT` the file's bytes to `uploadUrl` with exactly the `requiredHeaders` (and `POST` to `completionUrl` when one is returned). 3. Call `POST /v1/templates/import` with the `fileId`.

With a personal access token, the new draft is owned by its person, who needs permission to create templates (403 otherwise). An organization API key gets 403 `PERSON_TOKEN_REQUIRED`: the draft has an owner, and a key has no person behind it. Template import must be turned on for the organization (403 otherwise).

**Tokens:** personal access token

**Request body**

- `application/json`: TemplateImportUploadRequest

**Responses**

- `201` (object): Upload the file to `uploadUrl`, then call `POST /v1/templates/import`.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/import`: Import a template file

Creates a new draft template from the uploaded file, owned by the calling person. Nothing is published or started. The file can be used once.

Credentials never move between organizations, so `configWarnings` lists what to set up before publishing: connected apps and Secrets to reconnect, AI agents to choose, and email and app starts to set up. A webhook start gets a new URL and secret here. A `.moxo-bundle` also creates its AI agents as drafts (`agentIds`), which needs permission to manage AI agents and agent import turned on for the organization.

A file that is not a Moxo template export, or is an agent file, returns 400. A file whose `stepStatuses` gives two statuses the same `id` returns `400 DUPLICATE_STEP_STATUS_ID`. The file can be imported once, so send an `Idempotency-Key`: a retry within 10 minutes returns the first result again instead of an error.

With a personal access token, the new draft is owned by its person, who needs permission to create templates (403 otherwise). An organization API key gets 403 `PERSON_TOKEN_REQUIRED`: the draft has an owner, and a key has no person behind it. Template import must be turned on for the organization (403 otherwise).

**Products.** A new template needs the product it belongs to: a process template needs the Flow product and an action template needs the Actions product. Without it, the response is `403 FEATURE_DISABLED` with `error.feature` `"haiFlow"` or `"haiActions"`.

**Tokens:** personal access token

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: TemplateImportRequest

**Responses**

- `201` (object): The new draft.
- `400` (ErrorResponse): Refused: `DUPLICATE_STEP_STATUS_ID`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/templates/{id}/trigger-activation`: Turn start modes on or off

Sets which ways of starting a flow are on for the template, and which are paused: the same switch as the **Start Modes** panel in the template builder. It applies to the live template at once, without publishing, survives later saves and is recorded in the audit trail.

`supportedStartModes` is the full list of modes that are on; `MANUAL` is always on. `disabledStartModes` lists modes that are set up but paused: `START_LINK`, `WEBHOOK` or `EMAIL`. A mode can be in only one list (400 otherwise). Turning `WEBHOOK` on creates its webhook if needed (read its URL with `GET …/webhook-config`); turning `START_LINK` on gives the template a start link. `APP` starts are turned on and off for each trigger, not here.

To change one mode without restating the others, send `{ "mode": "WEBHOOK", "enabled": false }` (pause it), `{ "mode": "WEBHOOK", "enabled": true }` (turn it on) or `{ "mode": "WEBHOOK", "removed": true }` (take it out of both lists). It is applied to the lists as they are when it is written, so it never puts back a mode someone else removed. The two lists are the full replacement: send them only from a copy you just read.

Returns the template in the same shape as `GET /v1/templates/{id}`. A personal access token needs edit permission on the template (403 otherwise). Turning on a public start link is refused when the organization doesn't allow sharing outside it. On a template installed from an Archway bundle, a change answers `409 ARCHWAY_REQUIRES_DETACH_ACK` until it is sent again with the header `x-archway-detach-ack: 1`, which detaches the template.

`EMAIL` in `supportedStartModes` is the template's Start by email setting. The email start has one pause, the same as `PATCH /v1/templates/{id}/email-start`: `EMAIL` in `disabledStartModes`, or `{ "mode": "EMAIL", "enabled": false }`, pauses it and keeps Start by email on, and a read never lists `EMAIL` as paused here (read `paused` from `GET …/email-start`). `{ "mode": "EMAIL", "enabled": true }` resumes it. Putting `EMAIL` in `supportedStartModes` does not lift a pause.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object or object or object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ARCHWAY_REQUIRES_DETACH_ACK`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/email-start`: Read whether a template starts by email

Whether the template's Start by email setting is on (`startByEmail`) and whether the email start is paused (`paused`). Mail to its address starts a flow when it is on and not paused. It reads only: it creates nothing. A personal access token needs to be able to open the template (403 otherwise). The address, conditions and mapping are on `GET /v1/email-triggers?templateId=…`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/templates/{id}/email-start`: Pause or resume the email start

The same switch as **Email** under **Ways to start** in the app, and the one pause for the email start: `enabled` on `PATCH /v1/email-triggers/{id}` and `EMAIL` in `disabledStartModes` on `PATCH /v1/templates/{id}/trigger-activation` set the same pause, and any of them lifts it. `{ "paused": true }` stops the address starting flows and keeps its conditions and mapping; Start by email stays on. `{ "paused": false }` resumes it and turns Start by email on if it is off, in one change. It applies to the live template at once and is recorded in the audit trail.

A personal access token needs edit permission on the template (403 otherwise); the Configure integrations permission is not needed. Resuming needs Start by email on the organization's plan (`403 FEATURE_DISABLED` otherwise); pausing never does. Resuming on a template installed from an Archway bundle answers `409 ARCHWAY_REQUIRES_DETACH_ACK` until it is sent again with the header `x-archway-detach-ack: 1`, which detaches the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: EmailStartBody

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ARCHWAY_REQUIRES_DETACH_ACK`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

## Build templates

Build and change templates from code: see what your organization can use, create a draft from a list of changes, change it, check it, read its outline and publish it. A personal access token builds as its person. An organization API key with `templates:read` and `templates:write` builds as the organization, with administrator permissions. A test run needs a personal access token.

→ **[Read the guide: Build templates from code](/docs/guides/build-templates-from-code)**

### `POST /v1/templates`: Create a template from changes

Creates a draft template owned by you, applies the list of changes with the same checks as the template builder, then runs every publish check. All or nothing: if any change is refused, nothing is created and the response is `422` with every issue. A malformed change, such as an unknown change type or a missing or unknown field, returns `400 VALIDATION_FAILED` naming the field. The result says what changed, the id given to each `handle`, any fix made for you, each issue with where it is and how to fix it, what only a person can do, links to open the template, and an outline. Send `fromExample` to start from a gallery example. Send an `Idempotency-Key` to make a retry safe.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Products.** A new template needs the product it belongs to: a process template needs the Flow product and an action template needs the Actions product. Without it, the response is `403 FEATURE_DISABLED` with `error.feature` `"haiFlow"` or `"haiActions"`.

**Tokens:** personal access token

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): Created
- `400` (ErrorResponse): Refused: `VALIDATION_FAILED`, `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `422` (object): A change was refused and nothing was saved. `data` is the result, with every issue.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/step-types`: List step types

Returns every step type, with whether your organization's plan includes it and, when it needs one, the app a person must connect first. Read one type's settings with `GET /v1/step-types/{type}`.

A personal access token reads as its person, who needs permission to view templates. An organization API key reads with administrator permissions. A partner delegation key gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Responses**

- `200` (object): Every step type.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/step-types/{type}`: Get a step type

Returns what a step type does, its settings (the step's `config`) with your organization's plan applied, an example as changes you can send as they are, and its common mistakes. The settings include the ones step types share (name, description, assignees, due dates, monitors and the like), which this reference documents once as `StepSettings`; the type's own are its `StepSettings_<TYPE>` schema. For `EXTERNAL_APP`, send `app` to list one app's actions and their inputs. A type that does not exist returns `404 NOT_FOUND`. Follow the settings over any guide.

A personal access token reads as its person, who needs permission to view templates. An organization API key reads with administrator permissions. A partner delegation key gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `type` (path, required, string): The step type, as `GET /v1/step-types` lists it.
- `app` (query, string): For `EXTERNAL_APP`: one app's id, such as `hubspot`, to list that app's actions and their inputs.
- `detail` (query, string): `full` (the default): the settings as JSON Schema, the example step on its own and as one `add_step` change, and the rules every step follows. `concise`: each setting as one line with its type and description, and the example as changes; it leaves out `example`, `exampleChange` and `rules`, and adds `more`. Both list the settings step types share as well as the type's own.

**Responses**

- `200` (object): The step type.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/examples`: Find example templates

Describe the process you want to build and get the closest examples from Moxo's template gallery, each as a readable outline of its roles, steps, branches and deadlines. Send an example's `exampleId` as `fromExample` to `POST /v1/templates` to start a draft from it.

A personal access token reads as its person, who needs permission to view templates. An organization API key reads with administrator permissions. A partner delegation key gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `query` (query, required, string): The process you want to build, in a sentence. At least 2 characters.

**Responses**

- `200` (object): The closest examples.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/build-guides/search`: Search the guides

Ask whether Moxo can do something, or how it handles it, before you design. Returns excerpts from Moxo's product guides and product knowledge, each with its title and source, about what your organization's plan includes. Nothing is generated: when nothing matches, `found` is `false`.

A personal access token reads as its person, who needs permission to view templates. An organization API key reads with administrator permissions. A partner delegation key gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `question` (query, required, string): What you want to know, such as "can a step wait for a signature?". At least 2 characters.

**Responses**

- `200` (object): The matching excerpts.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/build-guides`: List build guides

Returns the build guides your organization can read: one per step type its plan includes (`step:<type>`), and guides on concepts, settings and publishing (`concept:<name>`, `settings:<area>`, `publish:<topic>`). Read one with `GET /v1/build-guides/{topic}`.

A personal access token reads as its person, who needs permission to view templates. An organization API key reads with administrator permissions. A partner delegation key gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Responses**

- `200` (object): The topics.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/build-guides/{topic}`: Get a build guide

Returns one build guide: a summary, examples checked against the settings schema, how it behaves when a flow runs, and common mistakes. A topic your organization cannot read, or that does not exist, returns `404 NOT_FOUND`. Follow a step type's settings (`GET /v1/step-types/{type}`) over any guide.

A personal access token reads as its person, who needs permission to view templates. An organization API key reads with administrator permissions. A partner delegation key gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `topic` (path, required, string): The topic, as `GET /v1/build-guides` lists it.

**Responses**

- `200` (object): The guide.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/changes`: Change a template

Applies a list of changes to the template's draft, as you. Live settings are the exception: permissions, start modes, notifications and reminders, the chat assistant and the cover image take effect immediately, including for running flows, and discarding the draft doesn't undo them. You need permission to change this template. Send the `draft.draftRevision` you last saw as `baseVersion`. If the template changed since then, the response is `409 VERSION_CONFLICT` with the current `draftRevision`, and nothing is saved. All or nothing: if any change is refused, nothing is saved and the response is `422` with every issue. A malformed change, such as an unknown change type or a missing or unknown field, returns `400 VALIDATION_FAILED` naming the field. Send `dryRun: true` to run the same checks without saving. An action's connected account must be one your organization has and of the app the action runs (a Stripe payment takes a Stripe account; a REST API or Webhook action takes a saved Secret or a signing account such as a Sumsub account): a change that sets another is refused (`422 STEP_CONNECTION_WRONG_APP` in `data.issues`); every action that runs one app (an app action, Collect payment, DocuSign, Adobe Acrobat Sign, Jotform, identity verification, a scheduler booking, a connected-app wait) names its account the same way, by id or by name, and an app not connected yet saves the action waiting for it, with `needsAPerson` naming the app and the link where a person connects it; an account since removed from your organization is `422 STEP_CONNECTION_FOREIGN`. A template that already holds a wrong account still takes other changes; publish refuses it. Nothing you send is quietly repaired: removing a step another step still reads is `422 STEP_STILL_READ` naming each reader (give `replacedBy`, or change or remove the readers in the same list), a `replacedBy` with no field for what a reader reads is `422 FIELD_NOT_ON_REPLACEMENT`, a setting a step or the template does not have is `422 UNKNOWN_SETTING`, a password or user name a person types into a step in Moxo (a web app's Basic auth) is `422 CREDENTIAL_NOT_ACCEPTED`, a stored file's address typed in where a step takes a file (send the `fileId` of a file uploaded to the step) is `422 STORAGE_KEY_NOT_ACCEPTED`, a branch's `paths`, a decision's `outcomes` or a loop's `steps` sent to `update_step` changed is `422 NESTED_STEPS_NOT_A_SETTING` (use `update_paths`, and `add_step` and its siblings for the steps inside), a question with a blank label is `422 FIELD_LABEL_REQUIRED`, an action named with only spaces is `422 STEP_NAME_REQUIRED`, an app action whose app or action the app catalog does not have is `422 EXTERNAL_APP_UNKNOWN_ACTION`, an app action input under a key its action does not take is `422 EXTERNAL_APP_UNDECLARED_INPUT` (a key the template already holds, sent back with its value unchanged, is not refused; it is removed when the template is saved), two questions sent with one `fieldId` is `422 FORM_FIELD_ID_DUPLICATE`, and an action whose type your organization's plan doesn't include is `422 FEATURE_NOT_ON_PLAN` (an action the template already has keeps its type). Nothing is added that you did not write either: a draft that is not complete yet (a Parallel path with no steps, an action nobody does, no name for new flows) is saved as you sent it, with `status: has_issues` and each gap in `issues`, and `fixedForYou` says anything the save stored differently. While someone else is editing the template in Moxo, the call answers `409 TEMPLATE_BEING_EDITED` and changes nothing: `error.editingBy` names them, and editing frees up after 5 minutes without activity. The editor's own token is never refused for this.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `VALIDATION_FAILED`, `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): The template changed since `baseVersion`.
- `422` (object): A change was refused and nothing was saved. `data` is the result, with every issue.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/check`: Check a template

Runs every publish check on the draft, and checks each step's settings against its schema, without saving. `status` is `ready` when nothing blocks publishing; otherwise `has_issues`. `check` gives the same findings as levels, for CI: `result` is `OK` or `FAIL` (`FAIL` only when there is an error, including one the published version already had), and each finding has a code, a message and a JSON pointer to where it is. An id you picked from a connected app (a Jotform form, a DocuSign template, an Acrobat Sign library document, a scheduling page) is checked against that app: one not in the account is `422 PICKED_ID_NOT_FOUND`; when the app can't be reached it is the warning `PICKED_ID_UNCHECKED`.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `422` (ErrorResponse): Refused: `PICKED_ID_NOT_FOUND`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/outline`: Get a template's outline

Returns a readable outline of the whole template: how it starts, roles, milestones, deadlines, every step (including those inside paths, outcomes, loops and approval branches), integrations (Secrets by name) and outgoing webhooks, with the ids your next change needs (`stepId`, `pathId`, `parentStepId`, `roleId`). It reads the working copy, with its unpublished changes, because it is what a change is made from; `GET /v1/templates/{id}` reads the published copy.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/file`: Get a template as a file

Guide: [Templates as files](/docs/guides/templates-as-files).

The template's draft as a readable `.yaml` file, to keep in a repository and review like code. Send `Accept: application/yaml` for the file itself. You need permission to change this template. The first pull gives each item a key made from its name; the keys stay when the item is renamed. `422 FILE_NOT_AVAILABLE` when part of the template can't be written as a file yet.

**The file.** `apiVersion: moxo/v1`, `kind: Template`, then the template: roles, flow fields, milestones and steps with their settings. Each step, role, milestone, path, outcome, field, table column, deliverable and reviewer, preparer or advisor has a `key` you can read and write. A setting that names an item writes `@` and its key (`assignees: [{ roleId: "@customer" }]`); text reads an earlier value with `${{ }}` (`${{ steps.intake.fields.email }}`, `${{ fields.contract_name }}`, `${{ roles.customer.email }}`). No item ids. People are named by email, and someone you can't see in Moxo's people lists by their user id (`usr_…`); connections, agents, data tables and other templates by name (`@agent:Contract reviewer`; one whose name another shares with its id beside it, `@agent:Contract reviewer [id:<id>]`). A pushed file can be at most 1.5 MB. Secrets, live settings (who can start it, start modes, notifications, chat) and builder layout are not in the file. The file's first line names its JSON Schema (`https://developers.moxo.com/docs/schemas/template-file.v1.json`), so an editor checks it as you type. Same organization only: to copy a template to another organization, use its export.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The file
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `422` (object): This template can't be written as a file. Nothing was read.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/file`: Push a template file

Guide: [Templates as files](/docs/guides/templates-as-files).

Compares the file with the template's draft and makes the difference as a change list, through the same checks as `POST /v1/templates/{id}/changes`. **A dry run unless `apply: true`:** the answer is the plan (`changes`) and what it would do (`result`), and nothing is saved. A key the template does not have is a new item; a key that is gone is a removed item; to rename a key, write the old one on `renamedFrom`. A difference no change can make is refused by name. A push never changes a published field's key and confirms no Send to conversation pin: a person confirms those in the builder. `422 FILE_REFUSED` lists where the file is wrong; `422 CHANGES_REFUSED` lists what the changes would break; `422 FILE_NOT_AVAILABLE` as on a pull; `409 VERSION_CONFLICT` when the template's content changed since the revision the file was pulled at (its `revision:` line, which decides; `baseVersion` only for a file with none, and a `baseVersion` that differs from the line is `400 VALIDATION_ERROR`): `changedSince` lists what changed (an owner hand-off is not a change). Pull it again, make your change in that file, then push it, a dry run included; `409 REVISION_REQUIRED` for a file with no revision. `overwrite: true` pushes the file as it is, undoing changes made since that it does not have. A rename (`renamedFrom`) is a change like any other, and every change is in `changes`. After a push that saves, `draftRevision` is the new revision. While someone else is editing the template in Moxo, the call answers `409 TEMPLATE_BEING_EDITED` and changes nothing: `error.editingBy` names them, and editing frees up after 5 minutes without activity. The editor's own token is never refused for this.

**The file.** `apiVersion: moxo/v1`, `kind: Template`, then the template: roles, flow fields, milestones and steps with their settings. Each step, role, milestone, path, outcome, field, table column, deliverable and reviewer, preparer or advisor has a `key` you can read and write. A setting that names an item writes `@` and its key (`assignees: [{ roleId: "@customer" }]`); text reads an earlier value with `${{ }}` (`${{ steps.intake.fields.email }}`, `${{ fields.contract_name }}`, `${{ roles.customer.email }}`). No item ids. People are named by email, and someone you can't see in Moxo's people lists by their user id (`usr_…`); connections, agents, data tables and other templates by name (`@agent:Contract reviewer`; one whose name another shares with its id beside it, `@agent:Contract reviewer [id:<id>]`). A pushed file can be at most 1.5 MB. Secrets, live settings (who can start it, start modes, notifications, chat) and builder layout are not in the file. The file's first line names its JSON Schema (`https://developers.moxo.com/docs/schemas/template-file.v1.json`), so an editor checks it as you type. Same organization only: to copy a template to another organization, use its export.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The plan, and what it did or would do
- `400` (ErrorResponse): Refused: `VALIDATION_ERROR`, `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): The template changed since the file was pulled, or the file says no revision.
- `422` (object): The file, or the changes it makes, were refused. Nothing was saved.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/templates/{id}/draft`: Discard unpublished changes

Discards the template's unpublished changes, so the draft is the published version again. The body is optional: a plain `DELETE` discards your own changes. You need permission to change this template. A template that was never published, or has no unpublished changes, returns `409 NOTHING_TO_DISCARD`. When other people also have unpublished changes, it returns `409 OTHER_PEOPLES_CHANGES` unless you send `includeOtherPeoplesChanges: true`. While someone else is editing the template in Moxo, the call answers `409 TEMPLATE_BEING_EDITED` and changes nothing: `error.editingBy` names them, and editing frees up after 5 minutes without activity. The editor's own token is never refused for this.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `NOTHING_TO_DISCARD`, `OTHER_PEOPLES_CHANGES`, `TEMPLATE_BEING_EDITED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/test-runs`: Start a test run

Starts a test run of the current draft, published or not: the same run as **Test run** in the template builder. It is a real flow, kept out of live work and reports, and not billed. `GET /v1/flows` never lists it: read it with `GET /v1/flows/{id}`, by the `flowId` this call returns. Every role you don't name in `roleAssignments` is given to you, so you get each step by email. You need permission to run this template, and the organization's hourly limit on test runs applies (`429`). Returns the run's link. Send an `Idempotency-Key` so a retry never starts a second run.

A test run's emails, texts, webhooks, API calls and app actions really go out, so you can see an integration work. Each one says it is a test: an email subject and a text start with `[TEST]`; a webhook delivery, a Webhook step's or Step Monitor's POST carries `"test": true` in its body; and every webhook, API call and app action request carries the header `X-Moxo-Test: true`.

Send `simulate: true` to start a Walkthrough instead: the steps run as yours, and every outside call is simulated, so nothing leaves Moxo. Its `link` opens the run in Moxo, where you do each action signed in as yourself; it is never a magic link. It needs Walkthrough on for your organization (`403 FEATURE_DISABLED` otherwise).

A test run walks a person through the steps, so it needs a personal access token: an organization API key gets `403 PERSON_TOKEN_REQUIRED`.

A test run needs the draft complete, as publishing does. A draft that is not (a Parallel path with no steps, a step nobody does) is refused with `422 TEMPLATE_NOT_READY` and `issues`: each gap, where it is and how to fix it. Nothing starts.

**Why its answer is not a flow.** `POST /v1/templates/{id}/start` answers the flow it started, as `GET /v1/flows/{id}` reads it. A test run answers `{ flowId, name, link, message, simulated }` instead: the run is kept out of flow lists and reads you would act on, and what you need from it is the link that opens it, whether it is a Walkthrough, and what to do next. Read the run itself with `GET /v1/flows/{flowId}`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): Started
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `422` (ErrorResponse): Refused: `TEMPLATE_NOT_READY`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/steps/{stepId}/attachments/upload-init`: Get an upload link for a step's file

Returns a signed upload link for one file on a template step. `PUT` the bytes to `uploadUrl` with every header in `requiredHeaders`; when `completionUrl` is present, `POST` to it after the `PUT`. Files are scanned for viruses after upload. With `slotKind: "document"` (the default when `slotKind` is left out, as MCP `get_upload_link` defaults it), the file is the step's own file: the PDF to sign or review, the PDF a PDF form or a Prepare document step fills (a PDF), the template an Update spreadsheet step fills (`.xlsx` or `.csv`), the page a web app step shows (a self-contained `.html` file), or a collaboration document. A file of another kind is refused with `415 UNSUPPORTED_FILE_TYPE` (a collaboration answers `422 DOC_COLLAB_FILE_TYPE_NOT_ACCEPTED`). Then send the change `{ "op": "update_step", "stepId": "<stepId>", "fields": { "document": { "ref": "<fileId>" } } }` to the draft (for a collaboration, set the document's `ref` in `fields.collaboration.documents`), and Moxo reads the file as the builder does: the PDF's fields, the workbook, the page's answer fields. A step that reads its file waits for the virus scan, so a change sent too early is refused with the issue `FILE_SCANNING`; send it again a few seconds later. With `slotKind: "reference"`, the file is reference material people read: it is added to the step in the template's draft (the draft's `definitionVersion` moves), and new flows get it once the template is published. The step must be in the draft, or the request is refused with `404 STEP_NOT_FOUND`. A step with no file of its own returns `422 NO_DOCUMENT_SLOT` for `slotKind: "document"`. You need permission to change the template.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `201` (object): Upload link created
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `415` (ErrorResponse): Refused: `UNSUPPORTED_FILE_TYPE`. The description says when; `error.code` says which.
- `422` (object): The step has no file of its own: `NO_DOCUMENT_SLOT`.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/templates/{id}/steps/{stepId}/attachments/{fileId}`: Remove a file from a step

Removes one file from a template step in the template's draft: the step's attachment, a connector input's file, or an image in its description. The published version keeps the file until the template is published again, and running flows keep theirs. A file the step does not name answers `404`. It doesn't remove the step's document: to change the document, set a new one with a change. You need permission to change the template.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string)
- `fileId` (path, required, string)

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/steps/{stepId}/esign-detect-fields`: Detect e-signature fields

Reads the signature and form fields of an e-signature step's document: the PDF's own fields, plus fields found by AI when you send `augmentWithVision` and the virus scan has passed. It changes nothing. To place them, give each field the `roleId` of the signer who fills it and send them as `fields` with the change `{ "op": "update_step", "stepId": "<stepId>", "fields": { "fields": [ … ] } }`, or place them in the template builder. An action the template doesn't have returns `404 STEP_NOT_FOUND`. You need permission to change the template.

**Who can call it.** A personal access token (`mxo_pat_...`) or a signed-in session builds as its person, with that person's permissions, and every change and publish is recorded as theirs. A template has owners, so building, changing and publishing one is a person's act: an organization API key gets `403 PERSON_TOKEN_REQUIRED` on every call that changes a template, and so does a partner delegation key. A key may still read templates and their files, check a change list, and read a document's fields. Building from code works on flow templates: a call on an action template answers `400 WRONG_TEMPLATE_KIND`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)
- `stepId` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## AI agents

The AI agents a template's steps use: list them, create and change drafts, publish them and add knowledge files. These endpoints need a personal access token, and changing an agent also needs the **Manage AI agents** permission.

### `GET /v1/agents`: List AI agents

Returns the organization's AI agents, most recently changed first, with what each takes in and returns. With **Manage AI agents**, also drafts and what setup is still missing (`needs`, `connectionsToBind`). Use an agent's `id` on a template step.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Manage AI agents (`agents.manage`). A template editor without it sees published agents only, with their kind, inputs and outputs: what the template builder shows when you pick an agent for a step.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `kind` (query, string)
- `status` (query, string)
- `search` (query, string): Part of the agent name.
- `limit` (query, integer): Agents per page, 1 to 100. Defaults to 50.

**Responses**

- `200` (object): Agents. A template editor gets only the fields of published agents.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents`: Create a draft AI agent

Creates a draft AI agent, the same way Agent Foundry does: the same checks, defaults and record. Send the kind (`agentType`), a name and instructions written under the `## headers` for that kind. It doesn't run until it is published.

The instructions are stored as you send them, except an `## Always` section: rules the agent always keeps live in `guardrails.alwaysRules`, and the lines of an `## Always` section are moved there (none doubled). No rules are added. The app suggests three rules for an AI Action's `guardrails.alwaysRules` (use only the information given, say what is not known instead of guessing, keep every value consistent); include them yourself if you want them.

A person connects the tools that use a connected app (`connectionsToBind` in the response) in Agent Foundry: open the agent's `url`.

**Run it on Grok Bot.** Send `externalSource: { "kind": "grok_bot", "connectionId": "<id>" }` on an automation agent. The connection is the bot: a person connects the Grok Bot routine (its webhook URL and sender key) in **Connected Apps**, and `GET /v1/connections?type=app` lists it with `app: "Grok Bot"`. The URL and key never pass through the API. The same checks as Agent Foundry apply: bring-your-own agents on your plan (`403 FEATURE_DISABLED` with `error.feature: "agentBYOA"`), a Grok Bot connection of your organization and an automation agent (`400` otherwise). To try it, publish the agent (publishing checks the connection with the routine first), put it on an `AI_AGENT` step and start a flow. When the step runs, Moxo sends the routine the step's input with a `completeUrl` and `today` (the organization's date, YYYY-MM-DD, to pass to the model when the routine works with dates); the routine finishes the step by calling it (`POST /v1/webhooks/grok-bot/{token}`). `externalSource` on the agent reads back its host and connection.

Creating AI agents needs the AI agents feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The draft agent
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}`: Get an AI agent

Returns one AI agent. With **Manage AI agents**, also what setup is still missing.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Manage AI agents (`agents.manage`). A template editor can read only a published agent.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The agent. A template editor gets only the fields of a published agent.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/agents/{id}`: Update an AI agent

Changes only the settings you send, named as in the agent file (`GET /v1/agents/{id}/file`), and saves them the same way a pushed file is saved, through the same checks as a save in Agent Foundry. `null` clears a setting. A published agent keeps running its live version, and the change is saved as unpublished until you publish it.

A connection, Secret or data-table grant is kept or removed, never added or changed: a person does that in Agent Foundry. Knowledge, skills and other agents are named, and must be your organization's: upload new knowledge first (`POST /v1/agents/{id}/knowledge/upload-init`). To rename an input or output, write its old name on `renamedFrom`, so steps that read it keep working. Computer tasks change only from a person's own signed-in Moxo session, never with a token.

`422 CHANGE_REFUSED` lists each problem with where and how to fix it, and nothing is saved. If someone else changed the agent at the same moment, the response is `409 CONFLICT`: read it again and resend.

**Run it on Grok Bot.** Send `externalSource: { "kind": "grok_bot", "connectionId": "<id>" }` on an automation agent. The connection is the bot: a person connects the Grok Bot routine (its webhook URL and sender key) in **Connected Apps**, and `GET /v1/connections?type=app` lists it with `app: "Grok Bot"`. The URL and key never pass through the API. The same checks as Agent Foundry apply: bring-your-own agents on your plan (`403 FEATURE_DISABLED` with `error.feature: "agentBYOA"`), a Grok Bot connection of your organization and an automation agent (`400` otherwise). To try it, publish the agent (publishing checks the connection with the routine first), put it on an `AI_AGENT` step and start a flow. When the step runs, Moxo sends the routine the step's input with a `completeUrl` and `today` (the organization's date, YYYY-MM-DD, to pass to the model when the routine works with dates); the routine finishes the step by calling it (`POST /v1/webhooks/grok-bot/{token}`). `externalSource` on the agent reads back its host and connection.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The agent
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied as sent. `error.code` says why.
- `422` (object): The change can't be saved. Nothing was saved. `error.issues` says where and how to fix each problem.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/publish`: Publish an AI agent

Makes the draft live, with the same checks as **Publish** in Agent Foundry. A refusal names what to fix (`needs` items with `blocksPublish: true`). Flows that already use the agent move to the new version as their template's agent policy says.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The published agent
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}/file`: Get an AI agent as a file

Guide: [Agents as files](/docs/guides/agents-as-files).

The agent's draft as a readable `.yaml` file, to keep in a repository and review like code. Send `Accept: application/yaml` for the file itself. `422 FILE_NOT_AVAILABLE` when part of the agent can't be written as a file yet (an output template saved in an older way), or when a part of it holds text shaped like a password, key or token: a file never carries one.

**The file.** `apiVersion: moxo/v1`, `kind: Agent`, then the agent's settings under the names the create body uses: `name`, `agentType`, `instructions`, `inputFields`, `outputFields`, `toolIds`, `toolConfig`, `guardrails`, `modelConfig` and the rest, and its Computer tasks as their steps. No ids. Organization objects are named: `@connection:<name>`, `@table:<name>`, `@skill:<name>`, `@agent:<name>`, `@file:<name>` for a file uploaded on the agent, and knowledge by its name (one whose name another shares with its id beside it: `@skill:Rules [id:<id>]`). Secrets, saved logins, Teach recordings, knowledge files themselves, run history and memory are not in the file. The file's first line names its JSON Schema (`https://developers.moxo.com/docs/schemas/agent-file.v1.json`), so an editor checks it as you type. Same organization only: to copy an agent to another organization, use its export.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The file
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `422` (ErrorResponse): This agent can't be written as a file. `error.message` says why.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/agents/{id}/file`: Push an AI agent file

Guide: [Agents as files](/docs/guides/agents-as-files).

Compares the file with the agent's draft and saves what differs, through the same checks as a save in Agent Foundry. **A dry run unless `apply: true`:** the answer says which settings change (`changes`) and nothing is saved. A published agent keeps running its live version: the change waits as unpublished until you publish (`POST /v1/agents/{id}/publish`). A key the file leaves out goes back to empty or its default; what the file can't show (saved logins, Moxo's own markers) stays as it is. To rename an input or output, write its old name on `renamedFrom`, so steps that read it keep working. A push keeps or removes a connection, Secret or data-table grant but never adds or changes one: a person does that in Agent Foundry. New knowledge is uploaded first (`POST /v1/agents/{id}/knowledge/upload-init`), then named. Computer tasks change only from a person's own signed-in Moxo session, never with a token. `422 FILE_REFUSED` lists each problem with where and how to fix it; `409 VERSION_CONFLICT` when `baseVersion` is stale or the agent changed during the push.

**The file.** `apiVersion: moxo/v1`, `kind: Agent`, then the agent's settings under the names the create body uses: `name`, `agentType`, `instructions`, `inputFields`, `outputFields`, `toolIds`, `toolConfig`, `guardrails`, `modelConfig` and the rest, and its Computer tasks as their steps. No ids. Organization objects are named: `@connection:<name>`, `@table:<name>`, `@skill:<name>`, `@agent:<name>`, `@file:<name>` for a file uploaded on the agent, and knowledge by its name (one whose name another shares with its id beside it: `@skill:Rules [id:<id>]`). Secrets, saved logins, Teach recordings, knowledge files themselves, run history and memory are not in the file. The file's first line names its JSON Schema (`https://developers.moxo.com/docs/schemas/agent-file.v1.json`), so an editor checks it as you type. Same organization only: to copy an agent to another organization, use its export.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The plan, and whether it was saved
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied as sent. `error.code` says why.
- `422` (object): The file can't be pushed. Nothing was saved. `data.issues` says where and how to fix each problem.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}/versions`: List an AI agent's versions

Every published version of the agent, newest first: what Agent Foundry's version history lists.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The published versions, newest first.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}/versions/{versionId}`: Get an AI agent version as a file

Guide: [Agents as files](/docs/guides/agents-as-files).

A published version of the agent as a readable `.yaml` file, in the same shape as the draft's file (`GET /v1/agents/{id}/file`), so two versions, or a version and the draft, diff line by line. Send `Accept: application/yaml` for the file itself. `422 FILE_NOT_AVAILABLE` when part of it can't be written as a file.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `versionId` (path, required, string)

**Responses**

- `200` (object): The version as a file
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `422` (ErrorResponse): This version can't be written as a file. `error.message` says why.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/versions/{versionId}/restore`: Restore an AI agent version

Brings back a published version, as **Restore** in Agent Foundry's version history does. A published agent gets it as its draft and keeps running its live version until you publish (`POST /v1/agents/{id}/publish`); an agent never published gets it live. `restoredTo` says which. A version's data-table grants, connected apps and saved sign-ins that the agent doesn't hold now must be yours to grant, as when you create one.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `versionId` (path, required, string)

**Responses**

- `200` (object): The agent after the restore.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/test-files/upload-init`: Add a file for an AI agent test run

Returns a one-time upload link for a file a test run reads: an earlier step's upload (`priorStepFiles`) or the files under review (`submissionFiles`). `PUT` the file to `uploadUrl` with `requiredHeaders`, then name its `fileId` in the run. PDF up to 1 GB, an image up to 5 MB. Test files are yours and are removed after 24 hours.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The upload link.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/test-runs`: Start an AI agent test run

A Test run is what **Test** in Agent Foundry runs: the agent's saved draft on a step of one of your flow templates, in a hidden test flow. Its tools act for real unless `toolWrites` is `off`, as in Agent Foundry, so starting and stopping one is yours alone. A run is its starter's: another person's run answers `404`. Answers `202` at once with the run's address in `Location`; read it there until `state` is no longer `running`. Send an `Idempotency-Key`: a retry with the same key within ten minutes answers the run the first call started, never a second one. The same test started again while it runs answers `425 TEST_RUN_ALREADY_IN_FLIGHT`. A chat agent tests as a conversation in Agent Foundry, and the Conductor isn't tested on a step (`400 TEST_KIND_NOT_SUPPORTED`).

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `202` (object): Started. `Location` is the run's address.
- `400` (ErrorResponse): Refused: `TEST_KIND_NOT_SUPPORTED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `425` (ErrorResponse): The same test is already running. `Retry-After` says when to try again.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}/test-runs/{runId}`: Get an AI agent test run

A Test run is what **Test** in Agent Foundry runs: the agent's saved draft on a step of one of your flow templates, in a hidden test flow. Its tools act for real unless `toolWrites` is `off`, as in Agent Foundry, so starting and stopping one is yours alone. A run is its starter's: another person's run answers `404`. `state` is `running` until it ends; then `result` holds what the agent produced, as Agent Foundry's Test shows it.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `runId` (path, required, string)

**Responses**

- `200` (object): The run.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/test-runs/{runId}/stop`: Stop an AI agent test run

A Test run is what **Test** in Agent Foundry runs: the agent's saved draft on a step of one of your flow templates, in a hidden test flow. Its tools act for real unless `toolWrites` is `off`, as in Agent Foundry, so starting and stopping one is yours alone. A run is its starter's: another person's run answers `404`. Stops it as **Stop** in Agent Foundry does. A run that already finished keeps its own result.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `runId` (path, required, string)

**Responses**

- `200` (object): The run after the stop.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/eval-runs`: Start an AI agent eval run

An eval run replays your agent's draft over your agent's own examples, kept from its runs (the examples the Improve loop proves changes on), and grades both the draft and the published version with the same grader. Moxo's internal test sets are never used. It replays one change at a time: the instructions, or the model. Free: API eval runs have their own daily share of the Improve loop's budget. With the 8 to 18 examples a run holds, `inconclusive` is the common answer: a run never claims a draft is "not worse". Answers `202` at once with the run's address in `Location`; read it there until `state` is `done`. The answer is kept for 24 hours. Send an `Idempotency-Key`: a retry with the same key within ten minutes answers the run the first call started. A person may start 20 an hour (`429 EVAL_RUN_RATE_LIMITED`). When today's share runs out, the run still answers `202` and ends `stopped_at_budget`, with when the share resets.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `202` (object): Started. `Location` is the run's address.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}/eval-runs/{runId}`: Get an AI agent eval run

An eval run replays your agent's draft over your agent's own examples, kept from its runs (the examples the Improve loop proves changes on), and grades both the draft and the published version with the same grader. Moxo's internal test sets are never used. It replays one change at a time: the instructions, or the model. Free: API eval runs have their own daily share of the Improve loop's budget. With the 8 to 18 examples a run holds, `inconclusive` is the common answer: a run never claims a draft is "not worse". A run is its starter's: another person's run answers `404`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `runId` (path, required, string)

**Responses**

- `200` (object): The run.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/agents/{id}/knowledge/upload-init`: Add a knowledge file to an AI agent

Returns a one-time upload link. Send the file there yourself, so the file never passes through an AI model:

```bash
curl -X PUT -H "Content-Type: application/pdf" --upload-file policy.pdf "<uploadUrl>"
```

Send every header in `requiredHeaders`. When `completionUrl` is present, `POST` to it after the upload: the same upload link every upload in this API answers with, beside the knowledge file in `source`. The file is scanned, then its status becomes `READY` (see `GET /v1/agents/{id}/knowledge`) and it joins the agent's draft (`inDraft`): a published agent runs with it after its next publish. A file never sent, or one that cannot be read, is not added. On an agent installed from an Archway bundle, send the header `x-archway-detach-ack: 1` with this call to add the file, which detaches the agent from its bundle; without it the file is kept but not added. Up to 100 MB per file. The other limits, and what counts, are under Knowledge limits in the introduction. Needs the Agent knowledge feature on your plan.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The pending file and its upload link
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/agents/{id}/knowledge`: List an AI agent's knowledge files

Returns the AI agent's knowledge files and whether each is `READY`.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Manage AI agents (`agents.manage`).

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Knowledge files
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Template setup

A template's settings around its steps: owners, folder, mode, chat support and FAQ. These endpoints need a personal access token and edit access to the template.

### `GET /v1/templates/{id}/setup`: Get a template's owners, folder and mode

Returns who owns the template, its folder, and whether it runs as predefined or adaptive.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The setup
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/owners`: Set a template's owners

Owners manage the template and its flows. Send the people (`ownerIds`), or who owns it (`ownerPermission`): named people, admins only, or permission groups. An owner is an active person on your team (an internal user who is active or invited). An id that is not a person in your organization, or a person you add who is an external user, an agent or deactivated, returns `400 VALIDATION_FAILED` and names them; an owner the template already has never blocks a change. Publishing checks every owner: an external owner blocks it, and so do specific owners who are all deactivated.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The setup
- `400` (ErrorResponse): Refused: `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/live-settings`: Change a template's live settings

Live settings apply at once, to new flows and, where the setting says so, to running ones: they are not part of the draft and need no publish. This call sets the Start link's address (`embedId`), whether the people doing tasks see which steps an AI agent did (`revealAIToParticipants`), whether this template's completed flows can be deleted (`allowDeleteCompletedFlows`), and whether people in your organization can ask to join its flows (`allowJoinRequests`). With `alsoRunningFlows`, it applies the template's chat channels or AI visibility to the flows already running. Each change is recorded in the template's activity.

The other live settings have their own calls: who can start, change and own it (`update_permissions` in `POST /v1/templates/{id}/changes`, `PUT /v1/templates/{id}/owners`), how flows start (`update_flow_start`, `PATCH /v1/templates/{id}/trigger-activation`), notifications, the cover and the AI assistant (`update_settings`, `PUT /v1/templates/{id}/support-config`), the description (`update_template_info`) and the folder (`PUT /v1/templates/{id}/folder`). A Start link address another template uses returns `409 CONFLICT`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): What changed.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONFLICT`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/mode`: Set a template's mode

`predefined` runs the steps as designed and has no goal: switching to it clears the goal, and a goal sent with it returns `400 GOAL_NEEDS_ADAPTIVE`. `adaptive` works toward `goal` and needs the Adaptive flows feature on your plan (`403 FEATURE_DISABLED` otherwise). Once a flow has started from the template (a test run doesn't count), its mode can't change: a different mode returns `409 TEMPLATE_MODE_LOCKED`, while the goal can still change.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The setup
- `400` (ErrorResponse): Refused: `GOAL_NEEDS_ADAPTIVE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `TEMPLATE_MODE_LOCKED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/folder`: Move a template to a folder

Name an existing folder with `folderName` or send its `folderId`. `folderId: null` takes the template out of any folder.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The setup
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied as sent. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/support-config`: Get a template's chat assistant settings

Returns who answers participants in this template's chat, when it escalates and to which role, its business hours, and whether it replies on its own.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Settings
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/support-config`: Set a template's chat assistant settings

Changes only the fields you send. `agentId` must be a published chat agent. Name the escalation role with `escalationRole` (its name on the template); `null` clears it.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Settings
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/faq`: List a template's FAQ

Returns the questions and answers the chat assistant uses for this template.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): FAQ
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/faq`: Add a FAQ entry

Adds one question and answer.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The entry
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/faq/{faqId}`: Change a FAQ entry

Changes only the fields you send.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `faqId` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The entry
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/templates/{id}/faq/{faqId}`: Remove a FAQ entry

Removes one entry.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `faqId` (path, required, string)

**Responses**

- `200` (object): Removed
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Template start

How a template starts without anyone pressing Start: on a schedule, on an app event or from an email. These endpoints need a personal access token.

### `GET /v1/schedules`: List schedules

Returns one template's schedules. `templateId` is required; a template you can't start returns 404.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Manage schedules (`schedules.manage`) and permission to start the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `templateId` (query, required, string)

**Responses**

- `200` (object): Schedules
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/schedules`: Start a template on a schedule

Starts a flow from a published template on a repeating schedule (cron, in `timezone`). Name roles by their name on the template. Needs the Scheduling feature on your plan. A template that was never published, or is archived, returns `409 TEMPLATE_NOT_PUBLISHED`, as a webhook start does. `customFields` is refused the way a start refuses it: a key that names no start field, or a field's id or label in its place, returns `400 VALIDATION_FAILED` naming it, and nothing is saved. An unknown role is refused the same way.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage schedules (`schedules.manage`) and permission to start the template.

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The schedule
- `400` (ErrorResponse): Refused: `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `TEMPLATE_NOT_PUBLISHED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/schedules/{id}`: Change a schedule

Changes only the fields you send. `scheduleName` and `enabled` apply at once (`enabled: false` pauses it, and `nextRun` is `null` while paused). For a template's own schedule, when it runs and what it starts (`kind`, `cronPattern`, `kindParams`, `timezone`, `roleAssignments`, `customFields`, `flowTitleTemplate`, `flowDue`) are part of the template's setup: a change waits for the template's next publish, as other start settings do. Until then the answer shows the new values with `hasPendingSetup: true`, while `nextRun` and the flows it starts follow the published ones. A schedule a running flow made (a Schedule a flow step) changes at once.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage schedules (`schedules.manage`) and permission to start the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The schedule
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/schedules/{id}`: Remove a schedule

No more flows start from it. Flows it already started keep running.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage schedules (`schedules.manage`) and permission to start the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The schedule that was removed.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flow-triggers`: List a template's app triggers

Returns the app events that start a flow from this template.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `templateId` (query, required, string)

**Responses**

- `200` (object): App triggers
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/flow-triggers`: Start a template on an app event

Starts a flow when something happens in a connected app. A trigger runs on one of the organization's connections: a connection a person made for themselves alone does not count, and naming one is refused with `400 BAD_REQUEST`. A person connects apps in Moxo: when the organization has no connection for `provider`, the response is `409 CONNECTION_REQUIRED` with `error.connectUrl` to share with a person. When there are several, `409 CONNECTION_CHOICE_REQUIRED` lists them: send `connectionId`.

Choose `eventType` from `GET /v1/flow-triggers/providers/{provider}/event-types`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The trigger
- `400` (ErrorResponse): Refused: `BAD_REQUEST`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied as sent. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/flow-triggers/{id}`: Change an app trigger

Changes only the fields you send; `enabled: false` pauses it.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The trigger
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/flow-triggers/{id}`: Remove an app trigger

No more flows start from it.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `204`: Removed
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flow-triggers/connections`: List the connections you can use for an app

Returns the `connectionId` values a trigger can use for `provider` (the organization's connections; one a person made for themselves alone never starts a trigger), and where a person connects a new one.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `provider` (query, required, string)

**Responses**

- `200` (object): Connections
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flow-triggers/providers/{provider}/event-types`: List the events an app can start a flow on

Returns values for setting up an app trigger, read from the app.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `provider` (path, required, string)

**Responses**

- `200` (object): Options
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/flow-triggers/providers/{provider}/objects`: List the record types in a connected app

Returns values for setting up an app trigger, read from the app.

Only HubSpot and Salesforce list their record types here, for the events that start on a record type you pick. Any other app answers `400 BAD_REQUEST`.

When the app can't answer, the call fails with its reason: `400 MISSING_DEPENDENCY` when a choice this one depends on isn't in `resource` yet, `409 RECONNECT_REQUIRED` when the account needs reconnecting, `429 RATE_LIMITED` when the app is limiting requests, and `502 PROVIDER_ERROR` when the app failed.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `provider` (path, required, string)
- `connectionId` (query, required, string)

**Responses**

- `200` (object): Options
- `400` (ErrorResponse): A choice this one depends on is missing (`MISSING_DEPENDENCY`), or the query is not valid.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): The account needs reconnecting (`RECONNECT_REQUIRED`).
- `429` (ErrorResponse): Too many requests.
- `502` (ErrorResponse): The app failed to answer (`PROVIDER_ERROR`). Try again.

### `GET /v1/flow-triggers/providers/{provider}/fields`: List the fields an event can fill the start form from

Returns values for setting up an app trigger, read from the app.

When the app can't answer, the call fails with its reason: `400 MISSING_DEPENDENCY` when a choice this one depends on isn't in `resource` yet, `409 RECONNECT_REQUIRED` when the account needs reconnecting, `429 RATE_LIMITED` when the app is limiting requests, and `502 PROVIDER_ERROR` when the app failed.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `provider` (path, required, string)
- `eventType` (query, required, string)
- `connectionId` (query, required, string)
- `sobject` (query, string)
- `watchedField` (query, string)
- `resource` (query, string): JSON object of the choices made so far, for an event scoped to one (an Asana project).
- `refresh` (query, string): `true` reads the fields from the app again instead of the last copy.

**Responses**

- `200` (object): Options
- `400` (ErrorResponse): A choice this one depends on is missing (`MISSING_DEPENDENCY`), or the query is not valid.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): The account needs reconnecting (`RECONNECT_REQUIRED`).
- `429` (ErrorResponse): Too many requests.
- `502` (ErrorResponse): The app failed to answer (`PROVIDER_ERROR`). Try again.

### `GET /v1/flow-triggers/providers/{provider}/resource-options`: List the choices for an event setting

Returns values for setting up an app trigger, read from the app.

When the app can't answer, the call fails with its reason: `400 MISSING_DEPENDENCY` when a choice this one depends on isn't in `resource` yet, `409 RECONNECT_REQUIRED` when the account needs reconnecting, `429 RATE_LIMITED` when the app is limiting requests, and `502 PROVIDER_ERROR` when the app failed.

A personal access token reads it with its person's permissions. An organization API key with `templates:read` reads it too, as an admin does; changing it still needs a personal access token.

**Permission for a personal access token:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `provider` (path, required, string)
- `eventType` (query, required, string)
- `connectionId` (query, required, string)
- `key` (query, required, string)
- `resource` (query, string): JSON object of the choices made so far.

**Responses**

- `200` (object): Options
- `400` (ErrorResponse): A choice this one depends on is missing (`MISSING_DEPENDENCY`), or the query is not valid.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): The account needs reconnecting (`RECONNECT_REQUIRED`).
- `429` (ErrorResponse): Too many requests.
- `502` (ErrorResponse): The app failed to answer (`PROVIDER_ERROR`). Try again.

### `GET /v1/email-triggers`: Get a template's email trigger

Returns the email trigger, or `null` when there is none. It only reads: it never creates a trigger. `inboxAddress` appears once the template is published with **Start by email** on.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Parameters**

- `templateId` (query, required, string)

**Responses**

- `200` (object): The email trigger
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/email-triggers`: Start a template from an email

Sets which emails start a flow (`filter`) and what fills the start form and roles (`mapping`). Moxo creates the inbox address. Needs the Email trigger feature on your plan (`403 FEATURE_DISABLED` otherwise, with `error.feature` `triggerEmail`).

A template has one email trigger, so this is an upsert: it answers **201** when it creates the trigger, and **200** with the existing trigger, changed by what you send, when the template already has one. It changes only the fields you send; `mapping` merges as `PATCH` describes.

Two switches decide whether an email starts a flow. The template's **Start by email** setting decides whether it takes email at all: turn it on with `PATCH /v1/templates/{id}/trigger-activation` (`EMAIL` in `supportedStartModes`). `enabled` is this trigger's own pause: `false` stops emails starting flows while Start by email stays on, and nothing but your `PATCH` turns it back on. Both must be on, and the template published, for an email to start a flow.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The email trigger, changed: the template already had one.
- `201` (object): The email trigger, created.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/email-triggers/{id}`: Change an email trigger

Changes only the fields you send. `enabled: false` pauses the trigger: emails stop starting flows while the template's Start by email stays on, and only `enabled: true` lifts it (saving or publishing the template never does). It is the same switch as **Email** on the app's Start step, so a pause made here shows there, and switching Email on in the app lifts it. Every answer says both facts: `startByEmail` and `enabled`. `mapping` merges one level deep: `roleAssignments` and `inputs` each replace that whole part when you send it, and a part you leave out is kept. To remove one input, send `inputs` without it. A mapping or conditions change waits for the template's next publish (`hasPendingSetup`).

Changing the conditions or mapping, and resuming (`enabled: true`), need the Email trigger feature on your plan (`403 FEATURE_DISABLED` otherwise); pausing never does.

Pausing or resuming alone (`enabled` and nothing else) needs edit permission on the template, not Configure integrations. A person without Configure integrations is answered only `{ id, startByEmail, paused }`: the address, conditions and mapping stay behind that permission.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The email trigger, or only its pause for a person without Configure integrations
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/email-triggers/{id}`: Remove an email trigger

Removes the trigger, its inbox address, conditions and mapping, and turns the template's **Start by email** off (whether it was on or paused) in the same step, as **Remove** does in the app, so no later save brings back a trigger you removed. Emails to the address stop starting flows. To stop it for a while and keep its setup, send `PATCH` with `enabled: false` instead.

Turning the email start off changes the template. On a template installed from an Archway bundle it answers `409 ARCHWAY_REQUIRES_DETACH_ACK` and removes nothing; send it again with the header `x-archway-detach-ack: 1` to remove the trigger and detach the template from its bundle.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Configure integrations (`integrations.configure`) and edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `204`: Removed
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ARCHWAY_REQUIRES_DETACH_ACK`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

## Users

Internal and external users, in one resource. `kind` tells them apart:

- `internal`: your own team, who sign in to the orchestrator portal.
- `external`: clients, vendors and partners, who use magic links or a portal.
- `agent`: an AI agent that does work in flows.
- `service`: the organization API key behind a request.

Filter the list with `?kind=external` to get one kind.

Two separate things decide what a user can do. Their **persona** decides where they work: the orchestrator portal (`orchestrator_portal`), a named portal (`portal`) or magic links only (`magic_link`). A user can have more than one persona and switch between them from the profile menu. Their **access to a flow** decides what they can do in it: a flow manager runs the flow, a participant sees their own steps and anything shared with them, and a viewer can only look. Being an organization admin doesn't make someone a flow manager, and being a flow manager gives no organization-wide rights.

External users can belong to an account, the company they work for. See Accounts.

### `GET /v1/users`: List users

Returns the users in your organization, internal and external together. Each row includes `customFields`, your organization's current profile fields for the person (the same map as on `GET /v1/users/{id}`). Send `kind=external` or `kind=internal` to get one kind, and optionally `status`, `personaId`, `accountId`, `uniqueId` or `search`. `uniqueId` finds the people your system knows by those IDs, exactly (any letter case); `search` matches part of a name, email, unique ID or phone. To see internal users, an organization API key needs `team:read`, and a personal access token's person must be able to see the People roster in the app; every default group can. Each half stands alone: a caller with only `external_users:read` gets external users only (the list without `kind` leaves out internal users, and `kind=internal` returns `403 FORBIDDEN`), and one with only `team:read` gets internal users only (`kind=external` returns `403 FORBIDDEN`).

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:read` or `team:read`

**Parameters**

- `cursor` (query, string): The previous page's `nextCursor`. The next page starts right after that person, even if they were deactivated or removed from the organization since. A value this list did not return is refused with `400 INVALID_CURSOR`.
- `limit` (query, integer): Users per page, 1 to 200. Defaults to 50.
- `kind` (query, string)
- `status` (query, string): `ACTIVE`, `INVITED` or `DEACTIVATED`, or several comma-separated: `ACTIVE,INVITED` lists everyone who can still be given work. Leave it out for all three.
- `personaId` (query, string)
- `accountId` (query, string)
- `uniqueId` (query, string): Only the people with these organization-scoped unique IDs: an exact match in any letter case, one or up to 100 comma-separated. Unlike `search`, `EMP-1` does not also find `EMP-10`. More than 100 returns `400 BAD_REQUEST`.
- `search` (query, string)

**Responses**

- `200` (object): The users.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/users`: Create user

Invites an internal user (someone on your team) or an external user (a client, vendor or partner) to your organization. The persona decides where they work, in the orchestrator portal, a named portal or magic links only, and must match the user's `kind`. An organization API key needs `team:write` for `kind=internal` and `external_users:write` for `kind=external`; a key with one of these scopes can't do the other. `kind=internal` sends a team invitation email. Personal access tokens, organization API keys and partner delegation keys can all invite. An invitation sent with a key is recorded under the key in the audit trail, and the email names the key's owner (for a partner delegation key, the partner). Only a person can invite someone to an admin persona: a key gets `SERVICE_KEY_CANNOT_INVITE_ADMIN`. `kind=external` creates the user at once, with status `ACTIVE`. `data.invitationSent` is `true` only when the person can sign in to a portal and an invitation email is being sent. A user with a magic-link-only persona is created with `invitationSent: false` and gets no email; they hear from Moxo when they have something to do. To onboard your first client, make this call, then give them work (start a flow) or create an SDK session for them. The response carries the new user's id and `invitationSent`; call `GET /v1/users/{id}` for the full user.

Identify the person with `email`, an organization-scoped `uniqueId`, or both. When both are sent, `uniqueId` is the durable key and the email is where they sign in and get mail. Someone added by `uniqueId` alone gets no email (`invitationSent: false`), and `sendInvitation: true` without an email is refused.

The email and the unique ID are each unique in your organization, for both kinds. A `uniqueId` someone already holds returns `409 UNIQUE_ID_CONFLICT`, whatever email was sent with it: `error.existingUserId` is that person's id when you may read them, so to make sure someone exists, add them and on this answer use that id. An email someone already has, or is invited with, returns `409 DUPLICATE`: the message names the person, `error.existingUserId` is their id when you may read them. An inactive internal user is that same `409 DUPLICATE`, and `error.reason` is `deactivated_member`. Reactivate them with `POST /v1/users/{id}/activate`. Inviting them again does not make them active. Either way nothing is changed or sent. To send an invitation again, use `POST /v1/users/{id}/resend-invite`. An external user who was deactivated or removed is added back instead, with `200`.

When your identity provider gives people their personas (single sign-on role mapping, or your directory's groups on Provisioning) and your organization has turned off adding personas in Moxo, an invitation that would give a person it manages a persona returns `409 PERSONAS_FROM_IDP_ONLY`, and nothing is sent.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe. A retry with the same key within 10 minutes returns the first result and sends no second email. After 10 minutes a retry is answered as any second add is: `409 DUPLICATE` for an email, or `409 UNIQUE_ID_CONFLICT` for a `uniqueId`, each with the person's id. See Idempotency in the Introduction.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: CreateUserRequest

**Responses**

- `200` (object): For an external user only: a deactivated or removed external user with this email was added back. The body is the same as for `201`.
- `201` (object): Created
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `DUPLICATE`, `PERSONAS_FROM_IDP_ONLY`, `UNIQUE_ID_CONFLICT`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/users/{id}`: Get user

Returns the user's full profile in this organization: name, contact details, persona, account (for an external user), when they were invited, joined or deactivated, time zone, and `customFields` (your organization's current profile fields; deleted fields are left out). To read an internal user, an organization API key needs `team:read`, and a personal access token's person must be able to see the People roster in the app; every default group can. To read an external user, it needs `external_users:read`, or for a person, permission to see or invite external users. A caller without the right one gets `404`, so the endpoint never confirms that someone exists. Read your own profile with `GET /v1/users/me`.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:read` or `team:read`

**Parameters**

- `id` (path, required, string): Person lookup key. Prefer the opaque `usr_…` id. When your organization has Partner unique ID on, a `uniqueId` resolves next (ignoring case), then an email address; a value that is one person's unique ID and another person's email names no one (`404`). A legacy UUID still works. Path-encode `@` (`%40`).

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/users/{id}`: Update user profile

Updates a user's profile in this organization: name, phone, picture, time zone and, optionally, `customFields`, a partial map of your organization's profile fields. It can also change their persona or link them to an account. Profile changes apply only to this organization; the same person can have different settings in another organization they belong to. Writing `customFields` needs no more access than the rest of this request. An unknown field key returns `400 UNKNOWN_KEY`, and a value over 256 characters returns `400 VALUE_TOO_LONG`.

Changing an **internal** user also needs `team:write` for an organization API key, or, for a personal access token, a person with **Invite internal users** (People → Orchestrator permissions), on top of `external_users:write`. A caller without it gets `404` for an internal user, so the endpoint never confirms that one exists, as on `GET /v1/users/{id}` and `POST /v1/users`.

Setting your own `title` (when the token belongs to this user) follows your organization's setting for people setting their own title: while it is off, the request returns `403 TITLE_EDIT_DISABLED` and nothing is changed. A change to an external user's profile is recorded in the audit log as `external_user.updated`, and a change to an internal user's name as `member.name_changed`.

When your organization's directory provisions people (SCIM), the fields it sends for a person can only be changed there: setting one of them (`name`, `title`, `department`, `managerId` or a `customFields` key) returns `409 DIRECTORY_MANAGED`, and nothing in the request is changed. Sending the value the person already has is not a change.

When your identity provider gives people their personas (single sign-on role mapping, or your directory's groups on Provisioning), a persona it gave can't be replaced here: the request returns `409 IDP_PERSONA_LOCKED` with `error.details.personaId`. When adding personas in Moxo is turned off, a new persona for a person it manages returns `409 PERSONAS_FROM_IDP_ONLY`. Either way, nothing in the request is changed; change the person's groups in your identity provider instead.

To change the email an external user signs in with, send `email` from an organization API key that also holds `users:email`, for someone your organization knows by a unique ID. Send `email` alone. It is the same change a person makes for themselves, for your organization only: they keep their id, unique ID and history here, another organization they belong to keeps the email it knows them by, and their open sessions end. An internal user's email is never changed this way. Moxo emails the previous address to say the sign-in email changed, without naming the new one. The change is recorded in the audit log as `member.email_changed`, and a refused one as `member.email_change_refused`.

The answer is the user as `GET /v1/users/{id}` returns them after the change.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string): Person lookup key. Prefer the opaque `usr_…` id. When your organization has Partner unique ID on, a `uniqueId` resolves next (ignoring case), then an email address; a value that is one person's unique ID and another person's email names no one (`404`). A legacy UUID still works. Path-encode `@` (`%40`).

**Request body**

- `application/json`: UpdateUserRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `UNKNOWN_KEY`, `VALUE_TOO_LONG`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict. Nothing in the request was changed. `DIRECTORY_MANAGED`: your organization's directory sets this for this person, so change it there; `error.field` names the field (`name`, `title`, `department`, `manager`, `email`, or `custom:<key>`). `EMAIL_CHANGE_NOT_ALLOWED`: `error.reason` is `org_key_only`, `internal_member`, `no_unique_id` or `sign_in_provider`. `EMAIL_BELONGS_TO_ANOTHER_ACCOUNT`: that email already signs in to Moxo.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/users/{id}`: Delete user

Deactivates the user in this organization (an `INVITED` user too: their invitation stops working). Deleting someone already deactivated changes nothing. Their name stays on past assignments, so the audit trail stays complete. This is the same deactivation as `/deactivate`, with the same rules: only another Owner, using their own personal access token (not an organization API key), can deactivate an Owner, and never the last one (`400 LAST_OWNER`). You can't deactivate yourself with your personal access token (`400 CANNOT_DEACTIVATE_SELF`). An organization API key can still delete a user. It is recorded as `user.deactivated`.

Removing an **internal** user also needs `team:write` for an organization API key, or, for a personal access token, a person with **Invite internal users** (People → Orchestrator permissions). A caller with only `external_users:write` gets `404` for an internal user.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string): Person lookup key. Prefer the opaque `usr_…` id. When your organization has Partner unique ID on, a `uniqueId` resolves next (ignoring case), then an email address; a value that is one person's unique ID and another person's email names no one (`404`). A legacy UUID still works. Path-encode `@` (`%40`).

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `CANNOT_DEACTIVATE_SELF`, `LAST_OWNER`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/users/me`: Get my details

Returns your own full profile in this organization: name, contact details, persona, account (for an external user), when you were invited and joined, time zone, and `customFields`. The response is the same as `GET /v1/users/{id}` for your own id. An organization API key has no person behind it, so it gets `403 PERSON_TOKEN_REQUIRED`; it reads a person with `GET /v1/users/{id}`.

**Tokens:** personal access token

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/users/{id}/deactivate`: Deactivate user

Suspends the user in this organization. They can no longer sign in or be assigned new work, but their name stays on past assignments, so the audit trail stays complete. Reverse it with `/activate`. On a deactivated user, it changes nothing. An invited user who hasn't accepted yet returns `400`: withdraw the invitation with `DELETE /v1/users/{id}`. You can't deactivate yourself with your personal access token (`400 CANNOT_DEACTIVATE_SELF`). An organization API key can still deactivate a user. A person your organization's directory provisions can still be deactivated here, as an emergency hold: the directory can't reactivate them until someone reactivates them in Moxo.

Deactivating an **internal** user also needs `team:write` for an organization API key, or, for a personal access token, a person with **Invite internal users** (People → Orchestrator permissions). A caller with only `external_users:write` gets `404` for an internal user.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string): Person lookup key. Prefer the opaque `usr_…` id. When your organization has Partner unique ID on, a `uniqueId` resolves next (ignoring case), then an email address; a value that is one person's unique ID and another person's email names no one (`404`). A legacy UUID still works. Path-encode `@` (`%40`).

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `CANNOT_DEACTIVATE_SELF`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/users/{id}/activate`: Activate user

Moves an `INVITED` or `DEACTIVATED` user to `ACTIVE`. An invited internal user gets the persona their invitation gives them (the one chosen at invite, or the default for its tier), as accepting the invitation would, and the invitation is used up. That is the same for an internal user deactivated before they accepted. You can only give that persona if you could invite them with it: an admin persona needs an admin (a key gets `403 SERVICE_KEY_CANNOT_INVITE_ADMIN`, anyone else `403 ADMIN_INVITE_REQUIRES_ADMIN`), a key gives only the default member persona (`403 SERVICE_KEY_CANNOT_CHOOSE_PERSONA`), a person can't give permissions they don't have (`403 OVER_GRANT`), and a persona your plan doesn't include is refused (`403 FEATURE_DISABLED`, `error.feature` naming it). Nothing changes, and the invitee can still accept the invitation themselves. Someone who already holds that persona, or another orchestrator-portal persona when the invitation gives one, keeps what they hold, as accepting would; so does someone whose personas come from your identity provider while adding them in Moxo is off. On someone who became active since, it changes nothing (`changed: false`). On an active user, it changes nothing, and the answer says `changed: false`. A person your organization's directory deactivated returns `409 DIRECTORY_MANAGED`: reactivate them in the directory. A person deactivated in Moxo while the directory provisions them is reactivated, and the directory manages them again.

Activating an **internal** user also needs `team:write` for an organization API key, or, for a personal access token, a person with **Invite internal users** (People → Orchestrator permissions). A caller with only `external_users:write` gets `404` for an internal user.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string): Person lookup key. Prefer the opaque `usr_…` id. When your organization has Partner unique ID on, a `uniqueId` resolves next (ignoring case), then an email address; a value that is one person's unique ID and another person's email names no one (`404`). A legacy UUID still works. Path-encode `@` (`%40`).

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict. `DIRECTORY_MANAGED`: your organization's directory sets this for this person, so change it there. `error.field` names the field (`name`, `title`, `department`, `manager`, `active`, or `custom:<key>`). Nothing in the request was changed.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/users/{id}/resend-invite`: Resend an invitation

Sends the invitation email again. It works only while the user is `INVITED`, and at most once a minute. For an **internal** user, it also needs `team:write` for an organization API key, or, for a personal access token, a person with **Invite internal users** (People → Orchestrator permissions). A caller with only `external_users:write` gets `404` for an internal user.

**Idempotent.** Send an `Idempotency-Key` to make retries safe: a retry with the same key within 10 minutes returns the first result and sends no second email. After 10 minutes the invitation is sent again, and for an internal user the new link replaces the earlier one. Use a new key for a late retry.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string): Person lookup key. Prefer the opaque `usr_…` id. When your organization has Partner unique ID on, a `uniqueId` resolves next (ignoring case), then an email address; a value that is one person's unique ID and another person's email names no one (`404`). A legacy UUID still works. Path-encode `@` (`%40`).
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

## Personas

The personas in your organization, read-only. Send a persona's id when you invite a user: it decides where they work, in the orchestrator portal, a named portal or magic links only.

### `GET /v1/personas`: List personas

Lists the personas in your organization. When you invite a user with `POST /v1/users`, choose a persona from this list: it decides where the user works, in the orchestrator portal, a named portal or magic links only.

**Tokens:** personal access token, organization API key
**Scope required:** `team:read`

**Parameters**

- `userType` (query, string)
- `access` (query, string)
- `search` (query, string)

**Responses**

- `200` (object): The personas.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/personas`: Create a persona

Creates a persona, as the Personas page does: the same checks and the same record. A persona says where the people who hold it work: the orchestrator portal with a permission group's capabilities, one or more portals, or magic links only. Give it to people when you invite them (`POST /v1/users`) or later (`POST /v1/users/{id}/personas`).

A name another persona has answers `400`. A `portal` persona needs the Portals feature on your plan.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage personas.

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The persona.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/personas/{id}`: Change a persona

Changes the settings you send; the rest stay as they are. A change of permission group or `access` reaches everyone who holds the persona at once. The built-in Owner and Admin personas can't be changed.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage personas.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The persona.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/personas/{id}`: Delete a persona

Deletes a persona. When people hold it, send `reassignToPersonaId`: they get that persona instead, in the same change. The Owner and Admin personas can't be deleted.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage personas.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Done.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/personas/{id}/duplicate`: Duplicate a persona

Copies a persona: where its people work, its portals, its permission group, colour and description, with any setting you send changed. Nobody holds the copy, and it is never the default. The Owner persona can't be copied.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage personas.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The copy.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/personas/{id}/members/{userId}`: Take a persona from a person

Takes this persona from one person who holds it, internal or external (`userId` is their id from `GET /v1/users`). A person keeps at least one persona: taking their last answers `400 LAST_PERSONA`. The organization keeps at least one owner.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage personas.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `userId` (path, required, string)

**Responses**

- `200` (object): Done.
- `400` (ErrorResponse): Refused: `LAST_PERSONA`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/users/{id}/personas`: Give an external user a persona

Gives an external user one more persona, as their page in People does. Only an external persona (`GET /v1/personas?userType=external`): an internal one answers `400 PERSONA_TYPE_MISMATCH`. A `portal` persona needs the Portals feature on your plan. With a personal access token you can only give access you hold yourself.

**Permission for a personal access token:** Invite external users.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Done.
- `400` (ErrorResponse): Refused: `PERSONA_TYPE_MISMATCH`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/users/{id}/personas/{personaId}`: Take a persona from an external user

Takes one persona from an external user. They keep at least one: taking their last answers `400`.

**Permission for a personal access token:** Invite external users.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string)
- `personaId` (path, required, string)

**Responses**

- `200` (object): Done.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/permission-groups`: List permission groups

Lists your organization's permission groups: what the people who hold an orchestrator-portal persona may do. A persona names its group in `permissionGroupId`.

**Permission for a personal access token:** Manage permission groups.

**Tokens:** personal access token, organization API key
**Scope required:** `team:read`

**Responses**

- `200` (object): The permission groups.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/permission-groups`: Create a permission group

Creates a permission group from capability bundles, as the Permission groups page does. You can only grant capabilities you hold yourself: a bundle beyond them answers `403`. A name another group has answers `409 DUPLICATE`. Give the group to people through a persona's `permissionGroupId`.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage permission groups.

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The permission group.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `DUPLICATE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/permission-groups/{id}`: Change a permission group

Changes a group's name, description or bundles. Everyone whose persona carries the group gets the change at once. You can only grant capabilities you hold yourself. The Owner group can't be changed, and the Admin group keeps its name and description.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage permission groups.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The permission group.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/permission-groups/{id}`: Delete a permission group

Deletes a group your organization made. A built-in group, or one a persona or a person still has, can't be deleted: move them to another group first.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage permission groups.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Done.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/permission-groups/{id}/duplicate`: Duplicate a permission group

Copies a group's capabilities into a new group nobody has yet. The Owner group can't be copied.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage permission groups.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The copy.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/permission-groups/{id}/reset-to-default`: Reset a built-in permission group

Puts the Owner, Admin or Member group back to the capabilities it comes with. Any other group answers `400 NOT_SYSTEM_GROUP`. You can only reset a group to capabilities you hold yourself.

Creating and changing personas needs the Personas feature on your plan; without it, the response is `403 FEATURE_DISABLED` with `error.feature`.

This runs as the person who owns the token, with exactly their permissions in Moxo, and is recorded as theirs. An organization API key gets `403 PERSON_TOKEN_REQUIRED`.

**Permission:** Manage permission groups.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The permission group.
- `400` (ErrorResponse): Refused: `NOT_SYSTEM_GROUP`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Accounts

Group external users by the company they belong to, for reporting, for filtering and to give everyone at a company access to the same flows.

### `GET /v1/accounts`: List accounts

Returns the accounts in your organization. Filter by `status` (`ACTIVE` or `INACTIVE`), or send `search` to match part of a name or domain.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:read`

**Parameters**

- `status` (query, string)
- `search` (query, string)

**Responses**

- `200` (object): The accounts.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/accounts`: Create account

Creates an account. The response carries only the new id; call `GET /v1/accounts/{id}` for the full account.

**A domain another account has** is saved, as in the app, and `data.warnings` carries `ACCOUNT_DOMAIN_SHARED`: people are no longer matched to an account by that domain.

**Idempotent.** Send an `Idempotency-Key` header to make retries safe: a retry within 10 minutes returns the same account id and creates no second account. See Idempotency in the Introduction.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: CreateAccountRequest

**Responses**

- `201` (object): Created
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/accounts/{id}`: Get account

Returns the account and every external user linked to it.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/accounts/{id}`: Update account

Updates the account's name, domain or status. A domain another account in your organization already has is saved, as in the app, and `data.warnings` carries `ACCOUNT_DOMAIN_SHARED`: people are no longer matched to an account by that domain.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: UpdateAccountRequest

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/accounts/{id}`: Delete account

Deletes the account. External users linked to it are kept, still with `kind=external`; the account no longer appears on their details.

**Tokens:** personal access token, organization API key
**Scope required:** `external_users:write`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The account was deleted.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Relationships

A relationship is the standing link between people at your organization and the client they look after: who it is for, who on your side runs it, and everything that has been done with them. Name one by its `id`, as you would a flow or a template — or by the `externalRef` your own system already keys it on.

Name a person the way every other call does: by their user id (`usr_…`), their email, or, with Partner unique ID on, the unique ID your organization knows them by. The party takes `userIds`, `emails` and `uniqueIds`; a team member takes one of `userId`, `email` or `uniqueId`; the list filters `partyUserIds` and `teamUserIds` take any of the three. Every person in an answer carries their `userId`, `email` and `uniqueId`.

### `GET /v1/relationships`: List relationships

Returns the organization's relationships, one page at a time. Narrow by who is on them: `partyUserIds` for the people a relationship is for, `teamUserIds` for the people at your organization who look after it, `accountIds` for the accounts they are built on. `party` keeps only relationships built on people, or only those built on an account. The filters combine, so `partyUserIds` and `teamUserIds` together answer "what do we hold for this client that this banker looks after". A personal access token needs permission to see every relationship.

**Tokens:** personal access token, organization API key
**Scope required:** `relationships:read`

**Parameters**

- `party` (query, string): Keep only relationships built on `people`, or only those built on an `account`.
- `partyUserIds` (query, string): Only relationships any of these people are the party of — the client side — as a comma-separated list of people, each a user id, an email or a unique ID (up to 200). An id that is nobody here matches nothing; it never widens the answer.
- `teamUserIds` (query, string): Only relationships any of these people hold a seat on — your organization's side, lead or not — as a comma-separated list of people, each a user id, an email or a unique ID (up to 200).
- `accountIds` (query, string): Only relationships built on any of these accounts, as a comma-separated list of account ids (up to 200), the same ids `GET /v1/accounts` returns.
- `cursor` (query, string): The previous page's `nextCursor`.
- `limit` (query, integer): How many to return, 1 to 100. Defaults to 50.

**Responses**

- `200` (object): A page of relationships.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/relationships`: Create a relationship

Creates a relationship. `party` says who it is for; without it the call answers 400 `RELATIONSHIP_INCOMPLETE`. A reference already in use answers 409 `ALREADY_EXISTS` — send `PATCH` to change the one that is there. A person named in `party` who is on your own team answers 400 `PERSON_NOT_EXTERNAL`, and an id or email that is nobody here answers 400 `UNKNOWN_PERSON`. `externalRef` is optional: leave it out and Moxo mints one, so every relationship is addressable here however it was made. `name` is optional too — left out or blank, it is worked out from the party (the account’s name, or the people’s names). An email that is not yet a person here becomes an external user, and no invitation is sent. Send `Idempotency-Key` to make a retry return the first answer.

**Tokens:** personal access token, organization API key
**Scope required:** `relationships:write`

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: CreateRelationshipRequest

**Responses**

- `201` (object): The relationship that was created.
- `400` (ErrorResponse): Refused: `PERSON_NOT_EXTERNAL`, `RELATIONSHIP_INCOMPLETE`, `UNKNOWN_PERSON`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_EXISTS`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/relationships/{id}`: Get a relationship

Returns the relationship this path names, by its `id` or by your own `externalRef`. One in another organization is not found.

**Tokens:** personal access token, organization API key
**Scope required:** `relationships:read`

**Parameters**

- `id` (path, required, string): The relationship’s `id`, as every answer carries it. Your own `externalRef` works here too, so a system that keys this relationship on its own reference can use that instead.

**Responses**

- `200` (object): The relationship.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/relationships/{id}`: Update a relationship

Changes the relationship this path names, by its `id` or by your own `externalRef`. An omitted field keeps its current value, and a blank `name` counts as omitted; `team` and `party` replace what is there rather than adding to it. Unlike the upsert, this names one relationship you chose, so it changes one made in Moxo as readily as one made here. A key that is not here answers 404.

**Tokens:** personal access token, organization API key
**Scope required:** `relationships:write`

**Parameters**

- `id` (path, required, string): The relationship’s `id`, as every answer carries it. Your own `externalRef` works here too, so a system that keys this relationship on its own reference can use that instead.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: UpdateRelationshipRequest

**Responses**

- `200` (object): The relationship as it now stands.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `DELETE /v1/relationships/{id}`: Delete a relationship

Removes the relationship this path names, by its `id` or by your own `externalRef`. Like the update, it removes one made in Moxo as readily as one made here. Nothing inside it is touched: every flow keeps running, every project stays open, and the conversation stays as an ordinary conversation under the name the people in it already saw.

**Tokens:** personal access token, organization API key
**Scope required:** `relationships:write`

**Parameters**

- `id` (path, required, string): The relationship’s `id`, as every answer carries it. Your own `externalRef` works here too, so a system that keys this relationship on its own reference can use that instead.

**Responses**

- `200` (object): The relationship is gone.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/relationships/bulk`: Create relationships in bulk

Creates up to 100 relationships in one call, each keyed by your own `externalRef`. A row whose reference is already here updates that relationship instead, so a core system can send the rows it holds and let Moxo work out which are new. One refused row does not stop the others, and each refusal is in `errors` with its code. `dry_run=true` counts what would happen and writes nothing. A relationship made in Moxo is counted in `failed` with 409 `NOT_FEED_OWNED` and left as it is — a bulk sync must not overwrite hand-built work on a collision, while `PATCH` and `DELETE` name one relationship you chose and act on any of them. An unknown email on a row that is written becomes an external user, and no invitation is sent.

**Tokens:** personal access token, organization API key
**Scope required:** `relationships:write`

**Parameters**

- `dry_run` (query, string): When `true`, nothing is written.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: BulkRelationshipsRequest

**Responses**

- `200` (object): How many rows were created, updated, unchanged or refused.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `NOT_FEED_OWNED`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `POST /v1/relationships/{id}/conversation`: Open the relationship’s conversation

Opens the one conversation a relationship has — the team on your side with the people it is for — and returns its `conversationId`. **This is the only conversation call that lives under a relationship.** It exists because until someone writes there is no room and so no id to address; from the id onwards the room is an ordinary conversation, so sending more messages, uploading files, adding actions, reading participants and everything else is `/v1/conversations/{conversationId}/…`. `GET /v1/relationships/{id}` carries the same `conversationId` once the room is open, so a caller that already has it never needs this call.

The room is made by its first message, as it is in the app, so `body` is what opens it. Calling this again once the room is open posts that message and answers the same `conversationId` with `created: false`.

A personal access token only: a message has an author, and an organization key has no person behind it. The token’s owner must be on the relationship’s team — this conversation is theirs with the people it is for, and nobody else writes in it. When the organization has turned off the firm writing first, a room that does not exist yet answers 403 `AWAIT_FIRST_WORD`: wait for them to write.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The relationship’s `id`, as every answer carries it. Your own `externalRef` works here too, so a system that keys this relationship on its own reference can use that instead.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: RelationshipMessageRequest

**Responses**

- `200` (object): The conversation, and the message in it.
- `201` (object): The conversation was opened.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

## Meetings

Your own meetings: the calls your connected calendar and recorders bring in, Moxo's short recap of each, and linking them to work. Only you see yours, so these endpoints need a personal access token. Moxo does not keep transcripts.

### `GET /v1/meetings`: List your meetings

Returns your meetings, newest first, from two weeks ahead to ninety days back, each with one status.

Meetings come from the calendar and the recorders you connect in Moxo (Settings, My meetings), and only you see yours. Moxo keeps a short recap of each call; it does not keep the transcript. Meetings needs your organization to have the Conductor turned on: otherwise the answer is `403 MEETINGS_NOT_AVAILABLE`.

Needs a personal access token: an organization API key is not a person, so it gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `filter` (query, string): `all` (the default), `needs_you` (calls with next steps waiting for you) or `upcoming`.
- `q` (query, string): Only meetings whose title, or the name of the work they are about, contains this.

**Responses**

- `200` (object): Your meetings.
- `400` (ErrorResponse): A query parameter is not valid.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/meetings/{id}`: Get one of your meetings

Returns one of your meetings with its recap, who was on it, and what it is about. Another person's meeting, and one you removed, answers `404`.

Meetings come from the calendar and the recorders you connect in Moxo (Settings, My meetings), and only you see yours. Moxo keeps a short recap of each call; it does not keep the transcript. Meetings needs your organization to have the Conductor turned on: otherwise the answer is `403 MEETINGS_NOT_AVAILABLE`.

Needs a personal access token: an organization API key is not a person, so it gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The meeting.

**Responses**

- `200` (object): The meeting.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/meetings/{id}`: Remove a meeting, or undo that

"Remove this call": with `excluded: true` the call leaves every read at once, its recap goes and its minutes no longer count, and the answer is `null`. `false` within a minute undoes it and its recap is written again; after that it answers `404`, because Moxo keeps nothing of the call but what it needs to recognise it.

Meetings come from the calendar and the recorders you connect in Moxo (Settings, My meetings), and only you see yours. Moxo keeps a short recap of each call; it does not keep the transcript. Meetings needs your organization to have the Conductor turned on: otherwise the answer is `403 MEETINGS_NOT_AVAILABLE`.

Needs a personal access token: an organization API key is not a person, so it gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The meeting.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The meeting, or `null` once removed.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/meetings/{id}/links`: Say what a meeting is about

Says which flow, project or conversation one of your meetings is about, as "This call is about · Change" does in the app. It replaces what was there, Moxo's own match included. You need to see it: a flow you can open, a project you are a member of, a conversation you are in; anything else answers `404 LINK_TARGET_NOT_FOUND`. Sending the same work twice changes nothing. A recurring meeting keeps your choice: its next meetings are about the same work.

Meetings come from the calendar and the recorders you connect in Moxo (Settings, My meetings), and only you see yours. Moxo keeps a short recap of each call; it does not keep the transcript. Meetings needs your organization to have the Conductor turned on: otherwise the answer is `403 MEETINGS_NOT_AVAILABLE`.

Needs a personal access token: an organization API key is not a person, so it gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The meeting.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The meeting, with what it is about.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/meetings/{id}/links/{linkId}`: Say a meeting is not about that work

Clears what one of your meetings is about ("Not about any of these"). The work itself is not changed.

Meetings come from the calendar and the recorders you connect in Moxo (Settings, My meetings), and only you see yours. Moxo keeps a short recap of each call; it does not keep the transcript. Meetings needs your organization to have the Conductor turned on: otherwise the answer is `403 MEETINGS_NOT_AVAILABLE`.

Needs a personal access token: an organization API key is not a person, so it gets `403 PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The meeting.
- `linkId` (path, required, string): The meeting's `about.id`.

**Responses**

- `200` (object): The meeting.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Desks

A desk is a shared queue a team picks work from. When a template gives a role to a desk, every step for that role goes to the desk's queue. Read-only here: desks are set up in the app.

### `GET /v1/desks`: List desks

Returns the desks in your organization: shared queues a team picks work from. Use these ids to look up the `desk.id` on flows and steps.

**Tokens:** personal access token, organization API key
**Scope required:** `team:read`

**Parameters**

- `search` (query, string): Part of the desk name, not case-sensitive.

**Responses**

- `200` (object): The desks.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/desks/{id}`: Get desk

Returns the desk and its members.

**Tokens:** personal access token, organization API key
**Scope required:** `team:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The desk.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Organization

The organization a token belongs to, search across its flows, templates and external users, and its audit trail. Each answers what the token's person sees in the app; an organization API key reads within its scopes.

### `GET /v1/organization`: Get your organization

Returns the organization the token belongs to: its id, name, slug, and the company name external users see on emails and portals. Call it first to confirm which organization a token reaches. Any valid token can call it.

**Tokens:** personal access token, organization API key
**Scope required:** none

**Responses**

- `200` (object): The organization.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/search`: Search

Finds flows, templates and external users whose name contains `query`, not case-sensitive. Flows also match on their number and on the values of their flow fields (`customFields` on `GET /v1/flows/{id}`: what was given at the start, or a form answer saved to a flow field, for example a company name; an answer kept only on its step is not searched), templates on their description, and external users on their email. Up to `limit` results in all, shared across the three kinds, each with its `type` and the `id` the other endpoints take; a flow says whether it matched on its name or its answers (`matchedIn`).

A personal access token finds what its person sees in the app: the flows on their Flows list, matched only on the field values their flow page shows them, the templates they may open, and external users only when they may view the external user directory. An organization API key finds each kind its scopes can read: flows with `flows:read`, templates with `templates:read`, external users with `external_users:read`. A key with none of them gets `403 INSUFFICIENT_SCOPE`.

**Tokens:** personal access token, organization API key
**Scope required:** `flows:read` or `templates:read` or `external_users:read`

**Parameters**

- `query` (query, required, string): Text to find in names (and a flow's field values), at least 2 characters. Not case-sensitive.
- `limit` (query, integer): Results in all, 1 to 50. Defaults to 30, shared across the three kinds.

**Responses**

- `200` (object): The matches: flows first, then templates, then external users.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/audit-log`: List audit events

Returns the organization's audit events, newest first: flows started and finished, steps done, people assigned, and more. Narrow them by flow, event type, who caused them, or time. One flow's activity, as its page shows it, is `GET /v1/flows/{id}/audit-log`.

A personal access token reads the events of flows its person can see, and only the notes they may read on each. Events on no flow, such as sign-ins, invitations and key changes, need the audit log on the organization's plan and the person's permission to view it. An organization API key reads every flow's events, and events on no flow only with `audit:read` too.

`total` counts the matching events you can read. An empty page with `incomplete: true` means the call stopped reading before it found one you can read, not that nothing happened: narrow the filters.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Parameters**

- `flowId` (query, string): Only events on this flow.
- `eventType` (query, string): Only events of this type.
- `actorId` (query, string): Only events caused by this user (`usr_` id).
- `person` (query, string): Only events about one person: what they did and what was done to them, under any email they had. Takes their `usr_` id or, with Partner unique ID on, their unique ID; never an email. An ID that names no one matches nothing.
- `actorKinds` (query, string): Only events caused by these kinds of actor, comma-separated: `internal` and `external` users, `system`, `agent` (an AI agent) or `api` (an API key). Any listed kind matches. A user's kind is the one they have now, so a deactivated or removed internal user's events stay `internal`. With `actorId`, both must match.
- `dateRange` (query, string): Only events in the last 7, 30, 90 or 180 days.
- `since` (query, string): Only events on or after this time (ISO 8601). With `dateRange`, the later of the two applies.
- `until` (query, string): Only events on or before this time (ISO 8601). With `since`, a window between the two.
- `limit` (query, integer): Events to return, 1 to 100. Defaults to 25.

**Responses**

- `200` (object): The events.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Conversations

Group conversations and flow chats. The list includes both by default: send `kind=group` for group conversations only, or `kind=flow` for flow chats only. Detail, messages and files under `/v1/conversations/{id}` take group conversation ids only. A flow's chat is on `GET /v1/flows/{id}/messages` (scope `chat:read`). Scopes: `conversations:read` and `conversations:write`.

### `GET /v1/conversations`: List conversations

Lists group conversations and, by default, the flow chats in the Messages inbox, most recent activity first.

Send `kind=group` for group conversations only, with no flow chats. `kind=flow` returns flow chats only. Leaving `kind` out, or `kind=all`, returns both.

A personal access token sees exactly the chats its person sees in the Messages inbox, with unread counts. An organization API key sees every group conversation in the organization, with no unread count or role. It sees flow chats only when the key also has `chat:read`, the scope for the chat inside flows; without it, `kind=flow` returns 403 and other requests list group conversations only. `filter=unread` and `filter=managed_by_me` are a person's view and return 400 for an organization API key.

Page with `cursor`: send the previous page's `nextCursor` as it is. A cursor this list didn't issue returns 400. A flow's chat history is on `GET /v1/flows/{id}/messages` (scope `chat:read`).

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `search` (query, string): Text to find in the title or the last message, not case-sensitive.
- `kind` (query, string): Which conversations to return: `group` for group conversations only, `flow` for flow chats only, or `all` for both. Defaults to `all`.
- `filter` (query, string): Chats with unread messages, or chats you manage. Needs a personal access token.
- `includeArchived` (query, boolean)
- `scope` (query, string): A personal access token with View all conversations, on a plan that allows it, sends `all` for every group conversation. The default, `mine`, is the conversations they are in. An organization API key already lists every group conversation; `scope` does not change that.
- `limit` (query, integer): Items per page, up to 200. Defaults to 50.
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the first page.

**Responses**

- `200` (object): A page of conversations.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations`: Create a group conversation

Starts a group conversation. Requires Group Chat on the organization's plan. Each participant entry takes the `userId` or `email` of someone already in the organization; an entry that matches nobody returns 400, naming it.

With a personal access token, the token's person starts the conversation and becomes its manager, under the same rules as the app (a portal user may be limited to people they already work with, and anyone they may not add returns 403, whether or not that person exists).

With an organization API key, name the person on your team who starts it in `startedBy`: they become its manager. Without `startedBy` the response is `400 CONVERSATION_NEEDS_CREATOR`; with someone outside your team, `400 CREATOR_NOT_INTERNAL`. The conversation is recorded as started through your API key.

**Products.** An organization with no Moxo product has read-only chats: a new conversation or message returns `403 FEATURE_DISABLED` with `error.feature: "haiChat"`. Reading still works.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:write`

**Request body**

- `application/json`: CreateConversation (required)

**Responses**

- `201` (object): The new conversation.
- `400` (ErrorResponse): Refused: `CONVERSATION_NEEDS_CREATOR`, `CREATOR_NOT_INTERNAL`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/unread-count`: Count unread conversations

Returns how many conversations have unread messages for the person behind the token. Unread is per person, not organization-wide.

**Tokens:** personal access token

**Responses**

- `200` (object): The unread count.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}`: Get a group conversation

Returns a group conversation and its participants. A flow id, or a conversation the token's person is not in, returns 404. An organization API key reads any group conversation in its organization, without a role or unread count.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The conversation.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/conversations/{id}`: Rename a conversation

Changes the title. Only a manager of the conversation can rename it. The title it already has changes nothing, and posts no "renamed" line in the chat: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use the manager's personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: PatchConversation (required)

**Responses**

- `200` (object): The conversation, as it is now.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/conversations/{id}`: Delete a conversation

Deletes the conversation for everyone. Only a manager of the conversation can delete it. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use the manager's personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/archive`: Archive a conversation

Only a manager of the conversation can do this. A conversation already archived stays as it was, with its archive time: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use the manager's personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Done
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/unarchive`: Unarchive a conversation

Only a manager of the conversation can do this. A conversation that isn't archived stays as it was: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use the manager's personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Done
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/join`: Join a conversation

Takes a seat in a group conversation you can read but are not in. Needs the View all conversations permission, on a plan that allows it. Already being in it changes nothing. An organization API key gets 403.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): You are in the conversation.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/participants`: List participants

Lists the participants of a group conversation.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Participants
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/participants`: Add participants

Adds people to the conversation. Each entry takes the `userId` or `email` of someone already in the organization; an entry that matches nobody returns 400, naming it.

With a personal access token, its person must manage the conversation, under the same rules as the app. With an organization API key, your organization adds them: the conversation shows your organization as having added them, and the change is recorded against your API key, never a person. An archived conversation returns 409. Naming only people already in the conversation adds nobody: the answer says `changed: false`.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: AddConversationParticipants (required)

**Responses**

- `201` (object): Added
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Conflict: the request can't be applied to the resource as it is now. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/conversations/{id}/participants/{userId}`: Change a participant's role

Makes a participant a `manager` or a `member`. Only a manager can do this. The role they already have changes nothing: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use the manager's personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `userId` (path, required, string): The participant's user id.

**Request body**

- `application/json`: object (required)

**Responses**

- `200` (object): Updated
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/conversations/{id}/participants/{userId}`: Remove a participant

Removes one person from the conversation. Only a manager can do this. Someone not in the conversation is not removed: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use the manager's personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `userId` (path, required, string): The participant's user id.

**Responses**

- `200` (object): Removed
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/leave`: Leave a conversation

Takes you out of a group conversation. For people on the team: someone outside the organization gets 403 `EXTERNAL_CANNOT_LEAVE`, and a direct chat answers 400 `DIRECT_CHAT`. Someone from your team has to stay: when you are the last one who can still be reached, the answer is 409 `LAST_TEAMMATE`. The owner names who owns the conversation next in `nextOwnerUserId` (400 `NEXT_OWNER_REQUIRED` without it, 400 `INVALID_OWNER` when that person is not a teammate in it); anyone else leaves it out (400 `NOT_THE_OWNER`). Not being in the conversation changes nothing: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Left
- `400` (ErrorResponse): Refused: `DIRECT_CHAT`, `INVALID_OWNER`, `NEXT_OWNER_REQUIRED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `LAST_TEAMMATE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/conversations/{id}/owner`: Make someone the owner

Hands the conversation to a teammate in it, who becomes its owner and a manager. Only the owner can do this (403 `NOT_THE_OWNER`); they stay a manager. Someone outside the organization, or a teammate who is not in it or can no longer be reached, is refused with 400 `INVALID_OWNER`. Naming the owner changes nothing: the answer says `changed: false`. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object (required)

**Responses**

- `200` (object): Updated
- `400` (ErrorResponse): Refused: `INVALID_OWNER`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/feeds`: Get conversation feeds

Returns the messages, files and actions of a **group** conversation in one list, newest first. File and action rows carry basic fields only: download files with Download file and read an action with Get action. Page with `cursor` (the previous page's `nextCursor`); rows that share a timestamp are never skipped. A cursor this feed didn't issue, or an unknown `types` value, returns 400. A flow's chat history is on `GET /v1/flows/{id}/messages` (`chat:read`).

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)
- `types` (query, string or list of string): Which rows to return, comma-separated or repeated: `message`, `file`, `action`. Defaults to all three. Any other value returns 400.
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the first page.
- `limit` (query, integer): Items per page, up to 200. Defaults to 50.

**Responses**

- `200` (object): A page of the feed.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/messages`: List messages

Lists the messages of a group conversation. The first page is the latest messages, and each `nextCursor` pages further back; within a page, messages run oldest to newest, the order the thread reads in. Rows that share a timestamp are never skipped. Same order and cursor as the SDK and the MCP tool `get_conversation` with `view: "messages"`. For messages, files and actions in one list, use Get conversation feeds.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the latest page.
- `limit` (query, integer): Items per page, up to 200. Defaults to 50.

**Responses**

- `200` (object): A page of messages.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/messages`: Send a message

Posts a message in a group conversation.

With a personal access token, the message is from the token's person, sent exactly as the app sends it (they must be in the conversation, and posting clears their own unsent drafts there). A mention id that matches nobody returns 400, naming it.

With an organization API key, the message is posted by your organization and labeled with its name, like a Send to conversation step. It can't reply in a thread or mention people (`parentMessageId` and `mentionedUserIds` return 400).

An archived conversation returns `409 CONVERSATION_UNAVAILABLE`, with either token.

In a conversation with an external user on WhatsApp, while the organization sends WhatsApp without links, a person's message with a web address returns `422 LINK_NOT_ALLOWED` and posts nothing.

Send an `Idempotency-Key` to retry safely: a retry with the same key returns 201 with the original message and posts nothing.

**Products.** An organization with no Moxo product has read-only chats: a new conversation or message returns `403 FEATURE_DISABLED` with `error.feature: "haiChat"`. Reading still works.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key of up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing is posted. A retry with the same key within 10 minutes returns the original message instead of posting it twice.

**Request body**

- `application/json`: SendConversationMessage (required)

**Responses**

- `201` (object): The message: the new one, or the original one when this is a retry with the same `Idempotency-Key`.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONVERSATION_UNAVAILABLE`. The description says when; `error.code` says which.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `422` (ErrorResponse): Refused: `LINK_NOT_ALLOWED`. The description says when; `error.code` says which.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `DELETE /v1/conversations/{id}/messages/{messageId}`: Delete a message

Deletes a message; it stays in the thread as "This message was deleted". Its author or a manager of the conversation can do this. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use their personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `messageId` (path, required, string)

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/read`: Mark a conversation read

Marks the conversation read for the token's person, up to `messageId` or, with no body, up to the latest message. A `messageId` that isn't a message in this conversation that the person can see returns 404.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The conversation is marked.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/unread`: Mark a conversation unread

Marks the conversation unread for the token's person, from `messageId` onward or, with no body, all of it. A `messageId` that isn't a message in this conversation that the person can see returns 404.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The conversation is marked.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/files`: List files

Lists the files and folders shared in the conversation. Files in unsent drafts are not listed.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): The files and folders.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/files`: Upload a file

Uploads one file in a single call. Send `multipart/form-data` with the file in a part named `file`, and optionally a text field `folderId` to put the file in a folder. The response describes the finished file. A file can be at most 100 MB, and a file that fails its virus check is refused. Your organization's upload rules apply too: a file over their size limit returns `413 FILE_TOO_LARGE`, and a kind of file they don't allow returns `415 UPLOAD_TYPE_NOT_ALLOWED`, with the kinds they allow in the message. A body that isn't `multipart/form-data` returns `415 UNSUPPORTED_MEDIA_TYPE`. With an organization API key, your organization shares the file and nobody is named as its uploader.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `multipart/form-data`: object (required)

**Responses**

- `201` (object): The uploaded file.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `413` (ErrorResponse): Refused: `FILE_TOO_LARGE`. The description says when; `error.code` says which.
- `415` (ErrorResponse): Refused: `UNSUPPORTED_MEDIA_TYPE`, `UPLOAD_TYPE_NOT_ALLOWED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/files/upload-init`: Get an upload link for a file

Returns a signed upload link for one file, for a file too large to send in one call. `PUT` the bytes to `uploadUrl` with every header in `requiredHeaders`, then `POST` to `completionUrl` (no body): that finishes the file and starts its virus check. A file can be at most 2 GB, and counts toward your organization's storage (`402` when it is full).

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:write`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: ConversationUploadInit (required)

**Responses**

- `201` (object): The upload link.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): The organization's plan or quota does not allow this now.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/files/{fileId}/complete`: Finish an upload

Finishes a file uploaded to the link from Get an upload link, and starts its virus check: the `completionUrl` that call returned. A file whose bytes have not landed yet returns `409 UPLOAD_NOT_LANDED`; finish the `PUT`, then call again.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:write`

**Parameters**

- `id` (path, required, string)
- `fileId` (path, required, string)

**Responses**

- `202` (object): The file is being checked; it is listed once its virus check passes.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `UPLOAD_NOT_LANDED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/files/{fileId}/download-url`: Download a file

Returns short-lived links to download and preview the file. A file that didn't pass its virus check isn't available.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)
- `fileId` (path, required, string)

**Responses**

- `200` (object): The download and preview links.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/conversations/{id}/files/{fileId}`: Delete a file

Removes the file from the conversation, under the same rules as the app. An organization API key gets 403 `ORG_KEY_NOT_SUPPORTED`: use a personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `fileId` (path, required, string)

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/conversations/{id}/folders`: Make a folder

Makes a folder in the conversation's files, as **New folder** does in Moxo. Everyone in the conversation sees it. Put files in it with `folderId` when you upload them. A name already used beside it returns `409 DUPLICATE_FOLDER`.

Anyone in the conversation can do this, as in Moxo; someone who isn't in it gets `404`, and an archived conversation can't be changed (`409 CONVERSATION_UNAVAILABLE`). Your plan must include group conversations (`403 FEATURE_DISABLED`). It is recorded as the token's person, so an organization API key gets `403 ORG_KEY_NOT_SUPPORTED`: use a personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The conversation.

**Request body**

- `application/json`: CreateConversationFolder (required)

**Responses**

- `201` (object): The folder, as List files returns it.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONVERSATION_UNAVAILABLE`, `DUPLICATE_FOLDER`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/conversations/{id}/folders/{folderId}`: Rename a folder

Renames a folder in the conversation's files. A name already used beside it returns `409 DUPLICATE_FOLDER`, and a folder that isn't in this conversation returns `404`.

Anyone in the conversation can do this, as in Moxo; someone who isn't in it gets `404`, and an archived conversation can't be changed (`409 CONVERSATION_UNAVAILABLE`). Your plan must include group conversations (`403 FEATURE_DISABLED`). It is recorded as the token's person, so an organization API key gets `403 ORG_KEY_NOT_SUPPORTED`: use a personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The conversation.
- `folderId` (path, required, string): The folder, as List files returns it.

**Request body**

- `application/json`: RenameConversationFolder (required)

**Responses**

- `200` (object): The folder, as List files returns it.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONVERSATION_UNAVAILABLE`, `DUPLICATE_FOLDER`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/conversations/{id}/folders/{folderId}`: Remove a folder

Removes a folder and every folder inside it from the conversation's files. The files in them are not deleted: they stay in the conversation, in no folder. A folder that isn't in this conversation returns `404`.

Anyone in the conversation can do this, as in Moxo; someone who isn't in it gets `404`, and an archived conversation can't be changed (`409 CONVERSATION_UNAVAILABLE`). Your plan must include group conversations (`403 FEATURE_DISABLED`). It is recorded as the token's person, so an organization API key gets `403 ORG_KEY_NOT_SUPPORTED`: use a personal access token.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string): The conversation.
- `folderId` (path, required, string): The folder, as List files returns it.

**Responses**

- `200` (object): The folder is gone.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `CONVERSATION_UNAVAILABLE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/actions`: List actions

Lists the actions sent in this conversation, newest first, paged with `cursor`. A flow id returns 404.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)
- `cursor` (query, string): The previous page's `nextCursor`. Omit for the first page.
- `limit` (query, integer): Items per page, up to 200. Defaults to 50.

**Responses**

- `200` (object): The actions.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/conversations/{id}/actions/{actionId}`: Get action

Returns one action in this conversation, however long ago it was sent. A flow id returns 404.

**Tokens:** personal access token, organization API key
**Scope required:** `conversations:read`

**Parameters**

- `id` (path, required, string)
- `actionId` (path, required, string)

**Responses**

- `200` (object): The action.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## External tasks

Work a template hands to your own systems, when those systems can't accept calls from Moxo. When a flow reaches a Wait set to **Your system picks up a task**, an external task opens under the Wait's task name. Your system claims open tasks, does the work, then completes each one with values or fails it with a reason. A claim is held for a set time, so a worker that stops never keeps a task. No callback URL is created. Every endpoint here needs an organization API key: `flows:read` to list, `flows:write` for everything else. A personal access token gets `403 ORG_KEY_REQUIRED`.

## How your system connects

Every call goes out from your network. Moxo never calls in.

1. **Set up the Wait.** In the template builder, set a Wait to **Your system picks up a task**. Give it a task name (for example `verify-account`), choose the values it sends from earlier steps (for example the account ID a person entered), and map the values your system sends back (for example `verified`).
2. **Create an organization API key** with `flows:write` in **Settings → API keys**.
3. **Run a worker** that checks for tasks every few seconds or minutes:
   - `POST /v1/external-tasks/claim {"taskName": "verify-account", "workerName": "verifier-1"}` claims up to 10 waiting tasks in one call. Each comes with its `id`, `values` and `lockToken`, and is held for you until `lockedUntil`. An empty list means nothing is waiting.
   - Do the work in your own systems. If it takes longer, call `POST /v1/external-tasks/{id}/extend {"lockToken": "…"}`.
   - Finish with `POST /v1/external-tasks/{id}/complete {"lockToken": "…", "values": {"verified": true}}` and an `Idempotency-Key`, so a retry completes the task once.
   - If your system couldn't do the work, for example because another system was down, call `POST /v1/external-tasks/{id}/fail {"lockToken": "…", "reason": "Core banking did not answer.", "retryInMinutes": 10}`. The task comes back after the pause. After the last try, the step fails on the flow and a flow manager can retry it.
4. **Send answers as values.** "Not verified" is an answer: send `{"verified": false}` and branch on it with a Decision after the Wait. Use fail only when your system couldn't do the work.

Two copies of a worker never get the same task. When a worker stops, its hold runs out and the task goes back to the queue. Every claim gets its own `lockToken`, shown once. Extend, complete and fail need it, so a worker whose hold ran out can't finish, fail or extend the claim that came after it (`409 LOCK_EXPIRED`). Completing or failing a task whose step was reopened, skipped or canceled returns `409 STEP_NOT_ACTIVE` and changes nothing. `workerName` is a label shown on the flow page.

An organization API key reaches every flow in its organization, but receives only the values each Wait sends.

### `POST /v1/external-tasks/claim`: Claim tasks

Claims open tasks in one call: up to `max` tasks with this `taskName` (default 10, at most 50), each held for you for `lockMinutes` (1 to 60; defaults to the Wait’s own setting, 15). Send an optional `workerName` to say which of your workers holds them; the flow shows it, or the API key’s name if you send none. Returns each task’s `id`, its flow, its `values`, `attempt`, `lockedUntil` and its `lockToken`: keep the token and send it with extend, complete and fail. Two workers claiming at once never get the same task. An empty list means nothing is waiting.

A claim isn’t replayed for an `Idempotency-Key`, because its response carries lock tokens, which Moxo keeps only as hashes. If you lose a response, the tasks go back to the queue when their hold runs out.

Needs an organization API key. A personal access token gets `403 ORG_KEY_REQUIRED`.

**Tokens:** organization API key
**Scope required:** `flows:write`

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The tasks claimed for you. The list can be empty.
- `400` (ErrorResponse): The body is not valid.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/external-tasks/{id}/extend`: Extend a claim

Holds a claimed task for another `lockMinutes`. Send the `lockToken` from your claim. After the hold has run out, or once the task was claimed again, this returns `409 LOCK_EXPIRED`; claim again.

Needs an organization API key. A personal access token gets `403 ORG_KEY_REQUIRED`.

**Tokens:** organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The new end of the hold
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): `LOCK_EXPIRED` (your hold ran out; claim again), `TASK_NOT_CLAIMED`, `STEP_NOT_ACTIVE` (the task is done, or the flow moved on, was reopened or was canceled) or `FLOW_PAUSED`.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/external-tasks/{id}/complete`: Complete a task

Completes the task with `values`, the ones the Wait’s output mappings expect; later steps read them. Send your answer as values, for example `verified: false`, and branch on it with a Decision. Send the `lockToken` from your claim, and an `Idempotency-Key` so a retry completes the task once (a key belongs to one task). Returns `409 LOCK_EXPIRED` when your hold has run out or the task was claimed again, and `409 STEP_NOT_ACTIVE` when the task is done, or the flow moved on, was reopened or was canceled.

Needs an organization API key. A personal access token gets `403 ORG_KEY_REQUIRED`.

**Tokens:** organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The task is complete.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): `LOCK_EXPIRED` (your hold ran out; claim again), `TASK_NOT_CLAIMED`, `STEP_NOT_ACTIVE` (the task is done, or the flow moved on, was reopened or was canceled) or `FLOW_PAUSED`.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/external-tasks/{id}/fail`: Fail a task

Fails the task. Use it only when your system couldn’t do the work, with a `reason` people can read and the `lockToken` from your claim; a negative answer is values, not a failure. While tries are left, the task can be claimed again after `retryInMinutes` (default 1). After the last try, the step fails with your reason and the flow waits at it: the flow stays open, but the steps after it don’t start until a flow manager chooses Retry, which opens a new task.

Needs an organization API key. A personal access token gets `403 ORG_KEY_REQUIRED`.

**Tokens:** organization API key
**Scope required:** `flows:write`

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The try is recorded
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): `LOCK_EXPIRED` (your hold ran out; claim again), `TASK_NOT_CLAIMED`, `STEP_NOT_ACTIVE` (the task is done, or the flow moved on, was reopened or was canceled) or `FLOW_PAUSED`.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/external-tasks`: List tasks

Lists open, claimed and failed external tasks, filtered by `taskName`, `status` or `flowId`, with each task’s `values`. Read-only.

Needs an organization API key. A personal access token gets `403 ORG_KEY_REQUIRED`.

**Tokens:** organization API key
**Scope required:** `flows:read`

**Parameters**

- `taskName` (query, string)
- `status` (query, string): One or more of `open`, `claimed`, `completed`, `failed`, `closed`, separated by commas. Defaults to `open,claimed,failed`.
- `flowId` (query, string)
- `limit` (query, integer): Tasks per page, 1 to 100. Defaults to 50.
- `offset` (query, integer): How many tasks to skip: the previous `offset` plus `limit`.

**Responses**

- `200` (object): The tasks, newest first.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Webhooks

Start a flow from your own system with an incoming webhook, and resume a Wait step by calling the URL Moxo gave you. To have Moxo call your system when something happens, see [Webhooks](/docs/guides/webhooks).

### `GET /v1/templates/{id}/webhook-config`: Get a template's webhook settings

Returns the template's incoming webhook settings: the URL, how callers authenticate, the secret's fingerprint, whether it is on, and an optional condition filter. It only reads: it creates nothing and changes nothing. A template whose webhook was never set up answers with `secretPresent: false` and `enabled: false`; the first change makes it (`PATCH …/webhook-config`, `regenerate`, `reveal`, saving a mapping or listening for a test event). A personal access token needs edit access to the template (403 otherwise). An organization API key reads a `none` webhook's URL without its token, because the token is the secret. The webhook is on when the template's Webhook start mode is on: call `PATCH /v1/templates/{id}/webhook-config` with `{ "enabled": true }` (or `PATCH /v1/templates/{id}/trigger-activation`); nothing is needed in the template builder. `secret` is always `null` here: the secret itself is returned only by `regenerate`, `reveal` or a change of `authMethod`.

To start flows from a webhook: (1) `PATCH …/webhook-config` with `{ "enabled": true }`; (2) `POST …/webhook-config/regenerate` and store the `secret`; (3) optionally, `PUT …/webhook-config/mapping` so the sender can post its own JSON; (4) the sender sends a `POST` to `webhookUrl`.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /v1/templates/{id}/webhook-config`: Update a template's webhook settings

Three separate updates: send any of them, alone or together.

`enabled` turns the webhook on or off by turning the template's Webhook start mode on or pausing it, the same switch as the **Start Modes** panel in the template builder. The change survives later saves of the template and is recorded in the audit trail. Turning it off is a pause: the URL, secret, authentication method and conditions are kept, and turning it on again restores them. Turning it on for a template that never had a webhook creates the webhook and turns it on in one call.

`authMethod` changes how callers authenticate: `hmac`, `api_key` or `none`. Sending the method already in use changes nothing, and the secret keeps working; to make a new secret for the same method, use `POST /v1/templates/{id}/webhook-config/regenerate`. A different method creates a new secret, and the response includes it once. Store it. The secret it replaces stops working at once. For `none` the secret is the token in the URL, so `webhookUrl` changes too: going back to `none` after `hmac` or `api_key` never brings back an earlier URL.

`filter` is an AND/OR tree of conditions, checked against the sender's original payload before mapping. Send `null` or an empty object to accept every authenticated delivery.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/webhook-config/regenerate`: Regenerate webhook secret

Replaces the webhook's secret, and the response includes the new `secret` once, with `rotated: true`. Store it. Whether the webhook is on doesn't change; a template whose webhook was never set up gets one, turned on only if its Webhook start mode is on.

By default the old secret stops working at once, as it should after a leak: `previousKeyExpiresAt` is `null`. You can keep the old API key or HMAC signing secret working for up to 24 hours while the sender switches, with `previousKeyGraceSeconds`; `previousKeyExpiresAt` then says exactly when it stops, and `GET …/webhook-config` shows the same until then. During that time both keys start flows, or a signature made with either secret verifies. A URL token (`none`) always stops at once, so a grace for one is refused with 400 `PREVIOUS_KEY_GRACE_NOT_FOR_URL_TOKEN`. Changing `authMethod` stops the old secret at once too. `secretLast4` is the new secret's own last 4 characters.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `PREVIOUS_KEY_GRACE_NOT_FOR_URL_TOKEN`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/webhook-config/reveal`: Reveal the webhook secret

Returns the secret, for a screen that needs to show it again. Every call is recorded in the audit trail, with who saw the secret and when. An API key secret can't be shown again: Moxo keeps only a hash of it, so the call returns `409 SECRET_HASHED_ONLY`. Replace it with `/regenerate`, which shows the new one once. A template whose webhook was never set up gets one here (an `hmac` webhook, turned on only if its Webhook start mode is on), and this shows its first secret.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): `SECRET_HASHED_ONLY`: Moxo keeps only a hash of this API key secret, so it can't be shown. Replace it with `/regenerate`. `SECRET_NEEDS_REGENERATE`: this secret can no longer be used (`secretNeedsRegenerate`). Replace it with `/regenerate`.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/webhook-config/test-listen`: Check the test event

Says whether the test URL is listening, until when, and the newest test run a test event started (`lastTestFlowId`), so a script can wait for its test event and then read the run with `GET /v1/flows/{id}`. It only reads.

Needs a personal access token whose person can edit the template (403 otherwise): the test run is theirs. An organization API key gets 403 `PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Whether it is listening, and the newest test run.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/webhook-config/test-listen`: Listen for a test event

Starts listening for a test event, as **Listen for a test event** does in the template's webhook settings, and returns a new `testUrl`, valid for ten minutes (`listenUntil`). Send the sender's request to it, with the same authentication as the real URL: it starts a test run of the template as it is being edited (draft steps, and the mapping and conditions waiting for publish), with every role given to you, so nobody the payload names is contacted. It answers `201` with the test run, or `200` with status `skipped` when the payload does not meet the conditions. After the window, or once you stop, the test URL answers `409 NOT_LISTENING`; an unknown or replaced test URL answers `404`. Each call makes a new test URL, and the previous one stops working. A template whose webhook was never set up gets one here.

Needs a personal access token whose person can edit the template (403 otherwise): the test run is theirs. An organization API key gets 403 `PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The new test URL, and until when it listens.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `NOT_LISTENING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/templates/{id}/webhook-config/test-listen`: Stop listening for a test event

Stops listening: the test URL answers `409 NOT_LISTENING` until you listen again. Test runs already started keep running.

Needs a personal access token whose person can edit the template (403 otherwise): the test run is theirs. An organization API key gets 403 `PERSON_TOKEN_REQUIRED`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): It stopped listening.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `NOT_LISTENING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/templates/{id}/webhook-config/mapping`: Get the incoming webhook field mapping

Returns how the template's incoming webhook turns a sender's JSON into a flow start, or `payloadMapping: null` when there is none (senders then post Moxo's own `{ name, fieldValues, roleAssignments }` shape). This is the mapping being edited: a saved change waits for the template's next publish (`hasPendingSetup: true`). Fields are keyed by field id, and roles by `roleId`. A personal access token needs edit permission on the template (403 otherwise).

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/templates/{id}/webhook-config/mapping`: Save the incoming webhook field mapping

Saves the mapping that turns a sender's own JSON into a flow start, or removes it with `payloadMapping: null`. Name fields by `key`, label or id, and roles by name or `roleId`. Moxo stores them by id, so a later rename doesn't break the mapping, and the response shows what was saved. Live deliveries use the mapping once the template is next published; the template's test URL uses it at once. A template whose webhook was never set up gets one here, turned on only if its Webhook start mode is on. Mapping a person's profile fields needs permission to edit people (403 otherwise). A mapping that names a role or a start field the template doesn't have, or fixes a role to a value that is no email, phone or person, returns `400 VALIDATION_FAILED` naming each one, and nothing is saved: the same check the mapping test runs, and publish refuses a waiting mapping that fails it. A personal access token needs edit permission on the template (403 otherwise).

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): Refused: `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/webhook-config/mapping/test`: Test a mapping against a sample payload

Runs `mapping` over `samplePayload` and returns the flow start it would produce, checked the way a real delivery is: start fields against the template, role names against its roles, people by email or phone. Nothing is saved, no flow starts and no one is invited. A problem returns 400 with what to fix.

A `{{payload.…}}` token the sample has no value for would be empty text. The answer still succeeds, and `warnings` names each such token and where it is in the mapping (`UNRESOLVED_TOKEN`), so a typo in a path is not mistaken for an empty value. A value the sample does have, even an empty one, is not a warning. A personal access token needs edit permission on the template (403 otherwise).

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The flow start the mapping produces from the sample.
- `400` (ErrorResponse): The mapping produces a start the template would refuse (a field value, an unknown role, a person who can't be found), or the sample is not the mapping's `source`. The message says what to fix.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/webhooks/incoming/{templateId}/{pathToken}`: Start a flow with an incoming webhook (token)

Starts a flow from the latest published version of the template, using its secret webhook URL. A template that was never published returns 409 `TEMPLATE_NOT_PUBLISHED`, and an archived one 409 `TEMPLATE_ARCHIVED`. A payload that doesn't match the trigger's conditions is accepted with `200` and status `skipped`, and no flow starts. Send a unique `Idempotency-Key` for each event, and send the same one when you retry. Without an `Idempotency-Key`, a delivery whose body is exactly the same as one received in the last 30 seconds is treated as a retry: it answers `200` with the first flow and `idempotent: true`, and starts nothing. To start two flows from the same body within 30 seconds, send a different key with each. A delivery the template can't start a flow from (a start field that isn't on the template, a required one left out, a value of the wrong kind, a role nobody can fill) answers `400 VALIDATION_ERROR`; `error.message` names the field, and `error.roleId` the role. A role given an email no one in the organization has adds that person as an external user, listed in `addedUsers`, when the template's publisher (or, for a version with no recorded publisher, one of its owners) may add external users; when they lack that permission it answers `403 FORBIDDEN` (the endpoint's delivery log says who needs it). A new email on a role internal users fill answers `400 ROLE_NEEDS_INTERNAL_USER`. Nothing starts.

**Tokens:** none. The token in the webhook URL is the credential.

**Parameters**

- `templateId` (path, required, string): The template id, from the webhook URL in the template's settings.
- `pathToken` (path, required, string): The token in the webhook URL, from the template's settings.
- `Idempotency-Key` (header, string): A unique key for this event, up to 256 letters, digits, `-`, `_`, `:` or `.`. Send the same value when you retry. Any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and starts nothing.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The delivery was accepted: either the conditions didn't match, or it repeated an earlier delivery and returns that flow.
- `201` (object): The flow started.
- `400` (ErrorResponse): Refused: `ROLE_NEEDS_INTERNAL_USER`, `VALIDATION_ERROR`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): `IDEMPOTENCY_IN_PROGRESS`: a request with this `Idempotency-Key` is still running; retry after `Retry-After`. `TEMPLATE_NOT_PUBLISHED`: the template was never published, so it starts nothing ("This template isn't published yet. Publish it, or use its test URL."). `TEMPLATE_ARCHIVED`: the template is archived, so it starts nothing until it is restored. Nothing is recorded for either delivery, so if your system sends it again once the template is published or restored, it starts a flow. `START_PEOPLE_CHANGED`: someone with an email the delivery was adding joined your organization while the flow was starting; nothing was started or added, and sending it again (the same `Idempotency-Key` is fine) starts it with that person. `SIGNATURE_ALREADY_USED`: a delivery with this exact `X-Moxo-Signature` was already received and started no flow (the conditions skipped it, or it is still starting one), so this one starts nothing. Sign each new delivery with the current time. `WEBHOOK_ADDRESS_CHANGED`: the organization is served at another address now, so this one starts nothing; send the delivery to `error.webhookBaseUrl` followed by the same path, and change the address in the sending system.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/webhooks/incoming/{templateId}`: Start a flow with an incoming webhook (signed or key)

Starts a flow from the latest published version of the template. A template that was never published returns 409 `TEMPLATE_NOT_PUBLISHED`, and an archived one 409 `TEMPLATE_ARCHIVED`. An HMAC endpoint needs `X-Moxo-Signature: t=<unix-seconds>,v1=<hex-hmac>`, where the HMAC-SHA256 input is `<timestamp>.<raw-request-body>`, signed within 5 minutes of now; each signature starts at most one flow: the same signed request sent again, whatever its `Idempotency-Key`, answers `200` with the flow it started and `idempotent: true`, or 409 `SIGNATURE_ALREADY_USED` when the conditions skipped it. A request refused before a flow started can be sent again as it was. `X-Moxo-Signature` is recommended. The body-only `X-Webhook-Signature: <hex-hmac>` (the HMAC-SHA256 of the JSON body, no timestamp) is also accepted, and is not refused when sent again: only `Idempotency-Key`, or the same body within 30 seconds, answers with an earlier flow. When both are sent, `X-Moxo-Signature` is checked. An API key endpoint needs `X-API-Key`. A payload that doesn't match the trigger's conditions is accepted with `200` and status `skipped`, and no flow starts. Send a unique `Idempotency-Key` for each event, and send the same one when you retry. Without an `Idempotency-Key`, a delivery whose body is exactly the same as one received in the last 30 seconds is treated as a retry: it answers `200` with the first flow and `idempotent: true`, and starts nothing. To start two flows from the same body within 30 seconds, send a different key with each. A delivery the template can't start a flow from (a start field that isn't on the template, a required one left out, a value of the wrong kind, a role nobody can fill) answers `400 VALIDATION_ERROR`; `error.message` names the field, and `error.roleId` the role. A role given an email no one in the organization has adds that person as an external user, listed in `addedUsers`, when the template's publisher (or, for a version with no recorded publisher, one of its owners) may add external users; when they lack that permission it answers `403 FORBIDDEN` (the endpoint's delivery log says who needs it). A new email on a role internal users fill answers `400 ROLE_NEEDS_INTERNAL_USER`. Nothing starts. [Webhooks](/docs/guides/webhooks) shows how to sign a request.

**Tokens:** none. The signature (`X-Moxo-Signature`, or the body-only `X-Webhook-Signature`) or the `X-API-Key` header, whichever the template's webhook settings use, is the credential.

**Parameters**

- `templateId` (path, required, string): The template id, from the webhook URL in the template's settings.
- `X-Moxo-Signature` (header, string): For HMAC endpoints, recommended: `t=<unix-seconds>,v1=<hex-hmac>`. An HMAC endpoint needs this or `X-Webhook-Signature`.
- `X-Webhook-Signature` (header, string): For HMAC endpoints: the hex HMAC-SHA256 of the JSON body, with no timestamp. Read only when `X-Moxo-Signature` is absent.
- `X-API-Key` (header, string): Required for API-key endpoints.
- `Idempotency-Key` (header, string): A unique key for this event, up to 256 letters, digits, `-`, `_`, `:` or `.`. Send the same value when you retry. Any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and starts nothing.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The delivery was accepted: either the conditions didn't match, or it repeated an earlier delivery and returns that flow.
- `201` (object): The flow started.
- `400` (ErrorResponse): Refused: `ROLE_NEEDS_INTERNAL_USER`, `VALIDATION_ERROR`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): `IDEMPOTENCY_IN_PROGRESS`: a request with this `Idempotency-Key` is still running; retry after `Retry-After`. `TEMPLATE_NOT_PUBLISHED`: the template was never published, so it starts nothing ("This template isn't published yet. Publish it, or use its test URL."). `TEMPLATE_ARCHIVED`: the template is archived, so it starts nothing until it is restored. Nothing is recorded for either delivery, so if your system sends it again once the template is published or restored, it starts a flow. `START_PEOPLE_CHANGED`: someone with an email the delivery was adding joined your organization while the flow was starting; nothing was started or added, and sending it again (the same `Idempotency-Key` is fine) starts it with that person. `SIGNATURE_ALREADY_USED`: a delivery with this exact `X-Moxo-Signature` was already received and started no flow (the conditions skipped it, or it is still starting one), so this one starts nothing. Sign each new delivery with the current time. `WEBHOOK_ADDRESS_CHANGED`: the organization is served at another address now, so this one starts nothing; send the delivery to `error.webhookBaseUrl` followed by the same path, and change the address in the sending system.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/webhooks/incoming/{templateId}/test/{testToken}`: Send a test event to an incoming webhook

The template's separate test URL. It accepts deliveries only while someone listens for a test event, for ten minutes at a time: **Listen for a test event** in Moxo, or `POST /v1/templates/{id}/webhook-config/test-listen` with a personal access token, which returns this URL. A delivery then starts a labeled test run of the template's draft, with the trigger's unpublished mapping and conditions, so you can try a sender before the template is published. The endpoint's own authentication applies: with token authentication, the test token is the credential; an HMAC or API key endpoint also needs a signature (`X-Moxo-Signature`, or the body-only `X-Webhook-Signature`) or `X-API-Key`, exactly as on the real URL. Test deliveries ignore idempotency keys. A test run gives every role to the person listening and adds no one: an email the payload names is never added or written to. A start field that is not on the template, a required one left out, or a value of the wrong kind answers `400 VALIDATION_ERROR`, naming the field. A test URL whose listening window ended answers `409 NOT_LISTENING`; an unknown test URL, or one replaced by a newer listen, answers `404`.

**Tokens:** none. The test token in the URL is the credential, with the endpoint's own signature or `X-API-Key` when it uses one.

**Parameters**

- `templateId` (path, required, string): The template id.
- `testToken` (path, required, string): The token in the test URL that **Listen for a test event** shows, or that `POST /v1/templates/{id}/webhook-config/test-listen` returns.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The delivery was accepted, but the conditions didn't match, so no test run started.
- `201` (object): The test run started.
- `400` (ErrorResponse): Refused: `VALIDATION_ERROR`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): `NOT_LISTENING`: nobody is listening for a test event ("Not listening. Choose Listen for a test event first."). `WEBHOOK_ADDRESS_CHANGED`: the organization is served at another address now; send the delivery to `error.webhookBaseUrl` followed by the same path.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/webhooks/wait/{token}`: Complete a Wait step

Resumes a flow that is waiting at a Wait step. Call the Wait's unique callback URL, optionally with data that becomes the step's result. A token that is not a well-formed callback token (it was cut short or changed) returns `400 INVALID_TOKEN`.

**Tokens:** none. The token in the callback URL is the credential.

**Parameters**

- `token` (path, required, string): The Wait step's callback token.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The Wait step is complete.
- `202` (object): Accepted, not applied: the flow is paused (`accepted_pending_resume`, applied when it resumes) or the callback could not be recorded (`not_recorded`, send it again).
- `400` (ErrorResponse): Refused: `INVALID_TOKEN`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/webhooks/grok-bot/{token}/files`: Upload a file for a Grok Bot step

Uploads a file for a Grok Bot step that is waiting. Then complete the step with `{ fileId }` for a declared file output; don't send the document as a string. The organization's file upload limit applies, not the 1 MB limit on the Complete body. A token that is not a well-formed callback token (it was cut short or changed) returns `400 INVALID_TOKEN`.

**Tokens:** none. The Complete token in the URL is the credential.

**Parameters**

- `token` (path, required, string): Grok Bot Complete token

**Request body**

- `multipart/form-data`: object (required)

**Responses**

- `201` (object): The file is stored on this step.
- `400`: The upload is not valid. The step stays open.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/webhooks/grok-bot/{token}`: Complete a Grok Bot step

Completes an `AI_AGENT` step that Grok Bot accepted. A declared file field must be `{ fileId }` for a file uploaded with this token; a string is refused and the step stays open. A token that is not a well-formed callback token (it was cut short or changed) returns `400 INVALID_TOKEN`.

**Tokens:** none. The Complete token in the URL is the credential.

**Parameters**

- `token` (path, required, string): Grok Bot Complete token

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The step is complete, or its answer is recorded and waits for its review.
- `202` (object): Accepted, not applied yet: recorded and applied later (`accepted_pending_resume`: the flow is paused and it applies when the flow resumes, or the Complete came back before Moxo finished recording that Grok Bot accepted the work and it applies in a moment), or the callback could not be recorded (`not_recorded`, send it again).
- `400`: The body is not valid. The step stays open.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/webhook-config/test`: Send a test to an incoming webhook

Sends one sample delivery through the template's incoming webhook, as **Send test** in the template builder does: the same conditions, mapping and checks a real delivery meets, against the draft. It starts a test flow that contacts nobody, isn't billed and isn't listed with real work, with every role given to you. Send your own `payload`, or leave it out and Moxo makes one with a sample value for each required start field. The delivery is listed in the webhook's delivery log, marked as a test.

A payload the conditions skip answers `200` with status `skipped`. One the mapping can't use answers `400`, and a draft not ready for a test run answers its refusal. A template whose webhook was never set up answers `404`.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The conditions didn't match, so no flow started.
- `201` (object): The test flow started.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/templates/{id}/outgoing-webhooks/{endpointId}/test`: Send a test to an outgoing webhook

Sends one test `flow.started` delivery to one of the template's saved outgoing webhook endpoints, as **Send test** in the template's notification settings does: to its saved address, signed with its signing secret (`X-Moxo-Signature`), with `"test": true` and the header `X-Moxo-Test: true`. You name the endpoint by its `id`, never an address: save the endpoint first (`update_settings` with `notifications.channelIntegrations.webhooks`). Nothing is stored. An endpoint that isn't saved answers `404`; an address your organization's outbound rules don't allow answers `422`; a signing secret that must be replaced answers `409 SECRET_NEEDS_REGENERATE` (replace it in the app). A signing secret is never returned here: an admin reveals or replaces it in the app, on the webhook's settings, and every reveal is recorded.

A personal access token needs edit access to the template.

**Tokens:** personal access token

**Parameters**

- `id` (path, required, string)
- `endpointId` (path, required, string)

**Responses**

- `200` (object): What the receiver answered.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `SECRET_NEEDS_REGENERATE`. The description says when; `error.code` says which.
- `422` (ErrorResponse): The request is well formed but can't be applied. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/organization/action-webhooks`: List action webhooks

The addresses your organization's actions are announced to (Settings › Defaults › Actions): each one's events and whether it is on. A signing secret is never returned here: an admin reveals or replaces it in the app, on the webhook's settings, and every reveal is recorded.

A personal access token needs an organization admin, as the Defaults page does.

**Tokens:** personal access token, organization API key
**Scope required:** `actions:read`

**Responses**

- `200` (object): The endpoints.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/organization/action-webhooks`: Set action webhooks

Saves the whole list of action endpoints, as the Defaults page saves it: add an endpoint to create it, change one by its `id`, set `enabled` to turn it on or off, and leave one out to remove it. Up to 10, `https` only. A new endpoint gets its own signing secret. A signing secret is never returned here: an admin reveals or replaces it in the app, on the webhook's settings, and every reveal is recorded. The change reaches actions sent from now on; one already sent keeps the endpoints it was sent with. The change is recorded in the audit log.

A personal access token needs an organization admin, as the Defaults page does.

**Tokens:** personal access token, organization API key
**Scope required:** `actions:write`

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The endpoints as saved.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/organization/action-webhooks/{endpointId}/test`: Send a test to an action webhook

Sends one test `action.sent` delivery to a saved endpoint: to its saved address, signed with its signing secret (`X-Moxo-Signature`), with `"test": true` and the header `X-Moxo-Test: true`. Nothing is stored. The answer says what the receiver answered. An endpoint that isn't saved answers `404`; an address your organization's outbound rules don't allow answers `422`; a signing secret that must be replaced before it can sign answers `409 SECRET_NEEDS_REGENERATE` (replace it in the app).

A personal access token needs an organization admin, as the Defaults page does.

**Tokens:** personal access token, organization API key
**Scope required:** `actions:write`

**Parameters**

- `endpointId` (path, required, string)

**Responses**

- `200` (object): What the receiver answered.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `SECRET_NEEDS_REGENERATE`. The description says when; `error.code` says which.
- `422` (ErrorResponse): The request is well formed but can't be applied. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

## Reports

Dashboard metrics, per-template performance, SLA compliance, and bottleneck analysis.

### `GET /v1/reports/summary`: Dashboard summary

**Deprecated.**

Returns organization-wide flow counts, step counts and progress indicators. **Deprecated.** Use `POST /v1/reports/query` for new integrations: it answers any reporting question from one catalog instead of a fixed response for each endpoint. This endpoint keeps its URL and response shape. The [changelog](/v1/changelog) lists which figures already come from its source.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Parameters**

- `range` (query, string): A preset time window, such as `week`, `month`, `quarter` or `last30`. Defaults to `week`.
- `templateId` (query, string): Only this template.
- `accountId` (query, string): Only flows associated with this account.

**Responses**

- `200` (object): Summary metrics
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/reports/flows/performance`: Template performance

**Deprecated.**

Returns metrics for each template: completion rate, cycle time and overdue count. Send `templateId` to narrow it to one template and add `drillDown`, a breakdown by step. **Deprecated.** Use `POST /v1/reports/query` for new integrations: it answers any reporting question from one catalog instead of a fixed response for each endpoint. This endpoint keeps its URL and response shape. The [changelog](/v1/changelog) lists which figures already come from its source.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Parameters**

- `templateId` (query, string): Only this template. Also adds `drillDown` to the response.
- `accountId` (query, string): Only flows associated with this account.
- `range` (query, string): A preset time window, such as `month`, `quarter` or `last30`. Ignored when both `from` and `to` are set.
- `from` (query, string): The first day of a custom window (`YYYY-MM-DD`). Requires `to`.
- `to` (query, string): The last day of a custom window (`YYYY-MM-DD`), included. Requires `from`.

**Responses**

- `200` (object): Performance data
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/reports/sla`: SLA compliance

**Deprecated.**

Returns on-time and late completion rates across templates. **Deprecated.** Use `POST /v1/reports/query` for new integrations: it answers any reporting question from one catalog instead of a fixed response for each endpoint. This endpoint keeps its URL and response shape. The [changelog](/v1/changelog) lists which figures already come from its source.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Parameters**

- `range` (query, string): A preset time window, such as `week`, `month`, `quarter` or `last30`. Defaults to `week`.
- `templateId` (query, string): Only this template.
- `accountId` (query, string): Only flows associated with this account.

**Responses**

- `200` (object): SLA metrics
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/reports/bottlenecks`: Step performance

**Deprecated.**

Returns one ranking for each kind of work: steps done by people, AI steps, automations and waits on other systems. Also returns how the total time splits across them. Compare durations only within one kind. **Deprecated.** Use `POST /v1/reports/query` for new integrations: it answers any reporting question from one catalog instead of a fixed response for each endpoint. This endpoint keeps its URL and response shape. The [changelog](/v1/changelog) lists which figures already come from its source.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Parameters**

- `range` (query, string): A preset time window, such as `month`, `quarter` or `last30`. Ignored when both `from` and `to` are set.
- `from` (query, string): The first day of a custom window (`YYYY-MM-DD`). Requires `to`.
- `to` (query, string): The last day of a custom window (`YYYY-MM-DD`), included. Requires `from`.
- `templateId` (query, string): Only this template.
- `accountId` (query, string): Only flows associated with this account.

**Responses**

- `200` (object): Step performance by kind of work
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/reports/query`: Query the reporting catalog

Answers a batch of 1 to 24 report specs from the catalog that `GET /v1/reports/catalog` describes. Each spec names an entity, one or more metrics, and optional grouping dimensions and filters. A spec that fails on its own, such as one with a bad metric key or a template the caller can't read, reports its own `error` and `errorKind` in its result instead of failing the batch. Only when every spec in the batch fails is the request refused (`400` or `403`).

A spec with `correlationSpec` correlates several data tables on shared axes instead of measuring one entity. Its `mode` decides which keys become rows. `"left"`, the default and what an omitted `mode` means, uses the anchor table's keys, so a key the anchor doesn't have is not a row. `"full"` uses the union of every table's keys, so a key in one table and missing from another is returned, with the missing side's measures `null`. Use `"full"` to find what didn't reconcile: with `"left"`, those rows are not in the result. `"inner"` is rejected. Both modes return `matchQuality`, which says what happened to every key.

An axis of type `"temporal-proximity"` (with `toleranceSeconds` and `joinTimezone`) matches each row to the nearest row within that many seconds either way, on the other axes' exact keys, instead of requiring the same time bucket. Every row of `dimensionalData` then has `match` (`exact`, `tolerance`, `unmatched` or `ambiguous`) and `matchDeltaSeconds`: the row's time minus its matched anchor row's, or `null` when there is no single distance. Several rows within one tolerance combine into one key, with their measures combined by that table's own aggregate (sums add, averages are weighted, nothing is multiplied), and `matchQuality.cardinality` reports how many rows combined. Matching runs from the anchor: every other table is matched to the nearest anchor row, so a different `anchorTableId` matches different rows and gives a different total. The first entry in the result's `warnings` says so, ahead of any truncation note. When two rows are equally near, the match is `ambiguous` and neither row is merged.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Request body**

- `application/json`: object

**Responses**

- `200` (object): One result for each spec, in the order sent.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/reports/catalog`: Get the reporting catalog

Describes everything `POST /v1/reports/query` can answer: every entity the caller can read, with its metrics, dimensions, filters and time anchors, plus the fixed values a spec can set (`mode`, `compare`) and the limits a spec must stay within. Send `templateId` to add that template's flow fields as dimensions.

**Tokens:** personal access token, organization API key
**Scope required:** `reports:read`

**Parameters**

- `templateId` (query, string): Only this template, with its flow fields added as dimensions.

**Responses**

- `200` (object): The reporting catalog.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Data tables

Your organization's own tables: a vendor list, a client roster, a rate card. Create a table and its columns in one call, read and write the records inside it, or load a CSV. Flows read from these tables at runtime (a Look-up step, a picker on a form), so a table kept current here keeps every flow that references it current too.

### `GET /v1/data-tables`: List data tables

Returns every active table in your organization, with its columns. Records are not included: read one table's records with `GET /v1/data-tables/{tableId}/records`.

These entries have no `recordCount`. To get it, read one table with `GET /v1/data-tables/{tableId}`.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:read`

**Parameters**

- `search` (query, string): Finds a table by `id`, `slug` or `name`. `id` must match exactly; `slug` and `name` match any part of the value and ignore case.

**Responses**

- `200` (object): Tables in your organization.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/data-tables`: Create a data table

Creates the table and its columns in one call. The response carries each column's `key` and `id`; keep the `key` if you plan to write records or update the columns later.

Each column needs a `name` and a `type`. Only four types take `config`: a dropdown needs its options, and `number`, `timestamp` and `file` have optional settings. The other six types take no `config`, so leave it out:

```json
{
  "name": "Vendors",
  "columns": [
    { "name": "Vendor Name", "type": "text", "required": true },
    { "name": "Spend", "type": "number", "config": { "precision": 2 } },
    { "name": "Status", "type": "single_select",
      "config": { "options": [
        { "id": "active", "label": "Active" },
        { "id": "review", "label": "Under review" }
      ] } }
  ]
}
```

Don't send `id` or `key` on a column here: the table doesn't exist yet, and Moxo creates both.

The table's `slug` comes from its name and is made unique, so a second "Vendors" table gets `vendors_2`.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: CreateDataTableRequest

**Responses**

- `201` (object): The new table.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `GET /v1/data-tables/{tableId}`: Get a data table

Returns one table's columns and its record count, without the records themselves. Use it to look up the column keys you need before a write.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:read`

**Parameters**

- `tableId` (path, required, string): The table's id.

**Responses**

- `200` (object): The table
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PUT /v1/data-tables/{tableId}`: Update a data table

Takes the same body as create. `columns` is the full list: the columns you send become the table's columns, in that order, and any active column the list doesn't name is archived.

**Archiving can't be undone.** The column disappears from `columns[]` and from every record's `values`, and it can't be brought back through this API or in Moxo. For a `file` column, the stored files are deleted. Send the full list you want the table to have, and check it before you send it.

**To rename a column, name it by `id` or `key`.** An entry with a new `name` and neither `id` nor `key` reads as "archive that column and add a new one", and that is what happens.

**An archived column keeps its key.** A live column can't take the `key` of an archived one, so a record, a step or a report that named the old column never reads the new one by mistake. Give the new column a key of its own.

**A column's `type` can't change.** Send the type it already has. A different type returns `400`, naming the column. To store a different type, leave the column out of the list, which archives it, and add a new one.

Leave out `columns` to rename the table or change its description without changing its columns.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string): The table's id.

**Request body**

- `application/json`: ReplaceDataTableRequest

**Responses**

- `200` (object): The updated table
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): The table's columns changed while this request was being prepared. Re-read the table and apply the change again.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/data-tables/{tableId}`: Delete a data table

Deletes the table and its records. This is the same action as **Archive** in the Moxo app: the table and its records stop being readable everywhere (this API, the app, flow Look-up steps, pickers, reports), and the table is gone from `GET /v1/data-tables`.

Files in `file` columns are deleted and can't be recovered. The table's `slug` stays taken, so a new table with the same name gets a new slug (`vendors_2`).

Steps in already-published templates that point at this table will fail when they next run. Check what references a table before deleting it.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string): The table's id.

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/data-tables/{tableId}/fields/{fieldId}`: Delete an archived column

Deletes one archived column for good. A column that is still on the table is refused. The column's key stays taken, so a new column with the same name gets a suffixed key (`billing_contact_2`).

Values in that column are cleared. Files were already removed when the column was archived. A template that still points at the column shows the column as removed and cannot be published until the reference is fixed.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string): The table's id.
- `fieldId` (path, required, string): The archived column's id.

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/data-tables/{tableId}/records`: List records in a data table

Returns a page of the table's records. The response also includes the table, so you have the column list without a second call.

Each record's `values` is keyed by column `key`, so a row reads on its own: `{"vendor_name": "Acme", "spend": 1200}`. Keys never change, including when someone renames the column in Moxo.

**Order:** by the table's primary text column, A to Z, then by record id. This is the order the Moxo app shows, not the order records were added. A text column sorts as text, so `"200"` comes before `"50"`; for numeric order, use a `number` column.

Records are paginated: read `pagination.hasMore` and advance `offset` until it is false. Because the order is by column value, adding or editing a record can move an existing one to a different page. If you are reading the whole table and cannot tolerate that, read it in one pass rather than spreading the pages over a long window.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:read`

**Parameters**

- `tableId` (path, required, string): The table's id.
- `limit` (query, integer): Records per page, 1 to 200. Defaults to 50.
- `offset` (query, object): How many records to skip. Defaults to 0.
- `search` (query, string): Matches any part of the value, ignoring case, in every text, email, phone, URL, number, and dropdown column. A dropdown matches by its option label. Date, date and time, checkbox, and file columns are not searched. To narrow on one of those, or on one column only, read the page and filter `values` yourself.

**Responses**

- `200` (object): A page of records, with the table.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/data-tables/{tableId}/records`: Add records to a data table

Adds records in bulk, up to 1000 per request.

Each record succeeds or fails on its own: a record that fails validation, including one that names a column the table doesn't have, is rolled back and reported in `errors` with its index, and every other record in the request is still added. Check `failed` before treating the call as complete.

Each entry's `values` can name its columns by id, key or name. This endpoint only adds records; to change one, use `PATCH .../records/{recordId}`.

**Send an `Idempotency-Key`.** Within 10 minutes, a retry with the same key never adds the batch twice. If the first call finished, you get its original response back, byte for byte. If it is still running, you get `425 Too Early`: wait a moment and send it again. If the first response can no longer be returned, you get `410`: retry with a new key. After 10 minutes the key is free again and a retry does add the batch, so read `GET /v1/data-tables/{tableId}` and compare `recordCount` first.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string): The table's id.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: CreateDataTableRecordsRequest

**Responses**

- `200` (object): The result for each record.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `PATCH /v1/data-tables/{tableId}/records/{recordId}`: Update a record

Updates one record. Only the columns you name in `values` change: every other column keeps its value, so you can update one column without reading the record first, and two systems writing different columns never overwrite each other.

To clear a column, send it as `null`.

`version` is optional and most integrations should leave it out. Send it when your new value was worked out from the old one, such as adding to a running total, and the update is refused with 409 if someone changed the record after you read it.

Sending only values the record already has changes nothing: the answer says `changed: false`, and `recordVersion` stays as it was.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string)
- `recordId` (path, required, string)

**Request body**

- `application/json`: UpdateDataTableRecordRequest

**Responses**

- `200` (object): The record, as it is now
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (object): The record changed since the `version` you sent. Re-read it and retry.
- `429` (ErrorResponse): Too many requests.

### `DELETE /v1/data-tables/{tableId}/records/{recordId}`: Delete a record

Deletes one record. It stops being readable everywhere (this API, the app, flow Look-up steps and pickers) and stops counting toward `recordCount`.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string)
- `recordId` (path, required, string)

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /v1/data-tables/{tableId}/records/import`: Import records from a CSV

**Adds** the file's rows to an existing table, up to 500 per request. Send it as `multipart/form-data` with the file in a `file` part, or as JSON with the text in `csv`.

This endpoint only adds records, which is what CSV import does in the Moxo app. It never edits or removes a record that is already there. Nothing in a CSV identifies an existing row, so there is no way to tell which record a line was meant to update; to change specific records, read them and use `PATCH .../records/{recordId}`.

A row that fails validation is reported in `errors` with its line number, and the rest of the file still imports, so check `failed` before treating the call as done.

**The first row is a header** naming the table's columns: each column's name or `key`, in any order, ignoring case. A header that matches no column is reported as a warning on row 1, and its data is skipped; the rest of the file still imports. The **Download a template** button on the table in Moxo gives a file with exactly the right header.

`file` columns can't be set from a CSV and are skipped.

A file over the size limit for one import returns `413 FILE_TOO_LARGE`, naming the limit: split it into smaller files.

The import finishes before the response comes back, so there is no job to poll. It can take a while on a full file, and each imported row can start a flow if the table has triggers on it, so prefer several smaller files over one large one.

**Send an `Idempotency-Key`.** Within 10 minutes, a retry with the same key never imports the file twice. If the first import finished, you get its original response back, byte for byte. If it is still running, you get `425 Too Early`: wait a moment and send it again. If the first response can no longer be returned, you get `410`: retry with a new key. After 10 minutes the key is free again and a retry does import the file, starting any triggers on the table again for the duplicate rows, so read `GET /v1/data-tables/{tableId}` and compare `recordCount` first.

**Tokens:** personal access token, organization API key
**Scope required:** `data_tables:write`

**Parameters**

- `tableId` (path, required, string): The table's id.
- `Idempotency-Key` (header, string): An optional key that makes this request safe to retry. Send a new UUID for each request. A key is up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing runs. A retry with the same key within 10 minutes returns the first response and changes nothing again. After 10 minutes, the same key runs the request again, so use a new key for a late retry. See Idempotency in the Introduction.

**Request body**

- `application/json`: ImportDataTableCsvRequest
- `multipart/form-data`: object

**Responses**

- `200` (object): The result of the import.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `413` (ErrorResponse): Refused: `FILE_TOO_LARGE`. The description says when; `error.code` says which.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

## Connections

The organization's connected app accounts, AI providers, Secrets and MCP servers, by name and id, never a credential. Ask which templates use one with `GET /v1/templates?uses=connection:<id>`.

### `GET /v1/connections`: List connections

Returns the organization's connected app accounts, AI providers, Secrets and MCP servers, by name and id, never a credential. Use an `id` with `GET /v1/templates?uses=connection:<id>`.

An organization API key lists every connection, as an admin sees them. A personal access token lists what its person sees in **Connected Apps**: the organization's connections plus their own personal accounts. Secrets and AI providers are listed for an organization API key, or for a person with the **Manage credentials** permission.

**Tokens:** personal access token, organization API key
**Scope required:** `templates:read`

**Parameters**

- `type` (query, string): Only connections of this type.

**Responses**

- `200` (object): Success
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## AI

Describe a process in plain language, and the AI builder creates a draft template with any draft AI agents it needs. A generation runs in the background: start it, then poll for the result.

### `POST /v1/ai/generations`: Generate or edit a template

Asks the AI builder to create a draft template, with any draft AI agents it uses, from a plain-language `prompt`. With `mode: "edit"` and a `templateId`, it changes that template's draft instead. The work runs in the background: the call returns **202** with a `generationId`, and you poll `GET /v1/ai/generations/{generationId}` for the result. In decisive mode (the default), the AI builder never asks questions: it fills gaps with sensible defaults and lists what it assumed in the result's `assumptions`. Send `publish: true` to publish the result at once; it stays a draft if it fails the publish checks. Send an `idempotencyKey` to make retries safe: a repeat returns the same generation. Each credential has a monthly generation quota (429 `GENERATION_QUOTA_EXCEEDED` when it is used up). An organization with AI turned off gets 403 `AI_DISABLED`.

**With a personal access token** (`mxo_pat_…`), the person is the author: they become the template's creator and owner and appear in its history. The call needs their own permission to build templates with the AI builder (403 `CAPABILITY_DENIED` otherwise), and `publish: true` also needs permission to publish. With `mode: "edit"`, the person must be able to edit the template: 404 when they can't see it, 403 when they can see it but not edit it.

A template has owners, so only a person builds one: an organization API key gets 403 `PERSON_TOKEN_REQUIRED` in every mode, and so does a partner delegation key. A key may still poll the organization's generations. The AI builder edits process templates only (400 `WRONG_TEMPLATE_KIND` for an action template).

An edit changes the template's draft only; new flows keep starting from the published version until the draft is published. If someone changes the template while the AI builder is working, the template is left unchanged and the generation fails with `TEMPLATE_CHANGED`.

**Tokens:** personal access token

**Request body**

- `application/json`: object

**Responses**

- `202` (object): Accepted: the generation is queued. Poll `GET /v1/ai/generations/{generationId}` for the result.
- `400` (ErrorResponse): Refused: `WRONG_TEMPLATE_KIND`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /v1/ai/generations/{generationId}`: Get a generation

Returns a generation's status. Once it is `COMPLETED`, it also returns `resultTemplateId` (the template created, or for an edit, changed), any `mintedAgentIds` and the AI builder's `assumptions`. A `FAILED` generation has an `errorCode` and an `errorDetail`. A personal access token reads the generations its person started; an organization API key reads its organization's.

**Tokens:** personal access token, organization API key
**Scope required:** `ai:generate`

**Parameters**

- `generationId` (path, required, string)

**Responses**

- `200` (object): Success
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## System

Service health and operational status endpoints for monitoring and uptime checks.

### `GET /v1/health`: Check service health

Returns the service status. Use it for uptime monitoring and heartbeat checks.

**Tokens:** none. Anyone may call it.

**Responses**

- `200` (object): The service is up.

## Web SDK

Embed Moxo screens in your own product, such as Salesforce Lightning, your CRM or an internal tool: the flow list, flow detail, templates, start a flow, the launcher, and chat (chat, chat list and chat detail). The `@moxo/sdk` npm package has a small runtime for your page and a sandboxed iframe that shows the same screens as the Moxo portal, so a change to the portal reaches your embed in the same release.

Your backend exchanges an organization API key or a personal access token for a 15-minute session token (`POST /sdk/auth/sessions`). Your page passes that token to the SDK, which renews it in the background, so the browser never sees your long-lived token. When the session's persona can use more than one portal, send `portal_id`. Without it, the call returns `400 PORTAL_REQUIRED` with that persona's portal ids in `error.details`.

To build the screens yourself instead, use the **Headless SDK** below. It uses the same sessions, and your own UI renders everything from `/sdk/v1`.

Quick start, components, authentication, callback events and error codes:

→ **[Open the Web SDK documentation](/docs/sdk)**

### `POST /sdk/auth/sessions`: Create an SDK session token

Call this from your server only. Your backend exchanges its organization API key or personal access token for a 15-minute session token tied to your page's origin, so the browser never sees the long-lived token. The request must carry an `Origin` header that matches one of your organization's SDK `allowedOrigins` (**Settings → Web SDK**: admins only; it appears once the Web SDK is on for your organization). Server frameworks don't send one by default, so set it yourself. Name the person with `uniqueId`, or with exactly one of `email` and `userId`. With `uniqueId` you may also send the person's `email`: it is checked against them, never used to pick someone else. A session minted by `uniqueId` returns the person's stored email, or `null` for someone with a Unique ID only. A personal access token can only create sessions for its own person.

A session works only in the embedded Moxo screens and the `/sdk` calls. It has the person's own permissions for running and building work, never an admin's, even when the person is an admin: Settings, the access model, credentials and the audit log stay in the app. Every other call, including `/v1` and the MCP server, refuses it with `403 SDK_SESSION_NOT_ALLOWED_HERE`; call those from your server with your API key. Each session is recorded in the audit log with this key as the actor.

**When it is refused.**

- The SDK is not set up: `403 SDK_NOT_ENABLED` (an admin turns it on in **Settings → Web SDK**), `403 SDK_NO_ALLOWED_ORIGINS` (an admin adds your page's origin there).
- The origin: no `Origin` header is `400 ORIGIN_HEADER_REQUIRED`; one not in `allowedOrigins` is `403 ORIGIN_NOT_ALLOWED`.
- The token: a signed-in browser session is `403 SDK_MINT_REQUIRES_API_KEY` (call from your server with a token); a personal access token naming someone else is `403 PAT_CANNOT_IMPERSONATE` (use an organization API key with `sdk:mint`).
- The person: no `uniqueId`, `email` or `userId` is `400 IDENTITY_REQUIRED`; `userId` with `email` or with `uniqueId` is `400 IDENTITY_AMBIGUOUS`; no such user in your organization is `404 USER_NOT_FOUND`; with `uniqueId`, an `email` that belongs to someone else in your organization is `409 EMAIL_BELONGS_TO_ANOTHER_USER`; a `uniqueId` when your organization's plan does not include unique IDs is `403 FEATURE_DISABLED`.
- The persona: both `personaId` and `personaName` is `400 PERSONA_AMBIGUOUS`, as is a `personaName` that matches more than one; a persona the person does not hold is `403 PERSONA_NOT_HELD`; a person with no persona is `422 NO_PERSONA`; a person with several and no default is `422 PERSONA_REQUIRED` (send `personaId`).
- The portal: a persona with several portals and no default is `400 PORTAL_REQUIRED` (send `portalId`); a portal the persona does not give is `403 PORTAL_NOT_GRANTED_BY_PERSONA`; `portalId` with a persona that is not for a portal is `400 PORTAL_ID_IGNORED_FOR_NON_PORTAL_PERSONA`.
- The plan: a plan with a daily session limit answers `429 MINT_QUOTA_EXCEEDED` once it is reached (it resets at midnight UTC), and `503 MINT_QUOTA_UNAVAILABLE` when the count can't be read (retry).
- The audit record: if the record of the new session cannot be written, `503 SDK_SESSION_AUDIT_UNAVAILABLE` and nothing is created; retry after `Retry-After`.

**Tokens:** personal access token, organization API key
**Scope required:** `sdk:mint`

**Request body**

- `application/json`: SdkSessionMintRequest

**Responses**

- `200` (SdkSessionMintResponse): The new session. The response is not wrapped in `{ success, data }`, and its token fields are snake_case: read `session_token`, not `token` or `data.token`.
- `400` (ErrorResponse): Refused: `IDENTITY_AMBIGUOUS`, `IDENTITY_REQUIRED`, `ORIGIN_HEADER_REQUIRED`, `PERSONA_AMBIGUOUS`, `PORTAL_ID_IGNORED_FOR_NON_PORTAL_PERSONA`, `PORTAL_REQUIRED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `EMAIL_BELONGS_TO_ANOTHER_USER`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `NO_PERSONA`, `PERSONA_REQUIRED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `MINT_QUOTA_UNAVAILABLE`, `SDK_SESSION_AUDIT_UNAVAILABLE`. The description says when; `error.code` says which.

### `DELETE /sdk/auth/sessions/{jti}`: Revoke an SDK session

Ends a session early, by the `jti` from the response that created it. Later calls with that token are refused. The session itself, the key that created it, or an admin of its organization can revoke it; for anyone else the call does nothing. The `sdk:mint` scope is needed only to create a session. Use it when a person signs out.

**Tokens:** personal access token, organization API key, SDK session token
**Scope required:** none

**Parameters**

- `jti` (path, required, string)

**Responses**

- `204`: Revoked. No body. An expired or unknown `jti`, or a session this caller may not end, does nothing and gets the same answer.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## Headless SDK

Per-person data for apps that build their own UI on Moxo. Every call uses a short-lived SDK session token, created by your backend with `POST /sdk/auth/sessions`, and returns exactly what that person can see: their spotlight, flows, templates, flow chat, group conversations and notifications, with live updates from the `/sdk/events` stream. Sessions for every persona are accepted here, magic link personas included; the Web SDK components have narrower rules. The exception is `GET /sdk/v1/templates`, the templates a person can start themselves, which accepts portal sessions only. Requires the Headless SDK on your organization's plan. To leave flow chats out of the Messages inbox, list conversations with `kind=group`.

To have Moxo build the screens instead, use the **Web SDK** above. It uses the same sessions, with iframe components you add to your page.

Installing `@moxo/sdk/data`, sessions, retries and routing notifications into your own UI:

→ **[Open the Headless SDK documentation](/docs/headless)**

### `GET /sdk/v1/me`: Get the session's person

Returns the person behind the SDK session: their user id, display name, persona, portal and organization. Call it once after creating a session to set up your UI, and to check a token end to end while you integrate.

**Tokens:** SDK session token

**Responses**

- `200` (object): The session's person.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/dashboard`: Get the person's dashboard

Returns the signed-in person's flows with what a spotlight and gallery need: `awaitingOn` (`you` means they have a step to act on now), due state, progress, unread chat and summary counts. A portal session sees only its portal. Magic link and orchestrator portal sessions see their own flows across the organization: always what involves the person, never an organization-wide list. The response has no action tokens: the session itself is the credential for every follow-up call.

**Tokens:** SDK session token

**Responses**

- `200` (object): Summary counts and flows.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/flows/{id}`: Get a flow

Returns one flow, limited to what the caller can see: participants and viewers get exactly the steps visible to them (their own steps plus steps shared with them), and flow managers get every step. Each step lists its current assignees, with person ids and a `you` marker. A flow the caller can't open returns 404, so the response never shows whether it exists.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): The flow's id.

**Responses**

- `200` (object): The flow, with the steps the caller can see.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/templates`: List the templates the person can start

Returns the templates this portal session can start, each with its start form. Show `kickoffFields` in your own UI, and fill in and hide the `initiatorFieldKeys` from the signed-in person's details. Portal sessions only (403 `WRONG_PERSONA_SURFACE` otherwise): the templates a person can start are their portal's catalog.

**Tokens:** SDK session token

**Responses**

- `200` (object): The templates the person can start, with their start forms.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/flows/{id}/messages`: List flow chat messages

Returns the flow's chat as the signed-in person can read it, newest first, with replies in threads. `authorType` says who wrote each message (`internal`, `external`, `agent` for AI, or `system`), so you can show AI messages differently. External participants see messages on the whole flow plus the threads on their own steps; internal notes (`internal_only`) never reach external viewers. Post with `POST /sdk/v1/flows/{id}/messages`.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): The flow's id.
- `limit` (query, integer): How many top-level messages to return, up to 200. Defaults to 100. Replies are nested and not counted.
- `cursor` (query, string): The previous page's `pagination.nextCursor`. Leave it out for the first page.

**Responses**

- `200` (object): Chat messages, newest first, one page at a time.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/flows/{id}/messages`: Post a chat message

Posts a message to the flow's chat as the signed-in person, with the same permissions as chat in the app. To attach it to a step, send `targetStepExecutionId`; a step the caller can't see is refused, never quietly swapped for another. For an external participant, a message without a step attaches to their active step, and is refused when they have none, so name the step when commenting on a completed one. Messages are text only.

**Refusals:** `403 FEATURE_DISABLED` (chat is not on the organization's plan), `403 FLOW_CANCELLED` (the flow was canceled, so its chat is read-only), `403 PROGRESS_ONLY` (the flow is shared with this person to follow its progress only), `403 COMMENTS_DISABLED` (comments are off for this flow; reading still works), `403 STEP_NOT_VISIBLE` (`targetStepExecutionId` names a step this person can't see), `403 FORBIDDEN` (an external participant sent no `targetStepExecutionId` and has no step open on this flow, so name the step they are writing about; also a step that has no chat, such as an automation), `400 BAD_REQUEST` (`targetStepExecutionId` is not a step of this flow), `403 MENTION_NOT_ALLOWED` (`mentions` names someone who isn't on the flow, and this person isn't a flow manager, sent no `targetStepExecutionId`, or the template's Tag anyone in the organization setting is off), `400 MENTION_UNKNOWN` (`mentions` names someone who is not in this organization), `400 MENTION_EXTERNAL` (`mentions` names someone outside the organization who isn't on the flow), `400 MENTION_INACTIVE` (`mentions` names someone who is deactivated), `400 TOO_MANY_MENTIONS` (`mentions` names more than 10 people who aren't on the flow). A flow the caller can't open is `404`.

**Idempotency:** you can send an `Idempotency-Key` header. A retry with the same key returns `201` with the original message instead of posting a duplicate, or `410 IDEMPOTENCY_RESULT_LOST` when that message was deleted since; a retry while the first request is still running returns `425 IDEMPOTENT_REQUEST_PENDING`.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): The flow's id.
- `Idempotency-Key` (header, string): A unique key that makes retries safe. See **Idempotency** in this endpoint's description.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The message: the new one, or the original one when this is a retry with the same `Idempotency-Key`.
- `400` (ErrorResponse): Refused: `BAD_REQUEST`, `MENTION_EXTERNAL`, `MENTION_INACTIVE`, `MENTION_UNKNOWN`, `TOO_MANY_MENTIONS`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/notifications`: List notifications

Returns the person's in-app notifications, most recent first, for your app's bell icon, a page at a time: pass `pagination.nextCursor` as `cursor` for older ones. The feed is filled for internal users; external participants are reached by email or SMS instead, so their feed may be empty.

**Tokens:** SDK session token

**Parameters**

- `unreadOnly` (query, string): Return only unread items.
- `limit` (query, integer): How many notifications to return, up to 100. Defaults to 50.
- `cursor` (query, string): The previous page's `pagination.nextCursor`, for older notifications. Leave it out for the newest. A cursor this list did not return is refused with `400 INVALID_CURSOR`.

**Responses**

- `200` (object): Notifications.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/notifications/unread-count`: Count unread notifications

Returns the number for your bell icon's badge.

**Tokens:** SDK session token

**Responses**

- `200` (object): Unread count
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/notifications/{id}/read`: Mark a notification read

Marks one notification as read. Marking an already-read or unknown id also succeeds and changes nothing, so a retry never fails.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): Notification id.

**Responses**

- `200` (object): Acknowledged
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/notifications/read-all`: Mark all notifications read

Marks every unread notification of the signed-in person as read.

**Tokens:** SDK session token

**Responses**

- `200` (object): Acknowledged
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/events`: Stream live events (SSE)

Server-sent events for the session's person, each one only when the session itself may read it (a session is never an admin, so one created for an admin does not receive the organization's admin notices or events for flows, steps and chat channels it cannot open). Choose what to receive with `?subscribe=`; without it, the stream only keeps the connection open and delivers nothing. Events are pointers (ids, not content): when one arrives, read the matching `/sdk/v1` endpoint again. The stream ends when the session token expires (the `connected` frame's `exp` says when). Create a new session, reconnect and read again to catch up on anything missed; events are not replayed.

**Frames:** `connected` `{jti, orgId, delivery, subscribe, exp}`, then `sync` `{reason}`, then one frame per event, named by its type (for example `step.completed`, `chatMessage.sent`, `conversation.message_sent`, `notification.created`, `notification.os_surface`). Heartbeat comments keep the connection open.

**Groups:** `flows` (step and flow changes), `chat` (flow chat pointers; for older clients, this group also delivers group conversation `conversation.*` events), `conversations` (group conversation pointers only; use it when you don't want flow chat events) and `notifications` (in-app notifications, plus portal alerts).

**Portal alerts:** when `subscribe` includes `notifications`, a session without an orchestrator portal persona also receives `notification.os_surface` (`audience: portal`), at the same moment as a portal browser alert. It is delivered when the plan has the Web SDK or the Headless SDK. `flows` and `notification.created` need the Headless SDK. `chat` and `conversations` are delivered on either SDK plan, because chat embeds need live pointers. On a Web SDK plan, a request that also asks for `flows` is answered without `flows`. In `@moxo/sdk`, `onNotification` turns the frame into a category plus ids and drops the fixed title and body.

**Plans:** portal alerts need the Web SDK or the Headless SDK; `chat` and `conversations` need either SDK plan; `flows` and `notification.created` need the Headless SDK. Create the session token with `POST /sdk/auth/sessions` and send it as the Bearer token.

**Tokens:** SDK session token

**Parameters**

- `subscribe` (query, string): The groups to deliver, comma-separated: `flows`, `chat`, `conversations`, `notifications`. For example `subscribe=flows,chat,conversations`. Leave it out and the stream delivers nothing.

**Responses**

- `200` (string): An SSE stream (`text/event-stream`).
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/flows/{flowId}/steps/{stepExecutionId}`: Get a step's content

Returns one step's name, description and files: the same content the Moxo portal shows that person. The name is the title the portal shows, including a preparer's title and filled-in dynamic data. A file from a form answer hidden from the person is left out. A hidden step returns 404, and a step shared as progress only returns `403 PROGRESS_ONLY`.

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.
- `stepExecutionId` (path, required, string): The step's execution id: the `id` of the step in the flow detail.

**Responses**

- `200` (object): The step's content.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/flows/{flowId}/files`: List a flow's files

Returns every file in the flow that this person can see, including a fixed file from the template that the flow kept. A generated file that failed stays in the list with `generationStatus` `failed` and has no download link. When the person only sees progress, other people's files are left out.

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.

**Responses**

- `200` (object): The files the person can see.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/flows/{flowId}/files/{fileId}`: Get a file's download link

Returns a signed download link for one file this person can already see. The link lasts 5 minutes. Send `disposition=inline` to preview the file, or `attachment` to download it; a type the browser can't show is sent as `attachment`. A view-only file returns 403. A file that must be watermarked returns 422, because this link can't carry a mark for each person. A file that failed to generate returns `409 FILE_NOT_READY` and has no link. A file from another flow or organization, or from a step the person can't see, returns 404. A permanently deleted file returns 410. The download is recorded only once the link is created. A `HEAD` request checks the same rules and returns 200, with no link and no download recorded.

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.
- `fileId` (path, required, string): The file's id, from the flow's file list or a step attachment.
- `disposition` (query, string): `inline` previews the file; `attachment` downloads it. Defaults to `attachment`.

**Responses**

- `200` (object): The signed link.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `FILE_NOT_READY`. The description says when; `error.code` says which.
- `410` (ErrorResponse): Gone: what the request names no longer exists.
- `422` (ErrorResponse): The request is well formed but can't be applied. `error.code` says why.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/flows/{flowId}/steps/{stepExecutionId}/form-schema`: Get a step's form

Returns the fields to show for a step, in order: the same form Moxo shows the participant, with dynamic data already filled in and each default converted to its field type's format. Key the completion by each field's `id`. Rules that read values outside the form come already evaluated (`resolved`); evaluate rules within the form in your UI as the person fills it in. Steps without fields, such as an acknowledgement or a to-do, return an empty `fields` array.

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.
- `stepExecutionId` (path, required, string): The step's execution id: the `id` of the step in the flow detail.

**Responses**

- `200` (object): The step's form.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/flows/{flowId}/steps/{stepExecutionId}/complete`: Complete a step

Submits the signed-in person's work on a step and moves the flow on. The caller must be an assignee of the step with their part still open, or be covering for a teammate who is away; a flow manager can't complete someone else's step here. `resultData` is keyed by field id (see the step's form endpoint); a form's file field takes the ids the upload endpoint returned. A file request has no form fields: upload each file with `POST /sdk/v1/flows/{flowId}/steps/{stepExecutionId}/files`, then name them under `files`, as in `{ "resultData": { "files": ["<fileId>"] } }`. With no file uploaded, it answers `400 VALIDATION_FAILED`. On a step for several people, the submission completes one person's part, and `group` says how many more the step needs. A form or file request that closes at its due date and allows changes after submitting answers 200 with the step still in progress: the submission is recorded, and the action stays open until it closes. A file request whose AI rename is still running returns `200` with `postProcessing: true`: the submission is recorded, and the step completes when the rename finishes.

**Refusals:** `403 NOT_STEP_ASSIGNEE` (no open part on the step), `403 COMPLETION_REQUIRES_MEMBER` (a Web App step that only an internal user can confirm), `400 VALIDATION_FAILED` (a field the step doesn't ask for, a choice that isn't one of the field's options, or a value of the wrong kind; the message names the field), `409 ESIGN_SIGNATURE_REQUIRED` (an e-signature step finishes when the document is signed), `409 ALREADY_COMPLETED` (the step, or your part of it, is already done), `409 STEP_AWAITING_REVIEW` (the step is in its review), `503 SERVICE_UNAVAILABLE` (a file rename couldn't be scheduled; retry), `400 INVALID_STATE` (the step or flow isn't active), `409 FLOW_PAUSED`, `409 BATCH_NOT_ACTIVE` (an earlier person in the order hasn't finished), `409 REVIEW_REQUIRED` (the step has an AI reviewer; complete it in Moxo), `409 STALE_ACTION` (the step changed at the same moment; read it again and retry), `422 FILE_INFECTED`, `409 SCAN_UNAVAILABLE`, `425 SCAN_PENDING` (an upload the request names is still being checked; retry shortly), and `400` for errors specific to the step type.

**Retries:** a submission is applied once, so a retry of one that was already applied returns `409 ALREADY_COMPLETED` instead of applying it twice. Treat that code as success: your work is recorded. Read the flow again to see the result.

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.
- `stepExecutionId` (path, required, string): The step's execution id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The submission was accepted.
- `400` (ErrorResponse): Refused: `INVALID_STATE`, `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `ALREADY_COMPLETED`, `BATCH_NOT_ACTIVE`, `ESIGN_SIGNATURE_REQUIRED`, `FLOW_PAUSED`, `REVIEW_REQUIRED`, `SCAN_UNAVAILABLE`, `STALE_ACTION`, `STEP_AWAITING_REVIEW`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `FILE_INFECTED`. The description says when; `error.code` says which.
- `425` (ErrorResponse): Refused: `SCAN_PENDING`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `SERVICE_UNAVAILABLE`. The description says when; `error.code` says which.

### `POST /sdk/v1/flows/{flowId}/steps/{stepExecutionId}/decline`: Decline an approval step

Declines an approval step as the signed-in approver: either a final rejection or a request for changes, which reopens the steps the template's author chose. The caller must be an approver on the step with their part still open.

**Refusals,** the same as `POST /v1/flows/{id}/steps/{stepId}/decline` answers: `400 VALIDATION_FAILED` (the template doesn't allow the requested action; `error.details` names the setting), `400 INVALID_STEP_TYPE` (not an approval step), `410 NO_ACTIVE_SLOT` (no part on the step, or your part was already decided another way; `error.decision` names yours), `410 SLOT_FORWARDED`, `410 SLOT_NO_LONGER_ACTIONABLE`, `422 CHANGES_TARGETS_UNAVAILABLE` (none of the steps named can take the changes), `409 BATCH_NOT_ACTIVE`, `409 STALE_ACTION` (the step changed at the same moment), `409 APPROVAL_DECIDED_OTHERWISE` (the approval was decided another way this round; `error.decision` is the one that stands), `400 AMBIGUOUS_SLOT` (you hold more than one open part on the approval; `error.availableSlotIds` lists them), `400 INVALID_STATE` (the approval is not open for a decision), `409 FLOW_PAUSED` (the flow is paused), `400 DECLINE_FAILED` (the decline couldn't be applied; the message says why).

**Retries:** each person's decision is applied once, so a retry of a decline that was already applied returns `410 NO_ACTIVE_SLOT` instead of applying it twice. Read the flow again to see the result.

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.
- `stepExecutionId` (path, required, string): The step's execution id.

**Request body**

- `application/json`: object

**Responses**

- `200` (object): The decline was recorded.
- `400` (ErrorResponse): Refused: `AMBIGUOUS_SLOT`, `DECLINE_FAILED`, `INVALID_STATE`, `INVALID_STEP_TYPE`, `VALIDATION_FAILED`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `409` (ErrorResponse): Refused: `APPROVAL_DECIDED_OTHERWISE`, `BATCH_NOT_ACTIVE`, `FLOW_PAUSED`, `STALE_ACTION`. The description says when; `error.code` says which.
- `410` (ErrorResponse): Refused: `NO_ACTIVE_SLOT`, `SLOT_FORWARDED`, `SLOT_NO_LONGER_ACTIONABLE`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `CHANGES_TARGETS_UNAVAILABLE`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/flows/{flowId}/steps/{stepExecutionId}/files`: Upload a file to a step

Uploads one file to a step where the signed-in person's part is still open. The file is scanned for viruses before it is accepted, so the response's `scanStatus` is always final (`clean` or `skipped`); an infected file is refused with `422 FILE_INFECTED` and nothing is stored. The upload stays a draft until your completion names its `fileId`; drafts your submission never names are ignored and later removed.

**Refusals:** `403 NOT_STEP_ASSIGNEE` (no open part on the step), `400 INVALID_STATE`, `413` (over the size limit), `422 FILE_INFECTED`, `503 SCAN_UNAVAILABLE` (try again shortly).

**Tokens:** SDK session token

**Parameters**

- `flowId` (path, required, string): The flow's id.
- `stepExecutionId` (path, required, string): The step's execution id.

**Request body**

- `multipart/form-data`: object

**Responses**

- `201` (object): The file was scanned and stored as a draft.
- `400` (ErrorResponse): Refused: `INVALID_STATE`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `413` (ErrorResponse): The upload is larger than this call takes.
- `422` (ErrorResponse): Refused: `FILE_INFECTED`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): Refused: `SCAN_UNAVAILABLE`. The description says when; `error.code` says which.

### `POST /sdk/v1/flows`: Start a flow

Starts a flow from the portal's catalog as the signed-in person. `templateId` comes from `GET /sdk/v1/templates`; `customFields` names each start field by its `key` and is checked the same way as on every other way to start a flow. Portal sessions only (`403 WRONG_PERSONA_SURFACE` otherwise). The response carries only the new flow's id: read the flow with `GET /sdk/v1/flows/{id}`, and follow its progress on the event stream.

**Refusals:** `403 PORTAL_BINDING_MISSING` (the session is not linked to a portal: create it with `portal_id`), `403 TEMPLATE_NOT_IN_PORTAL_CATALOG` (the template is not in this portal's catalog, or there is no template with this id: the answer is the same, so it never says which ids exist), `404 TEMPLATE_NOT_FOUND` (the template is in the catalog but is archived or not published), `400 TEMPLATE_NOT_STARTABLE` (the template is not set up for people to start themselves), `400 KICKOFF_VALIDATION_FAILED` (a start field is missing or not valid, with details for each field), `400 CONNECTION_BUNDLE_REJECTED` (the connection picked can't be used for this flow), `422 BUILDING_BLOCK_EXPANSION_FAILED` (the template uses a building block that isn't available), `400 VALIDATION_ERROR` (a building block in the template no longer works with the person it is bound to), `422 ORG_CHART_NO_APPROVER` (neither a manager nor the template's fallback person can take a role filled from the org chart), `400 ASSIGNEE_NOT_INVITABLE` (a person the template assigns was deactivated or removed), `402 ORG_SUSPENDED` (the organization's account is suspended), `402 QUOTA_EXCEEDED` (the plan's included AI is used up, so no new live work starts).

**Idempotency:** you can send an `Idempotency-Key` header (any unique string). A retry with the same key returns the stored result instead of running the action again. When the stored result can no longer be rebuilt, the retry returns `410 IDEMPOTENCY_RESULT_LOST`: treat the first outcome as unknown. Requests without the header run as usual.

**Tokens:** SDK session token

**Parameters**

- `Idempotency-Key` (header, string): A unique key that makes retries safe. See **Idempotency** in this endpoint's description.

**Request body**

- `application/json`: object

**Responses**

- `201` (object): The flow was started.
- `400` (ErrorResponse): Refused: `ASSIGNEE_NOT_INVITABLE`, `CONNECTION_BUNDLE_REJECTED`, `KICKOFF_VALIDATION_FAILED`, `TEMPLATE_NOT_STARTABLE`, `VALIDATION_ERROR`. The description says when; `error.code` says which.
- `401` (ErrorResponse): The token is missing or not valid.
- `402` (ErrorResponse): Refused: `ORG_SUSPENDED`, `QUOTA_EXCEEDED`. The description says when; `error.code` says which.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): Refused: `IDEMPOTENCY_RESULT_LOST`. The description says when; `error.code` says which.
- `422` (ErrorResponse): Refused: `BUILDING_BLOCK_EXPANSION_FAILED`, `ORG_CHART_NO_APPROVER`. The description says when; `error.code` says which.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/actions`: List the person's actions

Returns the actions the signed-in person sent or received, newest first. `scope` narrows the list: `waiting_on_them` (you asked, they haven't answered), `waiting_on_me` (someone asked you), `done` or `all`. Always only what involves the person, never an organization-wide list, whatever the person can see in Moxo. For that, use `/v1/actions`.

**Tokens:** SDK session token

**Parameters**

- `scope` (query, string)
- `q` (query, string): Text to find in the action names.
- `limit` (query, integer): Actions per page, 1 to 50.
- `offset` (query, object): How many actions to skip. Defaults to 0.

**Responses**

- `200` (object): A page of actions.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/actions`: Send an action

Sends one request to one or more people, as the signed-in person. They get an email with a link and need no account, portal or app. Needs the `actions.send` permission: a person your organization doesn't let send actions is refused here too, so your own interface can't get around that setting. The person can send 20 actions an hour from no conversation. Past it, the call returns `429 TOO_MANY_REQUESTS` with `Retry-After` and `error.retryAt`, when sending works again.

**Tokens:** SDK session token

**Request body**

- `application/json`: SdkV1CreateAction

**Responses**

- `201` (object): The action that was sent.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/actions/{id}`: Get an action

Returns one action: who it went to, where each of them stands, and whether each has opened it. Build on each person's `openedAt`: the action's own open time is set by the first person to open it, so on a large acknowledgement it is set the moment one person looks. Returns 404 if the action isn't one of yours.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): The action's id.

**Responses**

- `200` (object): The action
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/actions/{id}/remind`: Send a reminder

Reminds everyone who hasn't answered; nobody who has answered is contacted. Available to whoever sent the action, whether or not they can still send new ones.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): The action's id.

**Responses**

- `200` (object): How many people were reminded.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/actions/{id}/cancel`: Withdraw an action

Withdraws the action. One nobody has answered is deleted; one that has been answered is canceled instead, because the other person is entitled to its record too. The response says which happened.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string): The action's id.

**Responses**

- `200` (object): Whether the action was deleted or canceled.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/conversations`: List conversations (Messages inbox)

Returns the signed-in person’s Messages inbox: group conversations and, by default, the flow chats they take part in.

**To leave out flow chats,** send `kind=group`. `kind=flow` returns only flow chats; leaving `kind` out, or `kind=all`, returns both. Send `scope=all` to include every group conversation when this persona may view all conversations. A room they have not joined comes back with `viewerOnly: true` and no `role`. Without that grant, `scope=all` is the conversations they are in. Flow chats stay the ones they take part in either way. Most recent activity first; page with `cursor` (the previous page's `nextCursor`, the same cursor `/v1/conversations` issues). A cursor this list didn't issue returns 400. A flow's chat history is on `GET /sdk/v1/flows/{id}/messages`.

**Tokens:** SDK session token

**Parameters**

- `search` (query, string): Text to find in the title or the last message, ignoring case.
- `kind` (query, string): `all` (the default) returns group conversations and flow chats, `group` only group conversations, and `flow` only flow chats.
- `filter` (query, string)
- `includeArchived` (query, boolean)
- `scope` (query, string): Send `all` for every group conversation when this person may view all conversations. The default is the conversations they are in.
- `limit` (query, integer): Items per page, up to 200. Defaults to 50.
- `cursor` (query, string): The previous page's `nextCursor`. Leave it out for the first page.

**Responses**

- `200` (object): A page of the inbox.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations`: Create a group conversation

Starts a group conversation as the signed-in person, who becomes its manager, under the same rules as the app. Needs Group Chat on the organization's plan. A participant id that matches nobody returns 400, naming it. A portal user limited to people they already work with gets 403 for anyone they can't add, whether or not that person exists.

**Tokens:** SDK session token

**Request body**

- `application/json`: object (required)

**Responses**

- `201` (object): The new conversation.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/conversations/unread-count`: Unread conversation count

Returns the badge number for the signed-in person: unread conversations they take part in.

**Tokens:** SDK session token

**Responses**

- `200` (object): Badge count
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/conversations/{id}`: Get a group conversation

Returns a group conversation the signed-in person can read, with its participants. A person who may view all conversations and has not joined gets `viewerOnly: true` and no `role`. A flow id returns 404: for a flow's chat, use `GET /sdk/v1/flows/{id}/messages`.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Conversation detail
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /sdk/v1/conversations/{id}`: Rename a conversation

Changes the title. Only a conversation manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: PatchConversation (required)

**Responses**

- `200` (object): Updated conversation
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /sdk/v1/conversations/{id}`: Delete a conversation

Deletes the conversation for everyone. Only a conversation manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/join`: Join a conversation

Takes a seat in a group conversation this person can read but is not in. Needs View all conversations, on a plan that allows it. Already being in it changes nothing.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): You are in the conversation.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/archive`: Archive a conversation

Only a conversation manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Done
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/unarchive`: Unarchive a conversation

Only a conversation manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Done
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/conversations/{id}/participants`: List participants

Returns the participants of a group conversation the signed-in person is in.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Responses**

- `200` (object): Participants
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/participants`: Add participants

Adds people to the conversation. Only a conversation manager can do this, under the same rules as the app. An id that matches nobody returns 400, naming it.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object (required)

**Responses**

- `201` (object): Added
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `PATCH /sdk/v1/conversations/{id}/participants/{userId}`: Change a participant's role

Makes a participant a `manager` or a `member`. Only a conversation manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)
- `userId` (path, required, string)

**Request body**

- `application/json`: object (required)

**Responses**

- `200` (object): Updated
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `DELETE /sdk/v1/conversations/{id}/participants/{userId}`: Remove a participant

Removes one person from the conversation. Only a conversation manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)
- `userId` (path, required, string)

**Responses**

- `200` (object): Removed
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `GET /sdk/v1/conversations/{id}/messages`: List messages in a group conversation

Returns the messages in a group conversation. The first page has the latest messages, and each `nextCursor` goes further back; within a page, messages run oldest to newest. Messages that share a timestamp are never skipped. A cursor this list didn't issue returns 400. For a flow's chat, use `GET /sdk/v1/flows/{id}/messages`.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)
- `cursor` (query, string): The previous page's `nextCursor`. Leave it out for the latest page.
- `limit` (query, integer): Items per page, up to 200. Defaults to 50.

**Responses**

- `200` (object): A page of messages.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/messages`: Send a message

Posts a message in a group conversation as the signed-in person, exactly as the app does (posting clears their own unsent draft there). A mention id that matches nobody returns 400, naming it. Send an `Idempotency-Key` to retry safely: a retry with the same key returns 201 with the original message and posts nothing, as on `/v1/conversations/{id}/messages`.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)
- `Idempotency-Key` (header, string): An optional key of up to 256 letters, digits, `-`, `_`, `:` or `.`; any other key is refused with `400 INVALID_IDEMPOTENCY_KEY` and nothing is posted. A retry with the same key within 10 minutes returns the original message instead of posting it twice.

**Request body**

- `application/json`: SdkSendConversationMessage (required)

**Responses**

- `201` (object): The message: the new one, or the original one when this is a retry with the same `Idempotency-Key`.
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `410` (ErrorResponse): The first result for this `Idempotency-Key` can no longer be returned, because what it created was deleted. Use a new key for the next attempt.
- `425` (ErrorResponse): A request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds. If the first request failed with a `5xx`, the key stays held for 10 minutes; to retry sooner, use a new key.
- `429` (ErrorResponse): Too many requests.
- `503` (ErrorResponse): The first result for this `Idempotency-Key` couldn't be checked. Retry with the same key after a short wait. If it keeps happening, contact support with the `requestId`.

### `DELETE /sdk/v1/conversations/{id}/messages/{messageId}`: Delete a message

Deletes a message; it stays in the thread as "This message was deleted". Its author or a manager can do this.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)
- `messageId` (path, required, string)

**Responses**

- `200` (object): Deleted
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/read`: Mark a conversation as read

Marks the conversation as read for the signed-in person, up to `messageId` or, with no body, up to the latest message. A `messageId` that isn't a message in this conversation that they can see returns 404.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Marked
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

### `POST /sdk/v1/conversations/{id}/unread`: Mark a conversation as unread

Marks the conversation as unread for the signed-in person, from `messageId` onward or, with no body, all of it. A `messageId` that isn't a message in this conversation that they can see returns 404.

**Tokens:** SDK session token

**Parameters**

- `id` (path, required, string)

**Request body**

- `application/json`: object

**Responses**

- `200` (object): Marked
- `400` (ErrorResponse): The request is not valid: `VALIDATION_FAILED` names each field in `error.details`, or `error.code` says what is wrong.
- `401` (ErrorResponse): The token is missing or not valid.
- `403` (ErrorResponse): The token can't do this: its person lacks the permission, or the key lacks the scope.
- `404` (ErrorResponse): Not found, or you can't see it.
- `429` (ErrorResponse): Too many requests.

## MCP Server

Connect AI agents and AI clients, such as Claude Desktop, Cursor, Continue or your own, to Moxo through the Model Context Protocol. The MCP server uses the same tokens, scopes and organization boundaries as the REST API.

The MCP page lists every tool, how to install the server in popular clients and how to call it over HTTPS:

→ **[Open the MCP server documentation](/docs/mcp)**

## Changelog

Version history for the public REST API: every breaking change, deprecation and addition, with its release date, its category and, when one applies, a migration note.

→ **[Open the REST API changelog](/v1/changelog)**

## Errors

Every error response has an HTTP status and an `error.code`. Below is every code the API returns, with its HTTP status, what it means and what to do. Each endpoint lists the codes it returns.

## Any call

- `UNAUTHORIZED` (401): The token is missing or not valid. Send `Authorization: Bearer <token>` with a token from Settings → API keys.
- `INVALID_TOKEN` (400, 401): The token matches no token on this host: it is mistyped, no longer exists, or belongs to another region (each region keeps its own tokens). With `400`, the token in a callback URL (a Wait step's or a Grok Bot step's) is not in the right form. Check the token, or create a new one in Settings → API keys. If your organization is in another region, use its address: `api.moxo.com` (US), `api.eu.moxo.com` (EU), `api.au.moxo.com` (Australia) or `api.sg.moxo.com` (Singapore). For a callback, use the URL the step gave you as it is.
- `API_ADDRESS_CHANGED` (409): The token's organization is served at another address now. `error.apiBaseUrl` is that address. Send the same call to `error.apiBaseUrl` with the same token.
- `ORG_PAUSED` (503): The organization is paused for a moment, so nothing was read or changed. Wait the number of seconds in `Retry-After`, then retry.
- `TOKEN_EXPIRED` (401): The token has expired. Create a new token.
- `TOKEN_REVOKED` (401): The token was revoked. Create a new token.
- `FORBIDDEN` (403): The token is valid but cannot do this. Use a token whose owner (or scopes) can do it in the app.
- `INSUFFICIENT_SCOPE` (403): The organization API key lacks the scope this call needs, or the caller cannot change a person the call would change. Add the scope named on the call to the key, or use a token that can change that person.
- `IP_NOT_ALLOWED` (403): The request came from an address outside the key's allowlist. Call from an allowed address, or add this one to the key's allowlist.
- `ORG_NETWORK_RESTRICTED` (403): An internal user's token was used from outside the organization's approved sign-in networks. `error.clientIp` is the address Moxo saw; `error.orgId` and `error.orgName` name the organization. Organization API keys are not affected. Call from an approved network, or use an organization API key for unattended systems.
- `AUTH_POLICY_UNAVAILABLE` (503): The organization's sign-in policy could not be read, so the request was refused rather than allowed. Retry with backoff.
- `NOT_FOUND` (404): It doesn't exist, or you can't see it. Check the id, and that the token can see it in the app.
- `BAD_REQUEST` (400): The request body or parameters are not valid. Fix the request as the message says.
- `VALIDATION_FAILED` (400): The request failed its schema check; `error.details` names each field. Fix each field named in `error.details`.
- `RATE_LIMITED` (429, 503): Too many requests (429), or too many of the same heavy request running at once (503, a data table download). Wait the number of seconds in `Retry-After`, then retry.
- `AUTH_BRUTEFORCE_LIMIT` (429): Your IP address sent 10 tokens that failed (mistyped, expired, revoked or from a blocked address) in 15 minutes, so every request from it is refused for a while, even one with a good token. Fix the token, wait the number of seconds in `Retry-After`, then retry.
- `UNSUPPORTED_MEDIA_TYPE` (415): The request's `Content-Type` isn't one this call takes: a body is JSON, and an upload is `multipart/form-data`. Send the body with the content type the message names.
- `QUOTA_EXCEEDED` (402): The plan's quota is used up (monthly flows, AI credits). Wait for the quota to reset, or change the plan.
- `UNKNOWN_PARAMETER` (400): The call does not take a query parameter that was sent; the message names it and where the parameters are listed. Remove it, or fix its spelling.
- `INVALID_IDEMPOTENCY_KEY` (400): The `Idempotency-Key` header is longer than 256 characters, uses a character other than letters, digits, `-`, `_`, `:` and `.`, or was sent twice. Nothing ran. Send one key in that format, such as a UUID.

## Specific calls

- `ACCESS_REQUEST_ALREADY_DECIDED` (409): Someone already approved or declined this request to join the flow. Nothing to do. List the open requests again to see what is left.
- `ACK_ALREADY_ACKNOWLEDGED` (400): Someone has already acknowledged this step, so what they acknowledged cannot change. Leave its content as it is, or remove the step and add a new one.
- `ACTION_ASSIST_FILE_NOT_IN_ORG` (400): A file named in the files Assist reads (`config.assist.faqFiles`) is not a file of your organization. Remove that file id, or upload the file again and send its new id.
- `ACTION_ASSIST_FILE_UNAVAILABLE` (409): A file named in the files Assist reads (`config.assist.faqFiles`) is neither one this flow's Assist already reads nor an upload of the token's person, so it can't be added. Remove that file id, or upload the file with the same token and send its new id.
- `ACTION_CLOSED` (409): The step closed at its due date (Close at the due date). What was saved has been sent on, and it can't be changed now. A flow manager can reopen it with a new close.
- `ACTION_ENDED` (409): The flow is a one-off action that has ended. An action is one ask, so it can't be continued or have its steps reopened once it has finished. Send a new action to the person instead.
- `ACTION_NOT_OPEN` (409): The step has no close, or isn't open, so there is nothing to close now. Read the flow again; nothing was changed.
- `ACTION_ONE_ASK` (409): The flow is a one-off action (`kind: "action"`). An action is one ask, so a step can't be added to it, on any plan. Send a new action instead, or start a flow.
- `ACTION_TEST_ONE_STEP` (400): The flow is a test the sender sent to themselves, and a test holds one request only. Send a real flow to add steps.
- `ACTIONS_LIMITED_TO_MANAGERS` (403): Your organization lets only conversation managers send actions in a conversation, and the token's person is not a manager of this one. Use a manager's personal access token, or ask an admin to change who may send actions.
- `ADD_SEAT_NOT_SUPPORTED` (400): This step type takes its people from its own sides, so a person cannot be added here. Add the person to the side's role.
- `ADMIN_INVITE_REQUIRES_ADMIN` (403): Only an admin can give someone an admin persona: by inviting them, or by activating an invitation that makes them an admin. Nothing was changed. An admin does it, or the person accepts their invitation themselves.
- `AI_DISABLED` (403): The organization has AI turned off. An admin turns AI on in Settings.
- `AI_UNAVAILABLE` (503): The AI could not answer just now, so nothing was written. `error.retryable` says whether a retry can help: `true` for a passing failure, `false` when the AI account itself needs attention from Moxo. When `error.retryable` is `true`, retry after the number of seconds in `Retry-After`. When it is `false`, do not retry; contact support with the `requestId`.
- `ALREADY_COMPLETED` (409): The step, or your part in it, is already done. Nothing to do; read the step to see the result.
- `ALREADY_EXISTS` (409): A relationship with this external reference is already here. Send `PATCH` to change the one that is there, or create yours under a reference of its own.
- `ALREADY_FIRED` (409): This flow monitor already ran on this flow, so it cannot be turned off. Nothing to do. A monitor runs once.
- `ALREADY_PAUSED` (409): The flow is already paused; `error.pauseEpisodeId` names the pause. Nothing to do.
- `ALREADY_SENT` (409): A newer version was sent since you read the collaboration. Read the collaboration again and act on the current version.
- `AMBIGUOUS_ATTACHMENT` (409): Two attachments on the step point at the same address and share an id, so removing one would be a guess. Give them different addresses in the template.
- `AMBIGUOUS_MULTI_ROLE_ASSIGNMENT` (400): The step has more than one role, and the person could fill more than one. Name the roles with `roleIds`.
- `AMBIGUOUS_SLOT` (400): You hold more than one open part on this approval, so the request does not say which to decline; `error.availableSlotIds` lists them. Decline in Moxo, where each part is shown, or ask a flow manager.
- `AMBIGUOUS_STEP` (409): More than one run of the step is open, so the step's template id does not say which. Name the run with its execution id.
- `ANCHOR_INSIDE_MOVED_STEP` (409): The step would move next to a step inside itself. Pick an anchor outside the step.
- `APPROVAL_DECIDED_OTHERWISE` (409): The approval itself was already decided another way this round, so your decision was not made (while it still waits on other approvers, your own part decided another way is `410 NO_ACTIVE_SLOT`). `error.decision` is the one that stands (`APPROVE`, `REJECT` or `REQUEST_CHANGES`). The same decision sent again answers `200` with `changed: false`. Read the step. To decide again, reopen it first.
- `ARCHWAY_REQUIRES_DETACH_ACK` (409): The template was installed from an Archway bundle, and this change would detach it from that bundle. Nothing was changed. Send the same request again with the header `x-archway-detach-ack: 1` to make the change and detach the template.
- `ASSIGNEE_NOT_HUMAN` (400): The assignee is an AI agent or a service account. Choose a person.
- `ASSIGNEE_NOT_IN_CONVERSATION` (400): Someone you asked is not in the conversation the action is sent in. Add them to the conversation first, or ask someone who is in it.
- `ASSIGNEE_NOT_INVITABLE` (400): The assignee was deactivated or removed. Choose an active person.
- `ASSIGNEE_REQUIRED` (403): An organization API key called an assignee's endpoint. A key is not a person, so it can't record a person's work. Use the assignee's personal access token.
- `ASSIGNMENT_NOT_SUPPORTED` (400): Moxo does not edit this step type's settings on a running flow. Use reassign.
- `ATTACHMENT_ALREADY_BOUND` (409): A file in `attachmentFileIds` is already on another message. Upload the file again for this message.
- `ATTACHMENT_BAD_STATUS` (400): A file in `attachmentFileIds` hasn't finished uploading. Finish the upload (the `PUT`, then the `completionUrl` when there is one), then send the message.
- `ATTACHMENT_NOT_FOUND` (404): A file in `attachmentFileIds` doesn't exist. Send the `fileId` the upload link or the project copy answered.
- `ATTACHMENT_NOT_OWNED` (403): Only the person who uploaded a file can send it. Upload the file with your own token.
- `ATTACHMENT_NOT_REMOVABLE` (409): The material comes from the template, so it can't be removed from a running step. Change the template so new flows leave it out.
- `ATTACHMENT_SCAN_FAILED` (400): The virus scan blocked a file in `attachmentFileIds`. Choose a different file.
- `ATTACHMENT_VISIBILITY_MISMATCH` (403): A file from someone outside your organization can't go in a message only your team sees. Send it on a step its participants see.
- `ATTACHMENT_WRONG_FLOW` (400): A file in `attachmentFileIds` was uploaded for another flow. Upload it for this flow.
- `AUTOMATION_AI_INSTRUCTION_RETIRED` (400): The action's `config.automations` adds an AI instruction (`kind: "ai"`), which an action no longer takes; `error.entryIds` names each one. Use an app or an agent entry, or leave the entry out.
- `AUTOMATIONS_REQUIRE_SEE_ALL` (400): Automated actions can be shown only to a role that sees every action. Turn on `allowViewAllActions` in the same call.
- `AWAIT_FIRST_WORD` (403): The organization has turned off your side writing first, and this relationship has no conversation yet. Wait for the client to write. Once the conversation exists, your side can answer in it.
- `BATCH_NOT_ACTIVE` (409): Someone earlier in the order has not finished. Wait for it to finish.
- `BUILDING_BLOCK_EXPANSION_FAILED` (422): A building block in the template could not be set up for this flow. Fix the building block in the template, then start again.
- `CALENDAR_RECONNECT_NEEDED` (409): The host's calendar connection was refused, so the meeting wasn't canceled or moved. Nothing was changed. The host reconnects their calendar, then try again.
- `CALENDAR_UNAVAILABLE` (503): The host's calendar didn't answer, so the meeting wasn't canceled or moved. Nothing was changed. Try again in a moment.
- `CANDIDATES_CHANGED` (409): The records a lookup asked someone to pick changed after the list was shown. Nothing was saved. `data.outputResolution` is the current list. Show the new list and send the pick again with its `round`.
- `CANNOT_DEACTIVATE_SELF` (400): A personal access token can't deactivate or delete its own person. Nothing was changed. Use another person's token, or an organization API key that may deactivate them.
- `CANT_APPLY` (409): Moxo can't make the suggested change where it is, such as inside the signature block. Make the change yourself in an edited copy, or dismiss the suggestion.
- `CAPABILITY_DENIED` (403): The person behind the token lacks the permission this call needs. Give them the permission in People → Orchestrator permissions, or use a token whose owner has it.
- `CAPABILITY_DISABLED` (400): The organization's plan does not include this step type or setting. Leave it out, or change the plan.
- `CHANGE_REFUSED` (422): An AI agent update (`PATCH /v1/agents/{id}`) was refused by the agent file's rules, and nothing was saved. `error.issues` lists each problem with where it is. Fix each issue and send the update again.
- `CHANGES_OTHER_STEPS` (409): The move or add would change more than the step it names. Use Edit process in the app.
- `CHANGES_REFUSED` (422): The change list was refused and nothing was saved. Fix each issue in `data` and resend the whole list.
- `CHANGES_TARGETS_UNAVAILABLE` (422): A request for changes named steps none of which can take them (not a step before this approval, or skipped). Nothing changed. Name a step before the approval that was done, or approve or reject instead.
- `CHECK_PENDING` (409): The PDF is still being made, or the document is still being checked. Submit again in a minute.
- `CHECKLIST_INCOMPLETE` (400): A checklist item is not in a status that finishes the step (`DONE` or `SKIPPED`, or what the template allows). Send every item's status in `resultData.checklistState`, keyed by its `itemId`.
- `CLOSE_IN_PAST` (400): The new close has already passed. Send a `closesAt` still ahead.
- `CLOSE_REQUIRED` (400): The step closes at its due date, and neither its own close nor its template's due date gives one still ahead. Send `closesAt`, a date and time still ahead.
- `CODE_INVALID` (401): The code is wrong or expired. Ask for a new code.
- `COMMENTS_DISABLED` (403): Comments are off for this flow; reading still works. Turn comments on for the template, or read only.
- `COMPLETED_FLOW_KEPT` (403): The flow has completed and its template keeps its completed flows (`settings.allowDeleteCompletedFlows` is `false`), so nobody can delete it. Archive the flow to hide it. To delete it anyway, someone who can edit the template turns the setting on, deletes it, and turns the setting back off.
- `COMPLETION_MODE_LOCKED` (409): Someone has already responded, so whether anyone or everyone must answer cannot change. Leave the completion mode as it is. People can still be added or removed.
- `COMPLETION_MODE_NOT_ALLOWED` (400): This step type has no Anyone or Everyone to set (a poll asks each person to vote). Leave the completion mode out of the settings.
- `COMPLETION_REQUIRES_MEMBER` (403): Only an internal user can confirm this Web App step. Use an internal user's token.
- `COMPLETION_REQUIRES_WEBHOOK` (409): This Web App step is finished by the web app's own call to Moxo. Let the web app finish it, or have a flow manager force-complete it.
- `CONFLICT` (409): Someone else changed it at the same moment. Read it again and resend.
- `CONFLICTING_START_RULES` (400): `skipSequentialOrder` and `dependsOnStepIds` were both sent; a step starts one way or the other. Send one of them.
- `CONFLICTS_CHANGED` (409): The passages to choose between changed since you read them. `error.conflicts` lists them now. Choose again for the passages listed.
- `CONNECTION_BUNDLE_REJECTED` (400): The connections sent for the template's steps were refused. Send connections the template can use.
- `CONNECTION_CHOICE_REQUIRED` (409): Several connected accounts could be used; the response lists them. Send `connectionId`.
- `CONNECTION_REQUIRED` (409): No connected account exists for this app; `error.connectUrl` is where a person connects one. For an app trigger, only the organization's accounts count: one a person connected for themselves alone does not. When Moxo saves a template it is an issue code instead: the action names an account your organization does not have, and the issue carries `connectUrl`. A change sent from code saves such an action waiting for its account instead (`needsAPerson` with the link). Have a person open the `connectUrl` and connect the app, then retry with the new account's id (`GET /v1/connections`).
- `CONTENT_MOVED` (409): Someone saved the text since you read it. `error.contentRevision` is the revision now. Read the collaboration again and approve the text as it stands.
- `CONVERSATION_NEEDS_CREATOR` (400): An organization API key started a conversation without naming who on your team starts it. Name them in `startedBy`: they become its manager.
- `CONVERSATION_UNAVAILABLE` (409): The conversation is archived, so nothing can be posted, sent or changed in it. Unarchive it first, or use another conversation.
- `CREATOR_NOT_INTERNAL` (400): `startedBy` names someone who is not an active member of your team. Name an active person inside your organization.
- `CREDENTIAL_NOT_ACCEPTED` (422): An issue code: the change list sends a password or user name a person types into the step in Moxo, such as a web app's Basic auth. These never travel through the API; nothing was saved. Leave it out, or send it back as the read shows it (`null`), to keep the saved one. A person sets it in Moxo.
- `CUSTOM_ACTION_ANSWERS_MISSING` (400): A required answer on the custom action's page is empty. `error.details.missing` lists the output ids. Answer those on the page, then send again.
- `CUSTOM_ACTION_NOT_CONFIRMED` (400): A custom action is completed with the answers its person sent from the action's page, and this person hasn't sent theirs. The person answers on the page and sends their answers, then the step can be completed.
- `CUSTOM_ACTION_PAGE_CHANGED` (409): The custom action's page changed after the person answered it. The person checks their answers on the page again and sends them.
- `CUSTOM_ACTION_PAGE_NOT_APPROVED` (409): The template version holds a custom action step with no approved page (a version published before pages existed, or a test run of an unfinished draft), so the flow can't start. Build the step's page, approve it and publish the template again, then start the flow from the new version.
- `CUSTOM_ACTION_PAGE_WAITING` (409): The custom action's page couldn't be filled for this flow, so it is waiting for the person preparing the step. Wait until the page is ready, or force-complete the step with a reason.
- `DECISION_MIN_OUTCOMES` (400): A decision needs at least 2 options. Send 2 or more options.
- `DECISION_OPTION_ID_INVALID` (400): Two decision options share an id, or an id is not text. Give each option its own text id, or leave the ids out.
- `DECISION_OPTION_LABEL_REQUIRED` (400): A decision option has no label. Give every option a `label`.
- `DECLINE_FAILED` (400): The decline couldn't be applied; the message says why. Nothing changed. Read the step, then decline again or act on its current state.
- `DESK_NOT_FOUND` (404): The team desk does not exist in your organization. Send a desk id from your organization.
- `DIRECT_CHAT` (400): A direct chat is two people and cannot be left. Archive the conversation instead.
- `DIRECTORY_MANAGED` (409): The organization's directory sets this for this person; `error.field` names the field. Change it in the directory.
- `DOC_COLLAB_FILE_TYPE_NOT_ACCEPTED` (422): The file is not a type a collaboration's documents can use. Upload a Word document (.docx), a PDF, a PowerPoint (.pptx), an Excel file (.xlsx) or an image.
- `DOC_COLLAB_USE_TURN_ACTIONS` (409): This document collaboration finishes when everyone on it agrees on the document. Approve the current version with `POST /v1/flows/{id}/steps/{stepId}/doc-collab/approve` (`…/doc-collab/approve-content` for text written together), or send your version with `…/doc-collab/send`.
- `DOCUMENT_REPLACE_FAILED` (500): The new document couldn't be put in place, so the step keeps its previous document. Try again.
- `DOCUMENT_REPLACE_REQUIRED` (400): The edit names a different document than the step's. Replace the document with `POST /v1/flows/{id}/steps/{stepId}/document`, or send the setting as Get step settings shows it.
- `DOCUMENT_REPLACED` (409): Someone else saved a different file first. Read the step again before replacing it.
- `DOCUMENT_UNREADABLE` (400): The PDF cannot be opened. Send a PDF that opens.
- `DRAFT_CHANGED` (409): Your side's draft changed since you read it. `error.draftRev` is its revision now. Read the collaboration again, then name the draft as it stands.
- `DUE_DATE_IN_PAST` (400): The due date has already passed. Send a date in the future.
- `DUPLICATE` (409): Someone in the organization already has this email, or is invited with it. Nothing was changed or sent. `error.existingUserId` is their id when you may read them. An inactive internal user is the same answer, with `error.reason` `deactivated_member`. Use that person. To send their invitation again, call `POST /v1/users/{id}/resend-invite`. An inactive internal user is reactivated with `POST /v1/users/{id}/activate`.
- `DUPLICATE_FOLDER` (409): A folder with that name is already beside it in the conversation's files. Choose another name, or use the folder that is there.
- `DUPLICATE_STEP_STATUS_ID` (400): Two entries in `stepStatuses` share an `id`, so nothing was saved. A status's `id` is its identity: the `key` a published version holds follows it. `error.id` names the repeated one. Give each status its own `id`. To keep a published status, send it once with its `id`.
- `EDITING_BY_OTHER` (409): Someone else has the document open in Moxo. Submit when they are done.
- `EMAIL_BELONGS_TO_ANOTHER_ACCOUNT` (409): The new email is already used to sign in to Moxo by someone else. Nothing was changed. Use another email, or find out who holds this one.
- `EMAIL_BELONGS_TO_ANOTHER_USER` (409): A session by `uniqueId` carried an `email` that belongs to someone else in your organization, so your records name two different people. Send the person's own email with their `uniqueId`, or leave `email` out.
- `EMAIL_CHANGE_ALONE` (400): `email` was sent with other fields. Changing the email someone signs in with moves them to the new email's sign-in, so it is a request of its own. Nothing was changed. Send `email` alone in one `PATCH /v1/users/{id}`, and the other fields in another.
- `EMAIL_CHANGE_NOT_ALLOWED` (409): This person's email can't change from here; `error.reason` says why: `org_key_only` (only an organization API key can), `internal_member` (they are an internal user), `no_unique_id` (they have no unique ID) or `sign_in_provider` (they sign in with Google, which owns their email). Nothing was changed. Use an organization API key with the `users:email` scope, give the person a unique ID first, or ask the person to change their email themselves. An internal user always changes their own.
- `EMPTY_FILE` (400): The file sent has no bytes. Send the file again, with its content.
- `ESIGN_ALREADY_SIGNED` (400, 409): Someone has already signed the document. Leave the document as it is.
- `ESIGN_PREPARER_PLACED` (409): A preparer has placed the signing fields, so the document and its fields cannot change. Leave the document and fields as they are. The name, due date and reminders still change.
- `ESIGN_REINIT_FAILED` (500): The signing document couldn't be rebuilt, so the step keeps its previous document and signing files. Try again.
- `ESIGN_SIGNATURE_REQUIRED` (409): An e-signature step finishes when the document is signed. Sign it, or have a flow manager force-complete it.
- `ESIGN_SOURCE_DOCUMENT_LOCKED` (409): The template prevents replacing this PDF; nothing was saved. Keep the PDF the template set.
- `EVAL_RUN_RATE_LIMITED` (429): You started too many eval runs this hour. Wait the number of seconds in `Retry-After`, then start it again.
- `EXECUTION_ORDER_STARTED` (409): The step has started, so when it starts can no longer change. Leave `skipSequentialOrder` and `dependsOnStepIds` as they are.
- `EXECUTION_REQUIRED` (400): Two or more copies of the step are waiting to be prepared. Name one with `?stepExecutionId=`.
- `EXTERNAL_APP_UNDECLARED_INPUT` (422): An issue code: an app step has an input key that its action does not take, so no run reads it. The issue names the key and the action's inputs. Nothing was saved. A key the template already holds, sent back unchanged, is not refused: no run reads it, and it is removed when the template is read, saved or published. Key `externalApp.inputs` by the action's input ids (`GET /v1/step-types/EXTERNAL_APP?app=<appId>` lists them), and remove the key the issue names. Custom properties go inside the action's list input (`customFields`, `fields`).
- `EXTERNAL_APP_UNKNOWN_ACTION` (422): An issue code: an app step names an app, or an action of its app, that the app catalog does not have, so no run could call it. Nothing was saved. Choose one of the app's actions (`GET /v1/step-types/EXTERNAL_APP?app=<appId>` lists them).
- `EXTERNAL_CANNOT_LEAVE` (403): Someone from outside the organization cannot leave a conversation. A manager removes them.
- `FEATURE_DISABLED` (403): The organization's plan does not include this feature; `error.feature` names it, and `error.upgradeAvailable` is `true` when a plan upgrade adds it. When `error.feature` is `haiFlow`, `haiActions` or `haiChat`, it names a Moxo product the organization does not have: new work for that product is refused, and work already running carries on. Turn it on for the organization, or skip the call.
- `FEATURE_NOT_ON_PLAN` (422): A step whose action type your organization's plan doesn't include. As an issue code it names the change that adds it; on its own it refuses a save, or an import of your own file or bundle, that adds one. A step the template already has keeps its type, and publishes and runs. Nothing was saved. Remove the step, or ask an admin to add the action type to the plan. `get_build_context` lists the action types your plan includes.
- `FIELD_KEY_LOCKED` (409): A published question or table column can't change its `key`, so nothing was saved. `error.fields` lists each one as `{ fieldId, key, attemptedKey }`, where `key` is the one it keeps. Send the published `key` and change the `label` instead. For a different key, add a new field.
- `FIELD_LABEL_REQUIRED` (422): An issue code: a question the change list writes has no label, or only spaces. A heading, page break or other layout piece may leave its label empty. Give the question a `label`.
- `FIELD_NOT_ON_REPLACEMENT` (422): An issue code: `remove_step` names a `replacedBy` that has no field for what another action reads from the removed one. The issue names each reader. Nothing is blanked and nothing was saved. Add the field to the replacement, or change the readers in the same list.
- `FILE_INFECTED` (422): A file failed its safety check; nothing was stored. Send a clean file.
- `FILE_NOT_AVAILABLE` (422): Part of this template can't be written as a file yet. Use the outline and change lists for this template.
- `FILE_NOT_FOUND` (404): The upload named by `fileId` is not one you uploaded into this step, or it is gone. Upload the file again (`POST /v1/flows/{id}/steps/{stepExecId}/prepared-document/upload-init`) and name its `fileId`.
- `FILE_NOT_READY` (409): The file failed to generate, so it has no link. Generate the file again.
- `FILE_REFUSED` (422): A pushed template file can't be read; nothing was checked or saved. `data.issues` lists each problem with where it is. Fix each issue in the file and push it again.
- `FILE_REJECTED` (404, 409, 413, 422): The file can't be used: it isn't your upload into this step, failed the virus check, or isn't a document the collaboration takes. `error.fileCode` says which. Upload the file again with `POST …/doc-collab/upload-init`, or upload another one.
- `FILE_TOO_LARGE` (413): The file is larger than the limit: the call's own (20 MB for a PDF), or your organization's upload rules. Send a smaller file.
- `FLOW_ARCHIVED` (409): The flow is archived. Unarchive it (`POST /v1/flows/{id}/unarchive`), then try again.
- `FLOW_BUSY` (503): Another change is working on the same flow and it stayed busy past a few seconds. Nothing was saved. Wait for the Retry-After header, then send the same request again (the same Idempotency-Key is accepted).
- `FLOW_CANCELLED` (403): The flow was canceled. Nothing more can happen on it.
- `FLOW_NOT_RUNNING` (409): The flow has finished. Continue the flow first, if that is what you want.
- `FLOW_PAUSED` (409): The flow is paused. Resume the flow, then retry.
- `FLOW_PAUSED_INSERT_BEFORE_CURRENT` (409): The flow is paused, and the step would go before the step the flow is on. Add it after that step, or resume the flow first.
- `FLOW_PAUSED_START_NOW` (409): A sub-flow was sent with `start: "now"` while the flow is paused: a sub-flow never starts under a paused flow, so nothing was added. Resume the flow first, or send `start: "later"` with `afterStepId`.
- `FOLDER_CYCLE` (409): A folder can't move into itself or into one of its own folders. Pick a parent outside the folder you are moving.
- `FOLDER_NOT_FOUND` (404): The template folder named in the body is not in your organization, or was just deleted. List the folders with `GET /v1/template-folders` and send one of their ids.
- `FOLDER_TOO_DEEP` (409): Template folders go 5 levels deep: the new folder, or the folder being moved with everything in it, would go past level 5. Pick a parent higher up, or move fewer levels at once.
- `FOR_EACH_SOURCE_UNRESOLVABLE` (409): A For each step still cannot read the list it repeats over. Skip it, or fix its list and retry.
- `FORM_FIELD_ID_DUPLICATE` (422): An issue code: two questions have the same `fieldId`. An id names one question everywhere (its answer, references, updates). Nothing was saved. Give each question its own `fieldId`, or leave it out and Moxo makes one from the `handle`.
- `FORM_QUESTIONS_LOCKED` (400): Someone has already answered this form, questionnaire or PDF form, or saved a draft of it, so its questions, PDF fields and PDF cannot change. Leave the questions as they are, or send a new form to ask something different. The name, due date and reminders still change.
- `GENERATION_QUOTA_EXCEEDED` (429): This credential's monthly AI generation quota is used up. Wait for next month, or use another credential.
- `GOAL_NEEDS_ADAPTIVE` (400): A goal was sent for a predefined flow, which has none. Send `mode: "adaptive"` with the goal, or leave the goal out.
- `GRANT_ALREADY_USED` (401): The grant was already used. Verify the email again for a new grant.
- `GRANT_INVALID` (401): The grant is not valid or has expired. Verify the email again for a new grant.
- `HOST_ROLE_UNASSIGNED` (400): The template books a meeting, and the role that hosts it was given nobody at the start. Give the host role a member of your team in `roleAssignments`.
- `IDEMPOTENCY_IN_PROGRESS` (409): A request with this idempotency key is still running. Retry after `Retry-After` seconds.
- `IDEMPOTENCY_KEY_REUSED` (422): This `Idempotency-Key` was already used for a different request (another body, path, query or method). Nothing ran. Use a new key for each request; resend the same request to retry it.
- `IDEMPOTENCY_RESULT_LOST` (410): The first result for this `Idempotency-Key` can no longer be rebuilt. Treat the outcome as unknown, check, and use a new key.
- `IDEMPOTENT_REQUEST_PENDING` (425): The first request with this `Idempotency-Key` is still running. Retry after `Retry-After` seconds.
- `IDENTITY_AMBIGUOUS` (400): The person was named two ways: `userId` with `email`, or `userId` with `uniqueId`. Send only one; `userId` stays the same if the person changes their email.
- `IDENTITY_REQUIRED` (400): None of `uniqueId`, `email` and `userId` was sent. Send one of them.
- `IDP_PERSONA_LOCKED` (409): The identity provider gave this persona, so it cannot be replaced here. Change it in the identity provider.
- `INSERT_BEFORE_STARTED_STEP` (409): The step to insert before has started, or the flow has moved past it; nothing was added. Insert before a step that has not started.
- `INVALID_CURSOR` (400): The cursor can't be read, or was changed. Send the previous page's `nextCursor` as it is, with the same filters.
- `INVALID_DOCUMENT` (400): The document is not in the editor's JSON form. Send the `doc` in the form the artifact read returns it.
- `INVALID_ITEM` (400): The item does not match the loop's item fields; `error.field` names the field. Send the loop's field names with text, numbers, yes or no, or lists of text.
- `INVALID_OWNER` (400): The person named to own the conversation is not a teammate still in it who can be reached. Choose a teammate who is in the conversation and can still be reached.
- `INVALID_STATE` (400): The flow or step is not in a state that allows this (for example it has finished). Read it again and act on its current state.
- `INVALID_STEP_SETTINGS` (400): A setting does not belong to this step type, or is outside its limits. Fix the setting the message names.
- `INVALID_STEP_TYPE` (400): This call works on another kind of step (a decline, on an approval only). Use the call for this kind of step.
- `INVALID_UNIQUE_ID` (400): The `uniqueId` is not a valid unique ID: empty, longer than 128 characters, with a character other than letters, digits and `@ . _ + -`, or shaped like a Moxo person id (`usr_…`, a UUID). Nothing was changed. Send your own identifier for the person, such as a customer number.
- `IS_TEST_RUN` (400): The flow is a test run, which can't be continued. Start a new test run.
- `KICKOFF_VALIDATION_FAILED` (400): A kickoff field value is missing or not valid; the details name each field. Fix each field named in the details.
- `LAST_OWNER` (400): This would remove the last Owner. Make someone else an Owner first.
- `LAST_PERSONA` (400): A person keeps at least one persona, and this is their last one. Nothing was changed. Give them another persona first, then take this one.
- `LAST_TEAMMATE` (409): The last teammate who can still be reached cannot leave, so someone from the team stays. Add a teammate first, or archive the conversation.
- `LINK_NOT_ALLOWED` (422): The conversation is with an external user on WhatsApp, and the organization sends WhatsApp without links, so a message or a change to one with a web address is not sent. Nothing was posted. `error.message` is the organization's own sentence for it. Take the web address out and send again.
- `LINK_TARGET_NOT_FOUND` (404): The flow, project or conversation to link a meeting to does not exist, or the token's person cannot see it. Link to a flow they can open, a project they are a member of, or a conversation they are in.
- `LIVE_AI_NOT_EDITABLE` (400): AI help is fixed once the step is sent: AI preparation, Assist on or off, its agent and what it may read of earlier steps, Advise, AI Review and Rename files. On a sent action an AI reviewer can still be added, swapped, given new instructions or swapped out for a person until the action is in review; switching Review off while it is AI is refused. `error.details.settings` lists what the save changed. Leave those settings as they are. What Assist knows and how it answers still change.
- `LIVE_PREPARERS_STARTED` (400): Preparation may have started, so who prepares is fixed. `error.details.settings` is `["preparers"]`. Leave the preparers as they are.
- `LOCK_EXPIRED` (409): Your hold on the task ran out, or the task was claimed again. Claim it again.
- `LOCKED` (409): Someone else has the document open in Moxo's editor, so it can't be changed until they close it. Try again once `editingBy` is gone from `GET /v1/flows/{id}/steps/{stepExecId}/prepared-document`.
- `LOOP_CLOSED` (409): Every item of the For each finished and the flow moved on. Add a step to the flow instead.
- `LOOP_ITEM_UNSUPPORTED` (409): The For each runs over uploaded files, and an added file needs its own upload and scan. Add a step to the flow instead.
- `LOOP_LIMIT_REACHED` (409): The For each is at its item limit; added items count toward it. Raise the loop's limit in the template for later flows.
- `LOOP_NOT_STARTED` (409): The For each has not started yet, so it has no items to add to. Wait until the flow reaches the loop.
- `MEETING_ALREADY_CANCELED` (409): The meeting is already canceled. Nothing to do; read the step to see it.
- `MEETING_CANCEL_BOOKING_TOO_OLD` (409): The meeting was booked, with no calendar, before Moxo kept who to tell when it is canceled, so it is not canceled here. Tell the people on the meeting directly.
- `MEETING_CANCEL_FORBIDDEN` (403): Only the flow's managers can cancel this meeting; with the step's `bookerCanCancel`, also its host and an internal user who booked. Ask a flow manager to cancel it.
- `MEETING_CHANGE_IN_PROGRESS` (409): Someone else is moving or canceling this meeting right now. Nothing was changed. Try again in a moment.
- `MEETING_CHANGE_STEP_CHANGED` (409): The step changed while the meeting was being moved. Read the step again.
- `MEETING_NOT_BOOKED` (409): The step is not a Time Booking step with a booked meeting. Name the Time Booking step whose meeting was booked.
- `MEETING_NOT_ON_CALENDAR` (409): The meeting's event is no longer on the host's calendar, so it was not moved. Moxo never recreates it. Book the meeting again.
- `MEETING_RESCHEDULE_BOOKING_TOO_OLD` (409): The meeting was booked before Moxo kept its host and calendar, so it can't be moved here. Move it in the host's calendar.
- `MEETING_RESCHEDULE_FORBIDDEN` (403): Only the flow's managers can move this meeting; with the step's `bookerCanReschedule`, also its host and an internal user who booked. Ask a flow manager to move it.
- `MEETING_RESCHEDULE_NO_HOURS` (409): The booking has no hours or calendar to read free times from. Move it in the host's calendar.
- `MEETING_RESCHEDULE_NOT_SUPPORTED` (409): The meeting was booked through Calendly or Zoom Scheduler, which reschedule on their own side. Reschedule it in Calendly or Zoom.
- `MEETING_SAME_TIME` (409): The meeting is already at this time. Pick another time.
- `MEETING_STARTED` (409): The meeting has already started, so it can't be canceled or moved. End it in the meeting itself.
- `MEETING_TIME_NOT_FREE` (409): The new time is not one of the host's free times under the booking's rules, or someone took it meanwhile. Nothing was changed. List the free times again and pick one.
- `MEETINGS_NOT_AVAILABLE` (403): Meetings is not on for the token's person: their organization does not have the Conductor turned on, or they cannot use it. Ask an admin of the organization to turn on the Conductor.
- `MENTION_EXTERNAL` (400): A person in `mentions` is outside your organization and isn't on the flow. Only your organization's people can be tagged in. Add them to the flow as a member first, or leave them out of `mentions`.
- `MENTION_INACTIVE` (400): A person in `mentions` is deactivated. Leave them out of `mentions`.
- `MENTION_NOT_ALLOWED` (403): A person in `mentions` isn't on the flow, and you can't add them by tagging: only a flow manager can, on a step (`targetStepExecutionId`), while the template's Tag anyone in the organization setting is on. Mention people on the flow, or ask a flow manager to tag them or add them as a member.
- `MENTION_UNKNOWN` (400): A person in `mentions` is not in this organization. Send `usr_` ids from this organization's people.
- `MESSAGE_DELETE_FORBIDDEN` (403): Only the person who sent a message can delete it. Delete a message you sent.
- `MESSAGE_DELETED` (410): The message was deleted. Read the chat again.
- `MESSAGE_EDIT_FORBIDDEN` (403): Only the person who sent a message can edit it. Edit a message you sent.
- `MILESTONE_NAME_TAKEN` (409): The flow already has a milestone with that name (ignoring case); nothing was added. Choose another name, or join that milestone with its `milestoneId`.
- `MILESTONE_NOT_HERE` (409): The milestone is not next to where the step lands, or a new milestone was asked for a step placed further on than asked; nothing was added. Pick a milestone the message names, or leave `milestone` out.
- `MINT_QUOTA_EXCEEDED` (429): Your plan's daily number of SDK sessions is used up. It resets at midnight UTC. Wait for the reset, or change the plan.
- `MINT_QUOTA_UNAVAILABLE` (503): The day's session count could not be read, so the session was refused rather than allowed. Retry in a moment.
- `MISSING_DEPENDENCY` (400): A choice this list depends on isn't in `resource` yet, such as a pipeline before its stages; the message names it. Add that choice to `resource`, then ask again.
- `NESTED_STEPS_NOT_A_SETTING` (422): An issue code: `update_step` was sent a branch's `paths`, a decision's `outcomes`, a loop's `steps` or an approval branch's `steps` that differ from what is saved. They hold the steps inside the step, which `update_step` does not change. Sent back unchanged, they change nothing. Nothing was saved. Change a path or an outcome with `update_paths`, and the steps inside it with `add_step`, `update_step`, `move_step` and `remove_step`.
- `NESTED_STEPS_NOT_ALLOWED` (400): A step added here cannot contain other steps. Add each step on its own.
- `NEXT_OWNER_REQUIRED` (400): The owner is leaving and did not name who owns the conversation next. Send `nextOwnerUserId`, the public id of a teammate who is in the conversation.
- `NO_ACTIVE_SLOT` (410): This person has no open part on the step: it was already decided, or they never had one. Nothing to do; read the step to see the result.
- `NO_DOCUMENT_SLOT` (422): The step has no document of its own, so a file cannot be its document. Upload the file as reference material (`slotKind: "reference"`).
- `NO_FILE` (400): The request has no file in its form. Send the file as the `file` part.
- `NO_MILESTONES_HERE` (400): A milestone was chosen where the flow has no milestones; nothing was added. Leave `milestone` out.
- `NO_PERSONA` (422): The person holds no persona for their kind of user, so the session would have nowhere to go. An admin gives them a persona.
- `NO_PREPARERS` (400): The step has nobody preparing it, so it cannot go back to its preparers. Send it back to its assignee (leave out `sendBackTo`).
- `NO_RESTORE_SNAPSHOT` (409): This canceled flow can't be reopened: it was canceled before reopening existed, or an End flow step ended it. Start a new flow from the template.
- `NOT_A_CHANGE` (409): The AI suggestion is a comment: it changes nothing, so there is nothing to accept. Dismiss it once you have read it (`POST …/suggestions/{suggestionId}/dismiss`).
- `NOT_A_LOOP` (400): The step is not a For each. Name the For each step.
- `NOT_A_LOOP_ITEM_STEP` (400): fillLoopItem was sent for a step that is not assigned to the current person of a For each. Send it only on that step, or leave fillLoopItem out.
- `NOT_ACTIVE_REVIEWER` (403): It is another reviewer's turn on this item. Wait until it is your turn.
- `NOT_AN_EDITOR` (403): Only an editor of the document can do this. Use an editor's token.
- `NOT_AUTHOR` (403): Only the person who wrote the comment can remove it. Use the writer's token.
- `NOT_COMBINABLE` (422): The held copy can't be combined into the draft automatically. `error.reason` says why. Use it instead of the draft, or combine it in Word.
- `NOT_EDITABLE` (422): The flow is not running. Continue the flow first.
- `NOT_FEED_OWNED` (409): This relationship was made in Moxo, and the upsert and the import do not overwrite hand-built work. Send `PATCH` or `DELETE`, which act on any relationship, or leave it as it is.
- `NOT_IN_REVIEW_GROUP` (404): The run's step is not reviewed together with the loop's other items. Review the run on its own with `review-approve` or `review-decline`.
- `NOT_LISTENING` (409): Nobody is listening for a test event. Choose Listen for a test event in the app, or call `POST /v1/templates/{id}/webhook-config/test-listen`, then send to the new test URL.
- `NOT_ON_A_SIDE` (403): You're not on a side of this document collaboration, so you can't act for one. Use the token of a person on the side, or ask a flow manager to add the person to the side's role.
- `NOT_PAUSED` (409): The flow is not paused. Nothing to do.
- `NOT_STEP_ASSIGNEE` (403): You are not an assignee of this step with work left to do. Use the assignee's token.
- `NOT_SYSTEM_GROUP` (400): Only the built-in Owner, Admin and Member permission groups can be reset to how they come. Change a group your organization made with `PUT /v1/permission-groups/{id}`.
- `NOT_THE_OWNER` (400, 403): Only the owner can hand the conversation to someone else, or name who owns it next when they leave. Leave `nextOwnerUserId` out when you are not the owner. To hand it over, use the owner's personal access token.
- `NOT_YOUR_SECTION` (403): The section isn't yours to mark done or reopen. Use the token of a person whose role owns the section, or an editor's.
- `NOT_YOUR_TURN` (403, 409): It isn't your turn yet: your side's turn on a document collaboration (409), a preparation another preparer (or the AI) does first (409), or a document being prepared by a person when you aren't the one preparing it now (403). Read the step again: `turn` names the side whose turn it is; a preparer waits until the one before them is done.
- `NOTES_DISABLED` (404): Notes are off for this flow. Turn Notes on for the template, or for your organization.
- `NOTHING_IN_PROGRESS` (409): A sub-flow was sent with `start: "now"`, and nothing is in progress on the flow for it to start beside; nothing was added. Send `start: "later"` with `afterStepId`.
- `NOTHING_TO_DISCARD` (409): There is nothing to discard: the template was never published, so there is no published version to go back to, or it has no unpublished changes. To remove a template that was never published, delete it with `DELETE /v1/templates/{id}`.
- `NOTHING_TO_REMIND` (400): Nobody is waiting on this flow or step, or the step isn't waiting on the person you named. Nothing to do. Read the step to see who it is waiting on.
- `ORG_CHART_NO_APPROVER` (422): Neither a manager nor the template's fallback person can take a role filled from the org chart, so the flow did not start. Fix the org chart, or set the template's fallback person.
- `ORG_FROZEN` (402): The organization is paused. Resume the organization, then retry.
- `ORG_KEY_NOT_SUPPORTED` (403): Only a particular person can do this in the app, and an organization API key is not that person. Use that person's personal access token, as the message says.
- `ORG_KEY_REQUIRED` (403): This call needs an organization API key, and a personal access token was sent. Use an organization API key with the scope the call names.
- `ORG_NAME_NOT_ALLOWED` (400): The organization name was refused; the grant is not spent. Choose another name.
- `ORG_SUSPENDED` (402): The organization's account is suspended, so no new work starts. An admin updates billing in Moxo.
- `ORIGIN_HEADER_REQUIRED` (400): The request had no `Origin` header, so the session could not be tied to a page. Server frameworks do not send one by default. Send `Origin` with your page's origin, such as `https://app.example.com`.
- `ORIGIN_NOT_ALLOWED` (403): The `Origin` header is not one of your organization's allowed SDK origins. Send an allowed origin, or have an admin add this one in Settings → Web SDK.
- `OTHER_PEOPLES_CHANGES` (409): Other people also have unpublished changes on this template. Send `includeOtherPeoplesChanges: true` to discard theirs too.
- `OTP_COOLDOWN` (429): A code was sent a moment ago. Wait, then ask again.
- `OUTPUT_NOT_DECLARED` (400): A Goal step was completed with a `resultData` key it declares no output for; the message names each, `error.details.undeclared` lists them and `error.details.outputs` lists the outputs the step has. Nothing was saved. Key `resultData` by the step's output ids only.
- `OVER_GRANT` (403): The persona or permission group gives permissions you don't have yourself. Nothing was changed. Someone who holds those permissions does it, or, for an invitation, the person accepts it themselves.
- `OWN_REVIEW` (403): The person a review is about cannot remove that step. Have another manager do it.
- `PACKET_ASK_NOT_REOPENABLE` (400): A part picked was never done (left out, or the packet finished early), so there is nothing to redo. The message names it. Pick only parts that were done.
- `PACKET_ASKS_NOT_PICKED` (400): A packet goes back to its person with the parts to redo, and none were named, one is not part of this packet, or the step is not a packet. Send `packetAskIds` with step ids from the packet's `asks`, and only for a packet.
- `PACKET_FINISHES_ON_ITS_BUTTONS` (409): A Packet finishes when its person presses one of its own buttons that finishes it, which records the outcome. A complete would close it with no outcome and its parts undone. Let its person finish it, or a flow manager can force-complete it with a reason.
- `PAGE_RANGE_INVALID` (400): `pages` is missing, or is not written as pages and ranges separated by commas. Send `pages` as pages and ranges, such as `3,7,12-14`, numbered from 1.
- `PAGE_RANGE_OUTSIDE_DOCUMENT` (400): `pages` names a page the file does not have. `error.pageCount` is the number of pages it has. Ask again for pages between 1 and `error.pageCount`.
- `PAGES_NOT_A_PDF` (422): The file is not a PDF, so its pages cannot be sent on their own. Download the whole file instead.
- `PAGES_UNREADABLE` (422): The file's pages could not be opened. Download the whole file instead.
- `PAT_CANNOT_IMPERSONATE` (403): A personal access token can create a session only for its own person, and the request named someone else. Use an organization API key with `sdk:mint` to create sessions for other people.
- `PATH_CLOSED` (409): The path can no longer take a step there (it finished, the flow took another path, a Decision has started and not been answered, or the spot is before the last action that has started). The path a Decision chose can still take a step. Edit process lists the same code. Add the step after the last action that has started, on a path that is still open.
- `PATH_NOT_STARTED` (409): A sub-flow with uploaded start details would go into a path that has not started, so its uploads have no run to belong to. Add it once the path is running, or start it without uploads.
- `PAYLOAD_TOO_LARGE` (413): The request is larger than this call allows. Send a smaller file, or fewer files.
- `PDF_FAILED` (503): The PDF of this document could not be made. Send the call again.
- `PERSON_NOT_EXTERNAL` (400): A relationship is for the people you work with, and one of the people named is on your own team. Name external people in `party`, and put your own people in `team`.
- `PERSON_TOKEN_REQUIRED` (403): This call acts as a person, and an organization API key was sent. Use a personal access token.
- `PERSONA_AMBIGUOUS` (400): Both `persona_id` and `persona_name` were sent, or the name matches more than one persona the person holds; the message lists their ids. Send `persona_id` alone.
- `PERSONA_NOT_HELD` (403): The person does not hold that persona, or it does not exist. Name a persona the person holds, or give it to them in People.
- `PERSONA_REQUIRED` (422): The person holds several personas and none is their default; the message lists them. Send `persona_id`.
- `PERSONA_TYPE_MISMATCH` (400): An external user can only hold an external persona. Choose a persona from `GET /v1/personas?userType=external`.
- `PERSONAS_FROM_IDP_ONLY` (409): The organization only takes personas from its identity provider. Give the persona in the identity provider.
- `PICKED_ID_NOT_FOUND` (422): An issue code from check and publish: an id a person picks from a connected app (a Jotform form, a DocuSign template, an Acrobat Sign library document, a scheduling page) is not in the connected account, so the step could not start. Pick it again on the step, from the account the step uses.
- `PORTAL_BINDING_MISSING` (403): The SDK session is not linked to a portal, so it has no catalog to start from. Create the session with `portal_id`.
- `PORTAL_ID_IGNORED_FOR_NON_PORTAL_PERSONA` (400): `portal_id` was sent, but the persona is not for a portal (it is for the orchestrator portal or magic links). Leave out `portal_id`, or name a portal persona.
- `PORTAL_NOT_GRANTED_BY_PERSONA` (403): The persona does not give the portal in `portal_id`; the message lists the portals it gives. Send one of those portals.
- `PORTAL_REQUIRED` (400): The session's persona can use more than one portal, and no `portal_id` was sent; `error.details` lists its portal ids. Send `portal_id`.
- `PREPARATION_INCOMPLETE` (422): The step's preparation is missing something its assignee needs (a document to review or a PDF to fill in); `error.missing` names it. Nothing was saved. Add what `error.missing` names, then complete the preparation again.
- `PREPARE_ACTIVATION_PENDING` (409): The step is still being set up, so its preparation cannot be completed yet. Try again in a moment.
- `PREPARE_EDIT_LOCKED` (422): The change would alter something the flow depends on, which a preparer cannot change. Change only what the template lets a preparer change.
- `PREPARE_FAILED` (400, 422): The step's preparation can't be completed as sent; the message says why. Fix what the message names and send it again.
- `PREPARED_DOCUMENT_MISSING` (409): The latest version of this document has no file. Restore an earlier version, then submit.
- `PREVIOUS_KEY_GRACE_NOT_FOR_URL_TOKEN` (400): This webhook's key is the token in its URL (`none`), so the old URL stops working at once when it is replaced. Leave out `previousKeyGraceSeconds`, or switch the webhook to `hmac` or `api_key` first.
- `PROGRESS_ONLY` (403): The step is shared with you as progress only. Read the flow instead.
- `PROGRESS_ONLY_REQUIRES_SEE_ALL` (400): Progress only can be turned on only for a role that sees every action. Turn on `allowViewAllActions` in the same call.
- `PROGRESS_ONLY_REQUIRES_VIEWER` (400): Progress only is not available for a role that manages the flow. Leave `showProgressOnly` off for this role.
- `PROTECTED_BRAND_RESERVED` (409): The name is reserved. Choose another name.
- `PROVIDER_ERROR` (502): The app failed to answer. Try again later.
- `PROVISIONING_DISABLED` (403): Self-serve signup is switched off in this environment. Sign up in the app instead.
- `PROVISIONING_UNAVAILABLE` (503): Self-serve signup is not available right now. Retry with the same grant.
- `READ_ONLY` (403): You can read this document collaboration but not act on it, as in the app (a read-only viewer, or a step that only lets you comment). Use the token of a person who takes part in it.
- `RECONNECT_REQUIRED` (409): The app's connection has expired, so its lists can't be read. A person reconnects the app in Connected apps.
- `RECORDING_DELETED` (409): The meeting was recorded in Moxo and you chose not to have it read, which deleted the recording, so there is nothing left to read. Nothing can bring it back: leave it set aside. A new recording is a new meeting.
- `RELATIONSHIP_INCOMPLETE` (400): A new relationship was sent with no `party`, so there is nobody it is for. Send `party`, either named people or an account.
- `REMINDER_NOT_SENT` (502): A recipient was tried and the reminder reached nobody; nothing was recorded. Try again.
- `REOPEN_CLOSED_ACTION_MANAGER_ONLY` (403): The step closed at its due date; only a flow manager can reopen it. Ask a flow manager to reopen it.
- `REOPENED_STEP_FAILED` (409): The step reopened but could not start again, so it is now `FAILED`. The message says why. Fix what the message names (the step shows it too). A failed signature step starts over when a step before it is reopened (to send a new document, for example).
- `REQUIRED_OUTPUTS_MISSING` (400): A Goal step was completed without one of its required outputs; the message names each, and `error.details.missing` lists their ids. Nothing was saved. Send every required output in `resultData`, keyed by its id.
- `REVIEW_CHANGED` (409): Who reviews the step changed while the answer was on its way, so nothing was recorded. Send the same answer again; a retry is safe and goes to the review as it now stands.
- `REVIEW_GROUP_APPROVE_IN_PROGRESS` (409): An approval you started is still running. Wait for it to finish, then read the list again.
- `REVIEW_GROUP_APPROVE_NOT_STARTED` (503): The approval could not start, so nothing was approved. Send the call again.
- `REVIEW_GROUP_FORBIDDEN` (403): You review none of these items and do not manage the flow. Use the token of a person who reviews the items.
- `REVIEW_GROUP_NOT_APPROVE_ALL` (400): Items in this loop move on as each is approved, so they are not marked reviewed. Approve each item when it is ready.
- `REVIEW_GROUP_NOT_READY` (409): The loop moves its items on together, and not every item is in review yet. Approve once every item is in.
- `REVIEW_ITEM_CHANGED` (409): The item changed since you read it (sent back, resubmitted or no longer in review). Read the list again and use the item's new `invocationEpoch`.
- `REVIEW_REQUIRED` (409): The step has an AI reviewer. Complete it in Moxo: in the app, the person's portal, or the link in their email.
- `REVIEWED_COPY_FAILED` (500): The reviewed copy of the document couldn't be made, so the step was not completed. Send the call again.
- `REVISION_REQUIRED` (409): A template file push came with a file that does not say which revision of the template it was pulled from (no `revision:` line, no `baseVersion`), so it could undo changes made since. Nothing was saved. Pull the template again, make your change in that file, then push it. To replace the template with the file as it is, push with `overwrite: true`.
- `ROLE_ALREADY_EXISTS` (409): Another role of this flow has that name. Pick another name, or use the role that has it.
- `ROLE_ASSIGNED_AUTOMATICALLY` (400): This role of the sub-flow is filled automatically (a fixed person or a team desk), so it cannot be set here. Leave the role out.
- `ROLE_ASSIGNMENT_NOT_SUPPORTED` (400): This step type takes its people from its own sides, not from `roleIds`. Add the person to the side's role instead.
- `ROLE_FILLED_FROM_ORG_CHART` (400): This role is filled from the org chart, so it cannot be set here. Leave the role out.
- `ROLE_NEEDS_INTERNAL_USER` (400): The role is filled by internal users (a flow manager or meeting host role), and no one in your organization has the email sent for it. A flow start adds only external users. Invite the person to your team first, or name someone already in it.
- `ROLE_NOT_ASSIGNEE` (400): Only an Assignee role takes extra powers; this role manages or only views the flow. Choose an Assignee role.
- `ROLE_NOT_FOUND` (400, 404): A role id names no role of this flow: in the path (404), or in the body (400). Use a role id from the flow's roles.
- `ROLE_NOT_HELD` (409): The person named in `holderUserId` no longer holds this role. Read the flow again and send the person who holds it now, or leave `holderUserId` out.
- `ROLE_VISIBILITY_LOCKED` (400): This role always sees every action of the flow. Leave its visibility as it is.
- `SANDBOX_ORG_LIMIT` (409): The limit of sandbox organizations was reached. Use one of your existing sandboxes.
- `SCAN_BUSY` (503): The safety check is busy. Try again shortly.
- `SCAN_PENDING` (425): An upload the request names is still being checked. Retry shortly.
- `SCAN_UNAVAILABLE` (409, 503): The safety check could not run. Try again shortly.
- `SDK_MINT_REQUIRES_API_KEY` (403): A signed-in browser session tried to create an SDK session. Only your server can, with a token. Call from your server with an organization API key or a personal access token.
- `SDK_NO_ALLOWED_ORIGINS` (403): Your organization has no allowed SDK origins, so no page can use a session. An admin adds your page's origin in Settings → Web SDK.
- `SDK_NOT_ENABLED` (403): The Web SDK is not turned on for your organization, so no session can be created. An admin turns it on in Settings → Web SDK.
- `SDK_SESSION_AUDIT_UNAVAILABLE` (503): The new SDK session could not be recorded in the audit log, so it was not created. Retry after the seconds in `Retry-After`.
- `SDK_SESSION_NOT_ALLOWED_HERE` (403): An SDK session token was sent to a call outside the embedded Moxo screens and the `/sdk` calls, such as `/v1` or the MCP server. Call it from your server with your organization API key or a personal access token.
- `SEAT_ALREADY_DONE` (409): The person's part is already done or no longer needed. Reopen the step to have it redone.
- `SEAT_NOT_ON_STEP` (400): The person named is not on this step (an id nobody in your organization holds gets the same answer), so no reminder was sent. Read the step to see who is on it, and name one of them.
- `SEAT_REMIND_MANAGER_ONLY` (403): A participant whose role can send reminders reminds everyone the step waits on, never one named person or section. Leave out `userId` and `sectionId`, or ask a flow manager.
- `SECRET_HASHED_ONLY` (409): Moxo keeps only a hash of this API key secret, so it can't be shown again. Replace the secret with `/regenerate`, which shows the new one once.
- `SECRET_NEEDS_REGENERATE` (409): This signing secret can no longer be used (an incoming webhook's, or one Moxo signs its own calls with), so it can't be shown or used. Replace the secret with `/regenerate` and give the sender the new one.
- `SECTIONS_NOT_SUPPORTED` (400): Only a document written together in sections has sections to remind. Send no `sectionId` for this step.
- `SEND_BACK_MANAGER_ONLY` (403): A participant whose role can reopen completed actions sends one back to whoever did it, never to its preparers. Leave out `sendBackTo`, or ask a flow manager.
- `SEND_BACK_NOT_ALLOWED` (400): Only a finished step, or one still with its assignee, can go back to its preparers; a step in review cannot, and a Packet never does (it goes back to its person). Wait for the review, or send it back to its assignee (a Packet with `packetAskIds`).
- `SERVICE_KEY_CANNOT_CHOOSE_PERSONA` (403): A key gives only the default member persona: it can't invite with another one, or activate an invitation that gives another one. Nothing was changed. A person with the right does it with a personal access token, or the person accepts their invitation themselves.
- `SERVICE_KEY_CANNOT_INVITE_ADMIN` (403): A key can't give someone an admin persona: not by inviting them, and not by activating an invitation that makes them an admin. Nothing was changed. An admin does it with a personal access token, or the person accepts their invitation themselves.
- `SERVICE_UNAVAILABLE` (503): Part of the work could not be scheduled (for example a file rename). Try again.
- `SIGNATURE_ALREADY_USED` (409): An incoming webhook delivery with this exact `X-Moxo-Signature` was already received and started no flow (its conditions skipped it, or it is still starting one), so this one starts nothing. When that delivery started a flow, the same request answers `200` with that flow instead. Sign each new delivery with the current time.
- `SIGNATURE_BLOCK` (422): A later e-sign step's signature block is no longer in the document. `error.details.problems` names what moved. Put the signature block back, then submit.
- `SIGNING_BUSY` (503): Someone is signing this document, or another change to it is under way, right now. A change to several steps names the step still busy. Try again shortly.
- `SIGNUP_NOT_ALLOWED` (403): The signup was refused. Sign up in the app instead.
- `SLOT_FORWARDED` (410): This person's part was forwarded to someone else, so it is no longer theirs to decide. Nothing to do; the person it was forwarded to decides.
- `SLOT_NO_LONGER_ACTIONABLE` (410): This person's part ended another way (no longer needed, or the step moved on), so it can't be decided. Read the step to see where it stands.
- `STALE_ACTION` (409): The step changed while the request was running. Read the step again and retry.
- `STALE_WRITE` (409): Someone saved the document since the `rev` you sent; `data.currentRev` is its revision now. Read it again, merge your change, and save with the new `rev` as `baseRev`.
- `START_FIELD_REQUIRED` (400): A start detail the sub-flow requires was not sent; `error.field` names it. Send it in `subFlow.customFields`.
- `START_NOW_UNAVAILABLE` (409): A sub-flow sent with `start: "now"` would wait where it goes in the flow instead of starting; nothing was added. Send `start: "later"` with `afterStepId`.
- `START_PEOPLE_CHANGED` (409): Someone with an email the start was adding joined your organization while the flow was starting, so nothing was started or added. Send the start again (the same Idempotency-Key is fine): it uses the person who is now there.
- `STEP_ALREADY_ANSWERED` (409): Someone has already answered this step (an approver decided, someone voted, chose, sent files, ticked a checklist item or marked it done), so what was asked cannot change, an approval's or a decision's files included. `error.details.lockReason` says which. Leave its content as it is. The name, due date and reminders still change.
- `STEP_ALREADY_FINISHED` (409): Nobody will act on this step again, so material or a file added to it would never be read, and its record stays as it was. Attach it to a step still to come.
- `STEP_AWAITING_REVIEW` (409): The step is in its review. Wait for the review to finish.
- `STEP_CHANGED` (409): What the step asks changed since you read it: the `askedFingerprint` you sent with the answer or decline is not the step's now. Nothing was saved. Read the step again and answer what it asks now, sending its new `askedFingerprint`.
- `STEP_COMPLETES_ON_ITS_OWN` (409): The step is completed by its own event (signed in DocuSign or Adobe Sign, verified, paid, a Jotform submitted, a time booked), so a complete would record it done with nothing done. The message says what closes it. Let the event close it, or a flow manager can force-complete it with a reason.
- `STEP_CONNECTION_FOREIGN` (422): An issue code: the action holds an account or saved secret that is no longer in your organization (it was removed in Manage → Connected apps). Choose another account on the action, or remove it.
- `STEP_CONNECTION_WRONG_APP` (422): An issue code: the action's account is for another app. A Collect payment action takes an account of the provider it names (Stripe or QuickBooks); DocuSign, Adobe Acrobat Sign and Jotform actions take their own app; a REST API or Webhook action signs in with a saved Secret or a signing account such as a Sumsub account. A change that sets one is refused; publish and check report one the template already holds. Set the action's `connectionId` to an account of that app (`GET /v1/connections`), or for a REST API or Webhook action, to a saved Secret or a signing account.
- `STEP_HAS_NO_REVIEW` (409): The step has no review, so there is no reviewer to reassign; a reassign never adds a review. Reassign its assignee, or add reviewers to the step in the flow or the template.
- `STEP_IN_REVIEW` (409): The step is with its reviewer, so it can't be closed now. Wait for the review.
- `STEP_NAME_REQUIRED` (422): An issue code: an action the change list adds or renames has a name of only spaces. Give the action a `name`.
- `STEP_NOT_ACTIVE` (409): The step is no longer waiting: it is done, or the flow moved on, was reopened or was canceled. Read the flow again; nothing was changed.
- `STEP_NOT_EDITABLE` (400, 409): The step has finished, or is past the point where its settings can change. Reopen the step first, if that is what you want.
- `STEP_NOT_FOUND` (404): The template has no action with the `stepId` in the path. Read the action ids with `GET /v1/templates/{id}/outline`.
- `STEP_NOT_OPEN` (409): The step hasn't started or is finished, so its step status can't change. Set it on an open step, or reopen this one first.
- `STEP_NOT_REACHED` (409): The flow hasn't reached this step yet, so it can't be acted on. Wait until the step starts, or act on the step the flow is on now.
- `STEP_NOT_SENT_TO_REVIEW` (409): A force-complete could not send the step to its reviewer yet. Read the step again. Send `skipReview: true` to complete it without its review.
- `STEP_NOT_VISIBLE` (403): You cannot see the step this message is about. Post on a step you can see, or on the flow.
- `STEP_ON_HOLD` (409): The step is on hold (a calendar or app connection still to make, a paused wait), so it takes no file until it resumes. Send the file once the step resumes.
- `STEP_REF_AMBIGUOUS` (409): Several copies share this step, so a change here would change every copy. Change the step in the template instead.
- `STEP_RUNS_ON_ITS_OWN` (409): This step runs on its own (a wait, an AI step, an AI agent, a sub-flow, or another automation), so it cannot be completed by hand. Let it finish, or force-complete it with a reason.
- `STEP_SETTINGS_NOT_EDITABLE` (400): Moxo doesn't change this type of step's settings on a running flow. Change its name, description or due date instead.
- `STEP_STARTED` (409): The step has started, so its assignees cannot be set here. Use reassign.
- `STEP_STILL_READ` (422): An issue code: the change list removes an action that another action (or a template setting) still reads, so the reader would be left reading nothing. The issue names each reader. Nothing is blanked and nothing was saved. Give `remove_step` a `replacedBy` naming the action that supplies the data now, or change or remove each reader in the same list.
- `STEP_TYPE_NO_ATTACHMENTS` (400): This kind of step shows its assignee no reference material (an automation, a control, or a document review, whose document has its own place). Attach the material to a step people act on.
- `STEP_TYPE_NO_DOCUMENT` (400): This step is not built around a document. Send the document to a step that has one.
- `STILL_SAVING` (409): The latest changes are still saving. Submit again in a moment.
- `STORAGE_KEY_NOT_ACCEPTED` (422): An issue code: a step's file was named by a stored file's address, typed in, where it takes the id of a file uploaded to the step. `where.path` names the setting; nothing was saved. Upload the file to the step (`POST /v1/templates/{id}/steps/{stepId}/attachments/upload-init` with `slotKind: "document"`) and send the `fileId` it returns, for example `document: { "ref": "<fileId>" }`.
- `STRAND` (422): A started step cannot move, and nothing can move in front of one. Move only steps that are still ahead.
- `SUB_FLOW_CHILD_CHANGED` (409): The template the sub-flow uses was published again while it was being added. Check the template and send the request again.
- `SUB_FLOW_CHILD_NOT_PUBLISHED` (400): The template the sub-flow uses has not been published. Publish it, then try again.
- `SUB_FLOW_CHILD_NOT_STARTABLE_BY_EDITOR` (403): You may not start the template the sub-flow uses. Choose a template you can start, or ask someone who can.
- `SUB_FLOW_CHILD_ROLE_UNMAPPED` (400): A role the sub-flow cannot start without (the host of a meeting it opens with) has nobody to fill it; the message names it. Send it in `subFlow.roleAssignments`, or leave `matchRoles` on with a role of this flow of the same name.
- `SUB_FLOW_CHILD_UNAVAILABLE` (400): The template the sub-flow uses is archived. Choose another template.
- `SUB_FLOW_DESK_REQUIRED` (400): A role of the sub-flow takes a team desk chosen at start, and none was sent; the message names it. Send it in `subFlow.deskSelections`.
- `SUB_FLOW_OPEN` (409): This step's sub-flow is still running or paused, and the flow waits for it. Finish or cancel the sub-flow, then retry.
- `SUB_FLOW_ROLE_HAS_SEVERAL` (400): The role named by `fromRoleId` is held by several people, and the sub-flow role takes one person. Send one person by `userId` or `email` instead.
- `SUB_FLOWS_OPEN` (409): A sub-flow beneath this flow is still running or paused. Finish or cancel each sub-flow listed in error.details.subFlows, then retry.
- `SUBMITTING` (409): The document is being submitted, so it can't be changed now. Read the step again: once it is submitted, it is done.
- `SUGGESTIONS_OPEN` (409): Suggested edits are open on the document. `error.count` says how many. Send the count you agree to leave out (`withoutSuggestionCount` or `dropSuggestionCount`).
- `TASK_NOT_CLAIMED` (409): The task is not claimed. Claim it first.
- `TEMPLATE_ARCHIVED` (409): The template is archived, so it starts nothing. Restore it in Moxo, then start it.
- `TEMPLATE_BEING_EDITED` (409): Someone is editing this template in Moxo right now, so nothing was changed. `error.editingBy` names them. Your own changes are never refused for this. Try again when they finish; editing frees up after 5 minutes without activity.
- `TEMPLATE_MODE_LOCKED` (409): Flows have already started from this template, so its mode (predefined or adaptive) can't change. Its goal still can. Duplicate the template and set the mode on the copy.
- `TEMPLATE_NOT_FOUND` (404): The template does not exist, or you cannot see it. Check the template id.
- `TEMPLATE_NOT_IN_PORTAL_CATALOG` (403): The template is not in this portal's catalog, or there is no template with this id. Pick a template from `GET /sdk/v1/templates`, or add it to the catalog.
- `TEMPLATE_NOT_PUBLISHED` (409): The template was never published, so it starts nothing. Publish it. An incoming webhook can use its test URL.
- `TEMPLATE_NOT_READY` (422): A test run needs the draft complete, as publishing does. `issues` lists each gap (a Parallel path with no steps, an action nobody does), where it is and how to fix it. Nothing started. Fix each issue with a change list or a file push, then start the test run again.
- `TEMPLATE_NOT_STARTABLE` (400): The template is not set up to be started this way. Turn on self-start for the template, or start it another way.
- `TEMPLATE_VERSION_CONFLICT` (409): Someone changed the draft since the revision you sent; nothing was changed. `currentVersion` is the draft revision now. Read the draft again and resend.
- `TEST_KIND_NOT_SUPPORTED` (400): This agent has no Test run on a template step: a chat agent tests as a conversation, the Conductor isn't tested on a step, and an agent with no type yet can't run. Test a chat agent in Agent Foundry; give an untyped agent its type first.
- `TEST_RUN_ALREADY_IN_FLIGHT` (425): The same test of this agent is already running. Read the running test, or retry after `Retry-After` seconds.
- `TIME_ENTRY_INVALID` (400): A time entry value is not valid; `error.field` names it. Fix the field and resend.
- `TIME_ENTRY_REQUIRED` (400): The template requires time on this step, and no `timeEntry` was sent. Send `timeEntry`, or leave `timePrompt` out.
- `TITLE_EDIT_DISABLED` (403): The organization does not let people set their own title. An admin sets the title, or turns the setting on.
- `TOO_MANY_ATTACHMENTS` (400): Too many files for one message. Send up to 10 files with one message.
- `TOO_MANY_MENTIONS` (400): `mentions` names more than 10 people who aren't on the flow. Tag at most 10 new people in one message.
- `TOO_MANY_REQUESTS` (429): The person behind the token has sent `error.limit` actions (20) in the last hour from the same place, so this one was not sent. `error.home` says where they were counted: `conversation` means sent into this conversation, `project` means sent from this project in Moxo, and `standalone` means sent from no conversation and no project. `error.windowMinutes` is the window counted (60), `error.retryAt` is when sending works again, and `error.retryAfterSeconds` is the wait until then. Wait the number of seconds in `Retry-After` (the same as `error.retryAfterSeconds`), then send again. For this code, wait for `Retry-After`, not the `RateLimit` reset, which counts the token's own requests.
- `UNFILLED_PLACEHOLDERS` (422): A placeholder is still written as `{{name}}`. `error.details.placeholders` names each one. Fill each placeholder, then submit.
- `UNIQUE_ID_CHANGE_NOT_ALLOWED` (409): This person's unique ID can't change from here; `error.reason` says why: `org_key_only` (only an organization API key can), `internal_member` (they are an internal user) or `no_unique_id` (they have no unique ID to change). Nothing was changed. Use an organization API key that names the `users:unique_id` scope, for an external user who already has a unique ID.
- `UNIQUE_ID_CONFLICT` (409): Someone in the organization already holds this `uniqueId`. Nothing was changed or sent. `error.existingUserId` is their id when you may read them. Use that person: to make sure someone exists, add them and on this answer use `existingUserId`.
- `UNKNOWN_FIELD` (400): No template you can see has this field key. Use a field key from a template you can see.
- `UNKNOWN_KEY` (400): A custom field key does not exist. Use a key the organization has.
- `UNKNOWN_PERSON` (400): A person named by id or email is not in this organization. Check the id or the address. On `party`, an unknown email is created as an external user; on `team`, the person must already be here.
- `UNKNOWN_SETTING` (422): An issue code: a setting the action, or the template (`update_settings`), does not have. `where.path` names it; nothing was saved. Remove it; the fix lists the settings that exist there.
- `UNKNOWN_STEP_STATUS` (400): The flow's template doesn't list a step status with this key. Send a `key` from the template's `stepStatuses`.
- `UNSUPPORTED_FILE_TYPE` (415): The file is not a kind this call or this step takes (for example a PDF, or a spreadsheet for an Update spreadsheet step). Send a file of the kind the message names.
- `UPLOAD_NOT_LANDED` (409): The file has not finished uploading. Finish the upload, then call complete again.
- `UPLOAD_TYPE_NOT_ALLOWED` (415): Your organization's upload rules don't allow this kind of file; the message lists the kinds they allow. Send a file of a kind the message lists, or ask an admin to change the upload rules.
- `USER_NOT_FOUND` (404): The person is not a member of your organization. Use the id of a member.
- `VALIDATION_ERROR` (400): A value sent is missing or not valid; the message names the field. On a flow start, `error.kickoffInputErrors` lists each start value the template needs. Send each value named, by its field `id` in `customFields`.
- `VALUE_TOO_LONG` (400): A value is longer than 256 characters. Send a shorter value.
- `VERSION_CONFLICT` (409): The template changed since the `baseVersion` you sent, or since the revision a pushed template file was pulled at (`changedSince` says what changed); nothing was saved. Read the current `draftRevision` and resend your changes. For a template file: pull it again, make your change in that file, then push it.
- `VIDEO_NOT_CONFIRMED` (409): This Watch video step asks the person to confirm a sentence after watching. Have the person confirm it from their task.
- `VIDEO_NOT_WATCHED` (409): A Watch video step finishes when the person has watched the video to the end. Have the person watch the video from their task.
- `VIEW_ONLY` (403): The file can only be viewed, so it is not downloaded. View it in the app.
- `VIOLATIONS` (422): The move or add would take a step into or out of a branch, decision or loop, or change one that has started. Keep the step in its place in the structure.
- `WAITS_FOR_LATER_STEP` (400): A step in `dependsOnStepIds` comes after this one. Name only steps that come before it.
- `WATERMARK_UNAVAILABLE` (422): The file must be watermarked with the name of the person downloading it, and the key names no person. Download it with a personal access token.
- `WEBHOOK_ADDRESS_CHANGED` (409): The incoming webhook's organization is served at another address now. `error.webhookBaseUrl` is that address; the path after it stays the same. Change the address in the sending system to `error.webhookBaseUrl` followed by the same path.
- `WORKING_COPY_NOT_ALLOWED` (403): `copy=working` asks for a template's working copy, with its unpublished changes, and only someone who may change the template reads it. Read it without `copy` for the published copy, or ask an owner for edit access.
- `WRONG_PERSONA_SURFACE` (403): The SDK session's persona cannot use this call. Mint the session for a portal persona.
- `WRONG_TEMPLATE_KIND` (400): The template is the wrong kind for this call (an action template, not a process). Use a process template.

## Glossary

The words this reference uses, in plain terms.

## The work

### Template

The design a flow is started from: its steps, roles and fields. You build it once and start it many times.

In the API: `/v1/templates`.

### Flow

One live run of a template, with its own people, answers and files.

In the API: `/v1/flows`.

### Origin flow

The flow that started this one, through a Sub-flow, Start a flow or Schedule a flow step. Only a sub-flow is canceled with it.

In the API: `originFlowId` and `startedByKind` on a flow; `startedFlows` on the origin.

### Step

One task inside a flow, done by a person or run by Moxo. The app also calls it an action; in a flow the two words mean the same thing.

In the API: `/v1/flows/{id}/steps`; `steps[]` on a template.

### Action type

What kind of task a step is, such as Form, Approval or File request. Each type has its own settings.

In the API: `type` on a step; its settings are `StepConfig_<TYPE>`.

### Path

One branch inside a step, such as each outcome of a Decision. Its steps run only when the flow takes that path.

In the API: `paths[]` on a step.

### Milestone

A named stage of a template, such as Intake or Review. Each step can belong to one.

In the API: `milestones[]` on a template; `milestone` on a step.

### Version and draft

Publishing a template makes a new version live; flows keep the version they started on. Edits go to a draft, whose save counter is its draft revision.

In the API: `version` and `/v1/templates/{id}/versions`; `draft.draftRevision`.

### Building block

A template used inside another template as one step. Its roles and fields can be filled when the flow starts.

In the API: `buildingBlockRoleAssignments` and `buildingBlockFieldValues` on start.

### Test run

A real run of a draft, with every role you don't name given to you, so you can try it before publishing. Its emails and calls really go out, marked as a test.

In the API: `POST /v1/templates/{id}/test-runs`.

### Walkthrough

A run of a draft where every outside call is simulated, so nothing leaves Moxo. Start one as a test run with simulate set to true.

In the API: `POST /v1/templates/{id}/test-runs`.

## People

### Role

A part to play in a template, such as Client or Reviewer. When a flow starts, each role is given to a person or a desk. A role is not internal or external itself: whoever fills it is.

In the API: `roles[]` on a template; `roleAssignments` on start; `/v1/flows/{id}/roles/{roleId}/assign`.

### Assignee

The person assigned one specific step. Being on a flow doesn't make someone an assignee.

In the API: `assignees` on a step.

### Flow manager, participant, viewer

How someone is on a flow: a flow manager runs it, a participant does the steps of their roles, a viewer can only look.

In the API: `access`: `manager`, `participant`, `viewer` on `/v1/flows/{id}/members`.

### Template owner

Someone who can change a template and decide who uses it.

In the API: `/v1/templates/{id}/owners`.

### Internal and external

Internal users are your own team. External users are clients, vendors and partners outside your organization.

In the API: `kind` on a user: `internal` or `external`.

### Persona

Which screen a person uses: the orchestrator portal, a named portal, or magic links only. One person can have several.

In the API: `/v1/personas`; its `access`: `orchestrator_portal`, `portal` or `magic_link`.

### Account

A company your external users belong to. Flows link to an account through their external people.

In the API: `/v1/accounts`; `accounts` on a flow.

### Desk

A shared queue a team picks work from. A role can be given to a desk instead of one person.

In the API: `/v1/desks`.

## Data

### Flow field

A value stored on the flow, such as a deal size or a platform ID. Some are asked for when the flow starts; others fill in as it runs. The app calls them custom fields.

In the API: `customFields` on a template and a flow.

### Custom user field

A value your organization keeps about each person, such as a region or an employee number.

In the API: `customFields` on a user.

### Data table

Your organization's own table, such as a vendor list or a rate card. Flows read from it and write to it.

In the API: `/v1/data-tables`.

### Changed since

Only what changed at or after a time, oldest first, paged with a cursor. At least once; for people who can't see every part of a flow, only changes they can see count.

In the API: `updatedSince` on `/v1/flows` and `/v1/templates`; `lastChangedAt` on each row.

## Connecting

### Connection

Your organization's sign-in to another app, such as HubSpot or Google Drive, that steps and agents use.

In the API: `/v1/connections` (names and ids); `/v1/flow-triggers/connections`; `connectionsToBind` on an agent; `409 CONNECTION_REQUIRED`.

### Dependencies, and depends on

A template’s dependencies are the systems it uses: connections, Secrets, agents and other templates. A step’s dependsOnStepIds only lets it start sooner, once those steps are done.

In the API: `expand` set to `dependencies` on `/v1/templates/{id}` adds `dependencies[]`; `uses` on `/v1/templates`; dependsOnStepIds in the config of `POST /v1/flows/{id}/steps`.

### Secret

A stored key or password a REST API step uses, named in the template and never shown again.

In the API: `restApi.pendingSecretName` in `StepConfig_REST_API`.

### Incoming webhook

A web address another system calls to start a flow.

In the API: `/v1/webhooks/incoming/{templateId}`.

### Outgoing webhook

An event Moxo sends to your system when something happens in a flow, such as a step completing.

In the API: the [Webhooks](/docs/guides/webhooks) guide (`WebhookEventPayload`).

### External task

Work a Wait hands to your own system: it claims the task, does the work and sends the result back, with nothing calling into your network. In the builder: Wait until, Your system picks up a task.

In the API: `/v1/external-tasks`.

### Start link

A link anyone you share it with can use to start a flow.

In the API: `start_link` in `startedBy.method`.

### Schedule

Starts a template's flows at set times.

In the API: `/v1/schedules`.

### AI agent

An assistant a template's steps can use, with its own inputs, outputs and tools.

In the API: `/v1/agents`.

## Access

### Organization API key and personal access token

An organization API key is your organization's credential for systems: it reaches what an admin reaches, limited by its scopes. A personal access token acts as one person, with that person's permissions; use it for anything done as yourself. A personal access token sees exactly what its person sees in Moxo, so an admin's token sees what an admin sees. An organization API key sees what an admin sees, within its scopes.

In the API: `mxo_sk_…` and `mxo_pat_…`, sent as `Authorization: Bearer`.

### Magic link

The emailed link that opens a step without signing in.

In the API: `magic_link` as a persona's `access`.

### Portal

A branded site where people sign in to see their flows and steps. Its audience is your own team, people outside your organization, or both.

In the API: `portal` as a persona's `access`, with its `portal`.

### Action sent on its own

One request sent to a person outside any flow, such as a signature or an approval. It belongs to no flow and has no steps.

In the API: `/v1/actions`.
