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

# Save workflow draft

> Save one Before, During and After document with optimistic concurrency.

Requires `agents:update`. Saving never publishes or executes an action.

**id** `string` *required*

Local agent UUID.

**expected\_version** `integer | null` *required*

The exact draft version returned by Read workflow. Null is valid only if no
draft exists; New Agent already creates the initial version.

**document** `object` *required*

The complete [canonical workflow document](https://docs.goyappr.com/schemas/workflow-v1.json).
Send its `id` and `name` back exactly as the read returned them: both are set
by Yappr, and a save that changes either is refused. Rename the agent with
[`PATCH /agents/{id}`](https://docs.goyappr.com/api-reference/agents/update).

```bash theme={null}
curl -X PUT 'https://api.goyappr.com/agents/AGENT_ID/workflow' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'x-company-id: COMPANY_ID' \
  -H 'Content-Type: application/json' \
  --data-binary @workflow-save.json
```

`workflow-save.json` contains `expected_version` and `document` as JSON values,
not a stringified document. The response is the updated authoring state and new
draft version.

A save either lands whole or writes nothing. `409 WORKFLOW_CONFLICT` is the
second case: the draft is exactly what it was before the request, so read the
latest draft and reconcile your change into it. Do not automatically replace a
newer draft.

Re-sending a save is safe. If the answer to a save never reaches you — a
dropped connection, a timeout, a process that died mid-request — send the same
`expected_version` and the same `document` again. If the first attempt had
landed and nothing has been saved since, the draft already is that document and
the retry answers `200` with it, not `409`; if it had not, the retry saves it.

The replay is recognised only while the draft is still your document at exactly
`expected_version + 1`. If somebody else saved on top of your lost write, the
retry is an ordinary `409`. So on a `409`, read the latest draft before assuming
your change was lost — it may already be in there.

The UTF-8 request body must fit 600,000 bytes; PostgreSQL's stored document
representation must fit 512 KiB. `413` retains the previous saved state. Use a
lossless client so false, zero, null, missing fields and exact numbers survive.

The document supports Before dependencies and failure policy; During
conversation/tool/sequence nodes and global exits; After event/artifact
dependencies; full request/stored schemas; typed source mappings and explicit
missing-value fallbacks. Only During may collect values from the model.

Those source mappings live in `bindings[].inputs`, and they are where a tool's
arguments come from:
[How a tool gets its arguments](https://docs.goyappr.com/concepts/tool-inputs.md) writes out every source
kind, when each one applies, and links a complete document that uses all of
them. One is worked end to end below.

## Refusals name the field

A refused save carries `issues[]` in the same shape Check uses — `code`, `path`, `message` —
and `error` repeats the first message. A path to a request field names the field; a path into
the document starts at the document.

| Refusal | `issues[].path` |
| - | - |
| `400 WORKFLOW_REQUEST_INVALID`, `expected_version` missing or not a whole number | `/expected_version` |
| `400 WORKFLOW_REQUEST_INVALID`, a field the save does not read | `/<field>` |
| `422 WORKFLOW_DOCUMENT_INVALID`, no `document` | `/document` |
| `422 WORKFLOW_REFERENCE_INVALID`, a binding's revision is not usable here | `/bindings/<n>/tool_revision_id` |
| `422 WORKFLOW_DOCUMENT_INVALID`, a step kind the schema does not have (`node_type_unknown`) | `/conversation/nodes/<n>/type` |
| `422 WORKFLOW_DOCUMENT_INVALID`, a step without a member its kind requires (`field_required`) | `/after/0/steps/0/label`, `/conversation/nodes/<n>/instructions`, … |
| `422 WORKFLOW_DOCUMENT_INVALID`, a changed `id` or `name` (`server_owned`) | `/id`, `/name` |
| `422 WORKFLOW_DOCUMENT_INVALID`, an After trigger's `event` that is not one of the [events](https://docs.goyappr.com/api-reference/workflows/events.md) (`event_unknown`); a legacy webhook name such as `call.analyzed` is told the trigger it became (`analysis.ready`) | `/after/<n>/event` |
| `422 WORKFLOW_DOCUMENT_INVALID`, a binding input its tool does not have (`unknown_input`), or a `stored` source reading a path the document's `stored_schema` does not declare (`unknown_source_path`) | `/bindings/<n>/inputs/<field>` |
| `422 WORKFLOW_DOCUMENT_INVALID`, a calendar fixed on an agent-wide action whose managed tool was set up before it could take one (`config_input_needs_update`): send `POST /tool-connections/{id}/actions/prepare` with `{"actions":["<slug>"]}` and save again, or set it with `PATCH /agents/{id}/integrations/{integration_id}`, which updates the tool first | `/bindings/<n>/inputs/<field>` |
| `422 RESERVED_BINDING_ID`, a binding id of the reserved shapes `t_<hex>` or `o_<letters and digits>` that no tool for every step and no step's own settings owns: those ids are kept for Tools & integrations, so rename it | `/bindings/<n>/id` |
| `422 WORKFLOW_DOCUMENT_INVALID`, a `fallback` that is not `{"value": …}` or `null` — a bare string, for one (`field_invalid`) | `/bindings/<n>/inputs/<field>/fallback` |
| `422 WORKFLOW_DOCUMENT_INVALID`, an action step's `hold_line` that is not text of 1 to 28 characters (`field_invalid`), with the step in `node_id` and `label` — see [A line said while a step's tool runs](#a-line-said-while-a-steps-tool-runs) | `/conversation/nodes/<n>/hold_line` |

A refusal about a binding also names the step that runs it — `node_id` and
`label`, the step's own label — the tool in `tool_name`, and the input in
`field`, as [Check](https://docs.goyappr.com/api-reference/workflows/validate.md) does.

## What a save refuses

A save and Check divide the work in one way, on every route that saves:

* **The save refuses the document's shape.** What the
  [workflow schema](https://docs.goyappr.com/schemas/workflow-v1.json) requires of each part — a step
  kind it has (`conversation`, `action`, `sequence`, `end`), and every member
  that kind needs, such as the `label` every step carries, and an After
  trigger's `event` from the [event list](https://docs.goyappr.com/api-reference/workflows/events.md), and an action
  step's `hold_line` of 1 to 28 characters — plus a change to
  the server-owned `id` or `name`, and a binding whose tool revision this
  workspace cannot use — and a binding that can never work: an input its tool
  does not have, or a `stored` source reading a path `stored_schema` does not
  declare. Every problem is named in the one answer, by path, `error` is the
  first with how many more follow, and nothing is written.
* **Check and publish refuse what only the whole graph can tell.** A step
  nothing reaches, a transition to a step that does not exist, a tool wired into
  a phase it cannot run in, an input reading a detail the agent does not
  collect, the phase rules below. A draft is allowed to be unfinished, so these
  save, and [Check](https://docs.goyappr.com/api-reference/workflows/validate.md) names each of them with
  `422 WORKFLOW_VALIDATION_FAILED`.

The most common reference mistake is a tool's own id in `tool_revision_id`. That issue has the
code `reference_is_tool_id`, and its message names the revision to send instead —
`workflow.head_revision_id` from [Get tool](https://docs.goyappr.com/api-reference/tools/get.md). When the same save also
has a shape or binding problem, it is named in that one `422 WORKFLOW_DOCUMENT_INVALID`
beside them — an `unknown_input` on one binding and a tool id on another come back together,
not one per save.

A binding to a tool that has since been archived is `tool_archived` at
`/bindings/<n>/tool_revision_id`, with the step that runs it in `node_id` and `label` (the message
names every step that shares the binding) and the tool in `tool_name`. Restore the tool with
[`POST /tools/{id}/restore`](https://docs.goyappr.com/api-reference/tools/restore) — the message carries its id — or remove
the step; rebinding is not the fix. An app tool whose connected account is no longer connected is
`connection_unavailable` there, the same way.

## A complete minimal save

This is the whole body of a save that Check accepts — every field, nothing
elided. It gives an agent one tool and lets the conversation use it. Read the
draft first; `expected_version` is the `draft.version` that read returned, and
everything under `document` is that draft with two edits: one entry in
`bindings`, and that entry's `id` in the conversation node's
`available_binding_ids`.

```json theme={null}
{
  "expected_version": 1,
  "document": {
    "id": "AGENT_ID",
    "name": "Order desk",
    "schema_version": "1",
    "channels": ["phone", "web"],
    "global_instructions": "You look up an order for the caller and read back its status.",
    "request_schema": { "type": "object", "properties": {} },
    "stored_schema": { "type": "object", "properties": {} },
    "bindings": [
      {
        "id": "lookup-order",
        "tool_revision_id": "TOOL_REVISION_ID",
        "inputs": { "order_id": { "kind": "model", "path": "/order_id" } }
      }
    ],
    "before": { "steps": [], "on_failure": "stop_admission" },
    "after": [],
    "sequences": [],
    "conversation": {
      "entry_node_id": "conversation_1",
      "nodes": [
        {
          "id": "conversation_1",
          "type": "conversation",
          "label": "Conversation",
          "instructions": "Ask for the order number, then look it up and read back its status.",
          "available_binding_ids": ["lookup-order"]
        },
        { "id": "end", "type": "end", "label": "End call" }
      ],
      "edges": [
        {
          "id": "conversation_complete",
          "kind": "conversation",
          "source": "conversation_1",
          "target": "end",
          "condition": "The caller has the status and has no further questions."
        }
      ],
      "global_edges": []
    },
    "strict_mode": false
  }
}
```

`TOOL_REVISION_ID` is the `id` of a row from
[`GET /tools/workflow-catalog`](https://docs.goyappr.com/api-reference/workflows/catalog) — the
revision id, not the tool id — and `order_id` is a field name out of that same
row's `input_schema`. `{"kind":"model","path":"/order_id"}` means the agent
asks the caller for it during the conversation; `path` is one top-level field
name with a leading slash, never a deeper pointer.

The save answers `200` with the new `draft.version`. Check that version:

```bash theme={null}
curl -X POST 'https://api.goyappr.com/agents/AGENT_ID/workflow/validate' \
  -H 'Authorization: Bearer YOUR_API_KEY' -H 'x-company-id: COMPANY_ID' \
  -H 'Content-Type: application/json' --data '{"expected_version":2}'
```

```json theme={null}
{ "valid": true, "content_hash": "39463e82…", "issues": [], "warnings": [{ "code": "strict_off_guidance" }] }
```

Publish the same version when it is valid. Nothing reaches a live call before
that.

[Publish](https://docs.goyappr.com/api-reference/workflows/publish.md) answers with the revision it
created, and that revision carries an `environment` — `testing` on the hosted
API. It is the deployment plane that stored the version, not a staging copy and
not something you send: you publish and place calls through the same deployment,
so the version you just published is the version your next call runs. See
[What `environment` says, and what it does not](https://docs.goyappr.com/api-reference/workflows/versions#what-environment-says-and-what-it-does-not).

### Staging a value a follow-up needs

A `{"kind":"model"}` source is the one thing this example cannot be copied into
a follow-up. Move that binding under `after` unchanged and Check refuses it:

```json theme={null}
{
  "code": "model_input_unavailable",
  "path": "/bindings/0/inputs/order_id",
  "node_id": "notify",
  "message": "Only the conversation can collect a value from the caller, so a before-call step, a follow-up step or a step inside a sequence cannot read a model source. Read a request, stored, step or artifact source instead."
}
```

Only the conversation can ask the model for a value, so a follow-up reads one
that was already put somewhere: `request` (declare it in `request_schema` and
send it on `POST /calls`), `step` (an output another step produced) or
`artifact` (a produced result such as the transcript or the analysis, with the
same name in the step's `requires`). There is a fourth kind, `stored`, and it
is the one to avoid: nothing writes saved context, so the input arrives empty on
every call. The save keeps such a draft, but Check and publish refuse a
**required** input whose only source is `stored` (no `fallback`) with
`stored_context_has_no_writer`, and flag an optional one as an advisory. The
same document Checks clean once the follow-up's binding reads the value the
call was started with — declared in `request_schema` and sent in `variables`
on [`POST /calls`](https://docs.goyappr.com/api-reference/calls/create):

```json theme={null}
{
  "request_schema": { "type": "object", "properties": { "order_id": { "type": "string" } } },
  "after": [
    {
      "id": "follow-up",
      "event": "call.ended",
      "steps": [{ "id": "notify", "label": "Post the order to the desk", "binding_id": "post-summary" }]
    }
  ],
  "bindings": [
    {
      "id": "post-summary",
      "tool_revision_id": "TOOL_REVISION_ID",
      "inputs": { "order_id": { "kind": "request", "path": "/order_id" } }
    }
  ]
}
```

### Sending what the agent extracted

The values the agent was asked to pick out of the conversation are the
`analysis` artifact's `extracted_data`, so a follow-up hands them to a tool with
an ordinary artifact source — one field, or the whole set:

```json theme={null}
{
  "after": [
    {
      "id": "tell-the-crm",
      "event": "call.ended",
      "steps": [{ "id": "notify", "label": "Post what we collected", "binding_id": "notify-crm", "requires": ["analysis"] }]
    }
  ],
  "bindings": [
    {
      "id": "notify-crm",
      "tool_revision_id": "TOOL_REVISION_ID",
      "inputs": {
        "preferred_day": { "kind": "artifact", "artifact": "analysis", "path": "/extracted_data/preferred_day" },
        "collected":     { "kind": "artifact", "artifact": "analysis", "path": "/extracted_data" }
      }
    }
  ]
}
```

Each field sits at `/extracted_data/<the name you gave the parameter>`, and
every parameter the agent collects is a key on every call — one the conversation
never covered is stored as `null`. The pointer resolves, so a `fallback` on that
source never fires: an input reading a single extracted field needs a type that
accepts null (`"type": ["string", "null"]`), or the step fails on any call that
did not cover it. Reading the whole `/extracted_data` object into one object
input avoids the question. The same artifact carries `/summary` and
`/disposition_id`, written by the same post-call pass —
[Tool inputs](https://docs.goyappr.com/concepts/tool-inputs.md) lists every artifact's payload.

[Check](https://docs.goyappr.com/api-reference/workflows/validate.md) and publish read every
`/extracted_data/<name>` against the agent's extraction parameters: a name the
agent does not collect is `extracted_field_unknown`, and a parameter whose kind
the input's `type` cannot take — a `yes_no` into a `"string"` input, a `text`
into a `"boolean"` one — is `extracted_field_type_mismatch`. Both name the input.

### Reading a value by description

When no extraction parameter exists for what a follow-up needs — the time slot
the caller agreed to, for a calendar event — describe it on the input itself.
This books the event at the time the caller agreed to, and does nothing if the
call never settled on one:

```json theme={null}
{
  "after": [
    {
      "id": "book-after-call",
      "event": "call.ended",
      "steps": [{ "id": "book", "label": "Put the visit in the calendar", "binding_id": "calendar-event" }]
    }
  ],
  "bindings": [
    {
      "id": "calendar-event",
      "tool_revision_id": "TOOL_REVISION_ID",
      "inputs": {
        "summary": { "kind": "literal", "value": "Visit" },
        "start_datetime": { "kind": "extract", "instruction": "the time slot the caller agreed to" },
        "end_datetime":   { "kind": "extract", "instruction": "the time it ends, only if the caller named an end time later than the start" }
      }
    }
  ]
}
```

The step waits for the call's analysis on its own (no `requires` needed). Add
`"on_missing": "fail"` to make a call with no agreed time fail the step instead
of skipping it, or `"fallback": {"value": "2026-11-04T09:00:00+02:00"}` to book a
default; they are not written together. The required `start_datetime` skips the
step when the call did not say it; the optional `end_datetime` is left out and
the calendar's own default length applies. Every member and rule is in
[Tool inputs](https://docs.goyappr.com/concepts/tool-inputs.md#reading-a-value-by-description).

Check names what cannot work: `extract_unavailable_phase` (not a follow-up step),
`extract_type_unsupported` (the input cannot take a description),
`extract_missing_policy`, `extract_instruction_empty`, and `extract_unavailable`
while the workspace's voice engine does not read it yet. A save keeps the draft
and checks only that a `fallback` is shaped `{"value": …}`. The call's timeline
shows what each step read, and a skipped step with the reason.

Tool sequences contain tool-only private children with one public input/output
contract. They cannot recursively nest or automatically group conversation
nodes. Keep intrinsic End; named transfer destinations belong to saved Tools.

Draft saving checks shape and company references ([What a save
refuses](#what-a-save-refuses)). Executable graph validation is performed by
[Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md) and again by
[Publish](https://docs.goyappr.com/api-reference/workflows/publish.md).

## Follow-up triggers

An After trigger names one event and matches it exactly: a follow-up on
`call.ended` does not run for a call that failed or that nobody answered. Two of
the events you can author stand for more than one runtime event.

* `any_end` is every way a call can stop — it covers `call.ended`, `call.failed`
  and `call.no_answer`. Use it for a follow-up that must run whatever the ending, and
  leave its steps' `requires` empty: it includes the call nobody answered, which never has
  a transcript, analysis, recording, lead or billing. Check warns with
  [`after_any_end_waits`](https://docs.goyappr.com/api-reference/workflows/validate) when a step on it waits for
  any of them.
* `request.failed` is the request itself dying before anything was dialled. No
  call exists and no call event is published, so this is the only trigger that
  runs for it.
* `call.answered` is the call being picked up: the leg answered on a phone call,
  the browser peer accepted on a web call. It is the one event published at the
  *start* of a call, so its follow-up runs while the conversation is still going.
  It is deliberately not part of `any_end` — a trigger on however the call ends
  never fires on a pickup, and one on `call.answered` never fires on an ending.

A follow-up on `call.answered` runs on the follow-up lane like every other one,
beside the live conversation rather than in front of it: nothing it does delays
the conversation, and the agent never waits on it. Its steps receive the call
package at `"phase": "after"`, but the call has not ended, so the ended-call
members — `ended_at`, `duration_seconds`, `transcript`, `analysis`,
`recording_url` — are absent rather than empty. `status` is always present and
reads the live state (`ringing`, `in_progress`), so it is not the signal that a
call has stopped. Wait for the event that names the result you need.

A trigger that waits for a result — `transcript.ready`, `analysis.ready`,
`recording.ready`, `lead.ready`, `billing.ready` — starts its follow-up only for
a result that was actually produced. A call nobody answered settles those
producers without producing anything, and a follow-up waiting on one of them
does not start at all.

The full set of events a trigger accepts is the `event` enum of the
[canonical workflow document](https://docs.goyappr.com/schemas/workflow-v1.json).

A trigger is an `id`, an `event` and its steps, and **every step needs a
`label`** — the same three-field shape (`id`, `label`, `binding_id`) a
before-call step and a sequence child use. A step written without one is
refused by the save, `422 WORKFLOW_DOCUMENT_INVALID` with `issues[0].path`
`/after/0/steps/0/label` (the trigger's and the step's positions), and nothing
is written:

```json theme={null}
{
  "after": [
    {
      "id": "summary-to-clinic",
      "event": "call.ended",
      "steps": [
        {
          "id": "email",
          "label": "Email the clinic the call summary",
          "binding_id": "email-summary",
          "requires": ["transcript"],
          "on_failure": "continue"
        }
      ]
    },
    {
      "id": "missed-call",
      "event": "call.no_answer",
      "steps": [
        {
          "id": "text-clinic",
          "label": "Text the clinic that a call went unanswered",
          "binding_id": "missed-call-sms",
          "on_failure": "continue"
        }
      ]
    }
  ]
}
```

`requires` names the produced results this step waits for, so the step starts
only once they exist. A step can wait only for what its event can have — a
finished call (`call.ended`) can have all five, a call nobody answered none — and
[Trigger events](https://docs.goyappr.com/api-reference/workflows/events.md#what-each-event-can-have) lists
them event by event. A step that waits for something its event never has is
refused at Check and publish with `artifact_never_produced`. Reading a result
with an `artifact` source adds the same wait on its own — see
[How a tool gets its arguments](https://docs.goyappr.com/concepts/tool-inputs.md).

### A different follow-up for each ending

A call stops one of three ways, and each way leaves the call with different
things to say. So the way to do something different per ending is one follow-up
per ending, each with its own steps:

| You want | Add a follow-up on | Its steps can wait for |
| - | - | - |
| Text someone when nobody answered | `call.no_answer` | nothing |
| Report a call that failed | `call.failed` | nothing |
| Send the summary when the call finished | `call.ended` | `transcript`, `analysis`, `recording`, `lead`, `billing` |
| Act on what the AI concluded | `analysis.ready` | `transcript`, `recording`, `lead`, `billing` |
| Tell your system that a call request died before dialling | `request.failed` | nothing |

The three endings never happen on the same call, so those follow-ups are
alternatives: for one call, exactly one runs. Two things to know:

* **Every follow-up whose event matches, and whose "Only if" holds, runs.** `any_end` plus `call.no_answer`
  on one agent both run when nobody answers, so a team gets two messages.
  Use `any_end` alone, or the specific endings alone; mix them only when both
  should run. The dashboard says so when it sees the mix.
* **A condition belongs to the follow-up, not to its steps.** A step on a follow-up
  cannot carry `when`; give the follow-up an "Only if" instead
  ([how](#running-a-follow-up-only-for-some-calls)). "If interested, book a call;
  otherwise nothing" is a follow-up on `analysis.ready` with an "Only if" on the
  disposition. The disposition is guaranteed on `analysis.ready` only; on the
  ending events it is written a moment after them.

To reach a step that needs the transcript or analysis on a call that may not
have one, do not wait on `any_end`. Put the step on `analysis.ready` (or
`call.ended`), and give the unanswered call its own follow-up on
`call.no_answer` with steps that wait for nothing.

## Running a follow-up only for some calls

A trigger can carry one optional `when`: an **Only if** over facts about the
call. The follow-up opens as before, the condition is decided once, and when it
does not hold every step of the follow-up is recorded as skipped (`guard_false`)
and the follow-up counts as done — it is not a failure and sends nothing.
Every follow-up whose event *and* condition match runs; there is no implicit
"otherwise".

`when` is the same condition a sequence step uses — `compare`, `all_of`, `any_of`
and `not`, up to 4 levels and 32 parts — over a new read-only source,
`{"kind": "call", "path": "/status"}`, compared with a fixed `literal`:

```json theme={null}
{
  "id": "nobody-answered",
  "event": "any_end",
  "when": {
    "kind": "all_of",
    "conditions": [
      { "kind": "compare", "source": { "kind": "call", "path": "/status" }, "op": "eq", "value": { "kind": "literal", "value": "no_answer" } },
      { "kind": "compare", "source": { "kind": "call", "path": "/call_direction" }, "op": "eq", "value": { "kind": "literal", "value": "outbound" } }
    ]
  },
  "steps": [{ "id": "text-the-team", "label": "Text the team", "binding_id": "sms" }]
}
```

### What each event lets you read

A fact is offered only where the event guarantees it, because the condition is
read from the call as it is when the follow-up opens. An event that cannot
guarantee a fact is refused at [Check](https://docs.goyappr.com/api-reference/workflows/validate.md) with
`trigger_filter_unavailable`, naming the field, the event and where to move it.

| Fact | `path` | Values | Readable on |
| - | - | - | - |
| Result | `/status` | `completed`, `no_answer`, `failed` | `any_end` only: the other endings already say it |
| Who ended it | `/ended_by` | `caller`, `agent`, `system`, `operator` | `any_end`, `call.ended`, `call.failed`, `call.no_answer` |
| Duration | `/duration_seconds` | number of seconds | the same four endings |
| Direction | `/call_direction` | `inbound`, `outbound` (a browser call is neither: use Channel) | every event except `request.failed` |
| Channel | `/channel` | `phone`, `web` | every event |
| Disposition | `/disposition/id`, `/disposition/label` | one of the company's dispositions | `analysis.ready` only |
| Collected field | `/analysis/extracted_data/<name>` | what the agent collected, as text | `analysis.ready` only |

The disposition and the collected fields are written in the same moment as
`analysis.ready`; at the ending events they are still being written, so they are
not offered there. `ai_session.ended` is not an ending — it can fire before the
carrier's hangup is saved, or long before a transferred call ends — so it
offers direction and channel only.

A fact the call does not have yet makes its comparison false, never an error:
`ended_by` is sometimes not reported, and a call can have no disposition.
`exists` and `not_exists` test for that directly.

The condition is decided before any step: a follow-up it skips never asks the call
for a value, and a follow-up it lets through whose step reads a value
[by description](https://docs.goyappr.com/concepts/tool-inputs.md) and finds none skips only that step (its
follow-up still counts as done).

### The opposite follow-up

To do something else with every other call, add a second follow-up on the same
event whose `when` is `{"kind": "not", "condition": <the first one's when>}`. The
dashboard's **Add the opposite** builds exactly that. Because a missing fact
makes a comparison false, the `not(...)` follow-up also runs when the fact is
missing, so the two together cover every call that reached the event:

```json theme={null}
{ "id": "others", "event": "any_end", "when": { "kind": "not", "condition": { "kind": "compare", "source": { "kind": "call", "path": "/status" }, "op": "eq", "value": { "kind": "literal", "value": "no_answer" } } }, "steps": [] }
```

One limit to know: a filter on `analysis.ready` only ever sees calls whose
analysis finished. A call whose analysis never settled opens no
`analysis.ready` follow-up at all, so even a `not(...)` sibling on that event
does not catch it. To cover those too, put a plain follow-up on `call.ended` or
`any_end` that needs no analysis.

`when` is `compiler_version` `1.9.0`: a document without one compiles to exactly
the bytes it did before, and a voice engine older than 1.9.0 refuses a document
with one at Check (`trigger_filter_reader_unavailable`). The dashboard shows a
follow-up the condition skipped as *Skipped: the condition was not met*, with
the values it saw, and [`GET /calls/{id}`](https://docs.goyappr.com/api-reference/calls/get) lists it
under `follow_ups` as `reason: "condition_not_met"`.

## Routing on what a tool answered

A tool step (an `action` node, or a `sequence` node) leaves by `result` edges:
`succeeded` when the tool did its job and `failed` when it did not. When the next
step depends on what the tool *answered* — an availability check that says
`book`, `offer_other_time` or `transfer` — put a `when` on the `succeeded` edge
for each answer, and one `succeeded` edge without a `when` for every other
answer. The platform reads the answer and takes the edge, with no model in
between, so the same answer always leads to the same step. These are the
`strict_mode` and `conversation.edges` of a document where `check` is an
`action` node whose tool answers with a `route`:

```json theme={null}
{
  "strict_mode": true,
  "conversation": {
    "edges": [
      {
        "id": "check-book", "source": "check", "target": "confirm-time",
        "kind": "result", "outcome": "succeeded",
        "when": {
          "kind": "compare", "op": "eq",
          "source": { "kind": "step", "scope": "during", "step_id": "check", "path": "/route" },
          "value": { "kind": "literal", "value": "book" }
        }
      },
      {
        "id": "check-transfer", "source": "check", "target": "hand-over",
        "kind": "result", "outcome": "succeeded",
        "when": {
          "kind": "compare", "op": "in",
          "source": { "kind": "step", "scope": "during", "step_id": "check", "path": "/route" },
          "value": { "kind": "literal", "value": ["transfer", "urgent"] }
        }
      },
      { "id": "check-otherwise", "source": "check", "target": "offer-other-time", "kind": "result", "outcome": "succeeded" },
      { "id": "check-failed", "source": "check", "target": "apologise", "kind": "result", "outcome": "failed" }
    ]
  }
}
```

`check-otherwise` is the **otherwise** edge: the one `succeeded` edge with no
`when`. It is taken when no `when` holds, for example when `/route` is `"full"`
or the answer has no `route` at all.

How it is decided:

* **Same conditions as a sequence step.** `when` is a `compare`, `all_of`,
  `any_of` or `not`, with the same operators, limits and no-coercion rules as
  [Branching inside a sequence](#branching-inside-a-sequence).
* **It reads two things only:** fixed values (`literal`), and the answer of the
  step the edge leaves, as
  `{"kind": "step", "scope": "during", "step_id": "<the edge's source>", "path": "/<field>"}`.
  For a sequence step the answer is the sequence's output. A request value, a stored value, the call or another step's
  answer cannot be read here.
* **Inside a list.** A `path` may step into a list by position: `/data/trips/0/distance` is the distance of the
  first trip. A position is a whole number written without a leading zero (`0`, `1`, `12`; not `first`, `-1` or
  `01`). A list the tool marks optional (`"type": ["array", "null"]`, how connected-app tools declare most lists)
  is read the same way. If the list is `null`, empty, missing or shorter than the position, or the field in it is
  missing, the comparison is false and the next edge is tried; it does not fail the call. `/data/trips/0` reads
  the first trip; there is no "any item" or "last item".
* **In the order written.** The edges with a `when` are tried in the order they
  appear in `conversation.edges`, and the first that holds is taken. Put the most
  specific one first.
* **Exactly one otherwise edge.** A step with any `when` needs one `succeeded`
  edge without one. Two without are still ambiguous, and so are two `failed`
  edges.
* **Success only, and Strict only.** A `failed` edge never has a `when`: it is
  taken whenever the tool fails, whatever it answered. A `when` needs
  `strict_mode: true`, because only Strict mode holds the conversation to the
  edge the answer picked.
* **A comparison that cannot be made is false.** If the answer has no such field,
  or the value is not the type the comparison expects, that comparison is false
  and the next edge is tried. It does not fail the call.
* **A tool that never answered** (a timeout, a connection that reset) takes the
  step's `failed` edge, with or without a `when` on the step, and the request is
  not sent again. A step with no `failed` edge waits. A call transfer is the
  exception: if the carrier never said whether it connected, the call waits,
  because the caller may already be on the other line. A transfer the carrier
  refuses takes its `failed` edge like any other step.
* **A step without a `when`** is routed by `succeeded` or `failed` exactly as
  before.

Nothing is coerced: `"0"` and `0` are different values, so list both
(`{"op": "in", "value": {"kind": "literal", "value": ["0", 0]}}`) when an
endpoint may send either.

A `not` turns the false of a comparison that cannot be made into true. `not` around `gt` `8000` on
`/data/trips/0/distance` also holds when the answer has no trip, or when the trip has no distance, so write the
comparison the way you mean it. "There is a trip and it is not long" is `lte` `8000`, which is false whenever
there is no distance to read:

```json theme={null}
"when": {
  "kind": "compare", "op": "lte",
  "source": { "kind": "step", "scope": "during", "step_id": "route", "path": "/data/trips/0/distance" },
  "value": { "kind": "literal", "value": 8000 }
}
```

Each ordering comparison has its positive opposite (`gt` and `lte`, `gte` and `lt`). `exists` is true for a
position that holds `null`, so `all_of` of `exists` on the trip and a `not` still holds for a trip whose distance is
`null` or missing. `not_exists` is true when the position is not there: a `null`, empty or shorter list.

Check refuses the mistakes, each at the edge or the step it concerns:

| Code | What to change |
| - | - |
| `result_guard_outcome` | A `when` on a `failed` edge. Remove it. |
| `result_guard_needs_strict` | A `when` while `strict_mode` is off. Turn Strict mode on, or remove the `when`. |
| `result_guard_needs_otherwise` | The step has `succeeded` edges with a `when` and none without. Add the otherwise edge. |
| `ambiguous_result_edge` | Two `succeeded` edges without a `when`, or two `failed` edges, leave the same step. Keep one, or give one of the `succeeded` edges a `when`. |
| `result_guard_source` | The `when` reads something other than fixed values and this step's own answer. |
| `unknown_source_path` | The tool's output schema rules the `path` out: it closes a shape (`"additionalProperties": false`) without that field, it continues below a value that is text, a number or true/false, or it steps into a list with something that is not a position (`/trips/first`, `/trips/-1`, `/trips/01`; the message names the list and gives a position to try). A shape the schema leaves open is not checked, so a misspelt field in one is not caught here, and a comparison the call cannot make while it runs is false. |
| `result_guard_reader_unavailable` | The voice engine this workspace's calls run does not read a `when` on an edge yet, so nothing was published. |

A `when` is also held to the condition rules of a sequence step
(`condition_value_type`, `condition_type_mismatch` and the others). Each code is
described on [Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md).

A `when` on a result edge makes the document `compiler_version` `1.10.0`. A
document without one compiles to exactly the bytes it did before, and a voice
engine older than 1.10.0 refuses a document with one at Check, naming each edge
(`result_guard_reader_unavailable`). A save keeps the draft either way. The
dashboard shows such an edge on the canvas and in the step panel and keeps its
`when` whatever else you edit on the step, but it does not author one: write it
through this API, an AI app connected to Yappr, or the Yappr skill.

## Refusing a call before it starts

A before-call step can refuse the call itself. Route either outcome of the step
to `"#decline"`:

```json theme={null}
{ "id": "screen", "label": "Screen the number", "binding_id": "blocklist", "on_succeeded": "#decline" }
```

* `"#decline"` is the only route target a before-call step may name. Pointing one
  at another step is `before_route_target`.
* Refusing on failure needs `"on_failure": "continue"` on the same step;
  otherwise the phase stops before the route could be taken
  (`failure_route_conflict`).
* Only a before-call step routes at all. A route on a follow-up step is
  `route_phase`, a `"#decline"` inside a sequence is `decline_phase` — by the
  time a sequence runs the call is already connected — and a `when` condition on
  a before-call or follow-up step is `guard_phase`, because a lifecycle step runs
  as soon as the steps it declares are done.

The dashboard offers each before-call step one failure choice — stop the
remaining steps (the default), continue with the results that are ready, or
refuse the call — and writes `before.on_failure` from them:
`continue_with_available` when any step continues on failure, otherwise
`stop_admission`. A document saved through this API keeps what it sends.

What the caller gets depends on the direction. An **incoming** call is never
answered: it is refused at the carrier, the same as a call arriving at an agent
that is switched off. An **outgoing** call is never dialled: no call record is
created, and [`GET /call-requests/{id}`](https://docs.goyappr.com/api-reference/calls/request-get) ends
at `status: "failed"` with `preparation_status: "declined"` and
`error_code: "before_declined"`. A refusal is not a failure — nothing is retried,
and `before.on_failure` does not apply to it.

## Which ways in the agent allows: `channels`

`channels` lists the ways a call can reach the agent: `"phone"` and `"web"`.
Both are on unless you say otherwise, and a document must list at least one
(`duplicate_channel` refuses a repeated value). It is the same list the
dashboard's Start sheet edits with its **Phone** and **Browser** switches.

| Value | Covers | What it needs |
| - | - | - |
| `"phone"` | Incoming calls **and** the calls the agent places: [`POST /calls`](https://docs.goyappr.com/api-reference/calls/create), a [call request](https://docs.goyappr.com/api-reference/calls/request-create.md) and a campaign. | An incoming call needs a number whose Inbound Agent is this agent, or an extension that points at it. An outgoing call names a `from` number of the workspace. |
| `"web"` | Browser calls: the dashboard's browser test, a [shared link](https://docs.goyappr.com/api-reference/shared-links/create.md) and a Web SDK page. | No phone number, and no setup beyond publishing. |

There is no separate switch for incoming and outgoing calls: the numbers decide
the direction. To have the agent answer a number, or place calls from it by
default, bind it to the number with
[`PATCH /phone-numbers/{id}`](https://docs.goyappr.com/api-reference/phone-numbers/update). That write
is immediate and does not wait for a publish.

A channel left out of the published list is refused when a call on it is
prepared, before anything is dialled: the call request ends `failed` with
`error_code: "artifact_unavailable"` ([Read a call request](https://docs.goyappr.com/api-reference/calls/request-get.md)).
The dashboard's browser test reads that code and says, in the person's language:
"This agent isn't ready to take browser calls. Publish it, and check that Browser
is on in its Start step." (an unpublished agent ends the same way, so the sentence
names both). Keep both unless the agent must never be reached one way. Two more rules read
the list at publish time: a call transfer needs `"phone"` (`tool_grant_channel`,
`transfer_placement`), and every tool a step uses must be allowed on at least
one listed channel (`unsupported_channel`).

## Before-call steps, the channel and the window

A document that declares before-call steps runs them on every channel it offers.
`channels` may contain `"web"` alongside a non-empty `before.steps`: a browser
call is created, prepared and then started by the caller, exactly as an outgoing
call is created, prepared and then dialled. A browser client has to speak that
exchange — see [Create Web Call Request](https://docs.goyappr.com/api-reference/calls/request-create.md).

How long there is to prepare belongs to the platform, not to the document —
there is no budget field to set:

* an **incoming** call prepares after it arrives and before it is answered,
  within **30 seconds**;
* an **outgoing** call prepares before the dial, within **five minutes**;
* a **browser** call prepares after it is created and before the caller starts
  it, within the same **five minutes**.

Publication follows the longest chain of before-call steps through `depends_on`,
charging each step the timeout of the tool revision it resolves to, and refuses a
chain that cannot fit either window: `before_budget_exceeded` against
`/before/steps`. Steps that do not depend on each other run together, so only the
longest of them counts. A chain that fits the outgoing window but not the
incoming one still publishes; on an incoming call it runs out of time, and what
happens then is `before.on_failure`.

`before.on_failure` says what a failure or a window that runs out means:
`stop_admission`, the default, refuses the call — so a chain too long for an
incoming call means that call is refused, not answered with partial results.
`continue_with_available` is the other choice: it answers or dials with whatever
the phase did produce.

## Using a before-call result in step instructions

A before-call result can be written into what the agent says. The reference is
checked when you publish and filled in when the call starts.

```
{{before.step_id}}                        the whole result
{{before.step_id.field.subfield}}         one field
{{before.step_id.field|text}}             with text to use when there is no value
```

* Dots walk into the result, and a number addresses a position in a list:
  `{{before.availability.slots.0.time}}`.
* Everything after `|` is used verbatim when the value is missing. A `|` with
  nothing after it is a declared empty string; no `|` at all means the reference
  simply disappears rather than leaving braces for the agent to read out.
* Publishing resolves the step id against the before-call phase and the field
  against the `output_schema` of the tool that step runs, so instructions can
  never reach data a tool input could not.
* Only before-call steps can be read this way. A during-call or follow-up step
  has produced nothing at the moment the instructions are written.
* Write it exactly as shown — lowercase, no spaces inside the braces.
  `{{Before.…}}`, `{{ before.… }}` and `{{before .…}}` are refused rather than
  quietly left as text.
* Two fields accept a reference: `global_instructions`, and a conversation step's
  `instructions`. Anywhere else — a step's label, a route condition, a tool's or
  a sequence's own description — is refused, because nothing fills those in and
  the agent would read the braces aloud.
* A document that declares a call variable named `before` alongside a reference
  is refused; the name is reserved.
* At most 256 references in one document. One reference is at most 512
  characters and its fallback text at most 1,000.
* A quoted value is a phrase in a sentence, not a payload: one longer than 2,048
  bytes counts as no value, so its fallback text is used (or, with none, the
  reference disappears). Quote a short field, not a whole long list.
* A result is read at most 8 levels down, and only the first 64 items of a list. A reference that goes deeper, or
  names a position of 64 or more, counts as no value and uses its fallback text, although Publish accepts it. A
  [route condition](#routing-on-what-a-tool-answered) reads the tool's answer itself and is not limited this way.

Where the producing step may legitimately not run — `before.on_failure` is
`continue_with_available`, or the step itself continues on failure — a reference
with no fallback is an advisory rather than a refusal: Check returns it as the
warning code `before_reference_missing_fallback`, and publication is allowed. If
the value is missing when the call starts, the reference is removed and the agent
speaks the sentence without it — so add fallback text after the `|` when that
would read badly, or leave nothing after the `|` to declare the empty string on
purpose.

[Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md) lists every code these rules
raise and what to change for each.

## Example: offer calendar times without a tool call

An agent that books appointments is quickest when the caller never waits for a
calendar lookup after saying yes. Read the calendar's busy times once, in a
before-call step, and let the conversation offer times from that list. A booking
call then makes one tool call in the middle of the call: the booking itself.

The before-call step runs a connected-app tool for the calendar's
`GOOGLECALENDAR_FIND_FREE_SLOTS` action ([Create Tool](https://docs.goyappr.com/api-reference/tools/create.md)),
with a window written as [relative times](#action-inputs-fixed-from-the-call-ai-or-a-list) so it
moves with the day. `time_max` of `in_days.14` is the same wall time 14 days from
the moment the step runs:

```json theme={null}
{
  "before": {
    "steps": [
      { "id": "free_time", "label": "Free time, next 14 days", "binding_id": "free_time", "on_failure": "continue" }
    ],
    "on_failure": "continue_with_available"
  },
  "bindings": [
    {
      "id": "free_time",
      "tool_revision_id": "TOOL_REVISION_ID",
      "tool_revision_policy": "follow_current",
      "inputs": {
        "time_min": { "kind": "literal", "value": "{{call.time.now.Asia/Jerusalem}}" },
        "time_max": { "kind": "literal", "value": "{{call.time.in_days.14.Asia/Jerusalem}}" }
      }
    }
  ]
}
```

The conversation step quotes the result's `end` and `busy` and says how to use them.
Write it in the agent's language and voice. The step's `id` and `label` are also shown to
the agent, so name the window in the label, and write the same number of days in
`time_max`, in the label and after the `|` of the `end` reference (the text shown when the
step did not run):

```text theme={null}
Busy times from now until {{before.free_time.end|14 days from now}}: {{before.free_time.busy|unknown right now}}.
A time before that end that does not overlap any of them is free. Offer times from this
list and check a time against it; do not use Find free time for a time before that end.
Use Find free time only for a time after it, or when the list says unknown right now.
Book a time with Book an event once the caller has confirmed it.
```

The window ends at the same time of day, `n` days on, so its last day is only partly
covered. That is why the text names the end the result carries, and never "these 14 days":
a caller who asks for a later hour on the last day is asking about a time the list does
not cover.

What to know before you rely on it:

* **It costs about a second, once.** The step runs before the first word, so the
  caller waits for the lookup once at the start in place of every time the agent
  would have looked during the call.
* **The list is as of the start of the call.** A time someone else books while the
  call is on is not in it, and the calendar does not refuse an overlapping booking.
  A calendar that many people book at once may want a shorter window.
* **Size the window to the calendar; do not rely on a fallback.** The `busy` list is a
  quoted value, so one over 2,048 bytes (about 35 busy events) reads as `unknown right
  now` in the instructions. The data prepared for the agent still lists the events,
  up to 64 and cut off after that, and tells the agent it needs no fetching, so the two
  disagree and nothing makes the agent look at the calendar again. Keep the window
  under about 30 busy events: `in_days.14` for up to 2 busy events a day, `in_days.7`
  for up to 4, `in_days.3` for up to 10. For a calendar that is booked most of the day,
  leave this pattern out and keep Find free time in the conversation.
* **It needs relative times.** A workspace whose calls do not run the newest voice engine
  yet refuses the document when you publish it (`call_placeholder_time_unavailable`,
  asking for a fixed date and time). Do not write a fixed window: it is wrong from
  tomorrow. Keep Find free time in the conversation instead.
* Leave `strict_mode` as it is: nothing here depends on step order.

## Random variations in instructions

`global_instructions` and a conversation step's `instructions` may vary from call to call:
`{{Ask what they need|Find out what they need}}` says one of its options, picked once when the
call starts. A step reads the same in the opening prompt and in its own step context, and a
reference keeps its fallback — `{{before.step_id.field|text}}` and `{{call.field|text}}` are
never read as a choice. The full rules are under
[Random variations](https://docs.goyappr.com/api-reference/agents/create.md#random-variations).

## Integrations: an app on every step

`integrations` lists the connected accounts given to the whole agent, one entry per account, each with the actions it may use and the binding that runs each one. Manage them with [`/agents/{id}/integrations`](https://docs.goyappr.com/api-reference/agents/integrations-add) rather than by hand: that prepares each action, adds its binding and publishes. A save keeps them consistent whatever wrote the document: every integration binding is put on every conversation step that lacks it, and a binding of the integration shape (`i_<account>_<action>`) that no integration owns any more is taken off every step, and out of `bindings` when nothing else uses it. An integration binding cannot also run as an action step, a before-call or follow-up step, or inside a sequence (`integration_binding_shared`); Check and publish refuse a step missing an integration's actions (`integration_not_on_step`) and more than 64 integration actions (`integration_limit`).

## Action inputs: Fixed, from the call, AI, or a list

Every input of a binding has a source, and the same four choices cover every action - an app's, a webhook's or a transfer's:

| Choice | Source | What happens on the call |
| - | - | - |
| Fixed | `{"kind":"literal","value":…}` | Sent as is. The agent never sees the input. A value that is exactly one call reference, such as `"{{call.caller_number}}"`, is that fact of the call. A relative time, `"{{call.time.<when>.<zone>}}"` (`now`, `start_of_today`, `end_of_today`, `start_of_tomorrow`, `end_of_tomorrow`, `in_hours.<1-8760>`, `in_days.<1-366>`; an IANA zone such as `Asia/Jerusalem`, UTC when left out), is worked out when the step runs and sent as RFC 3339 with that zone's offset, for example `"{{call.time.start_of_today.Asia/Jerusalem}}"` → `"2026-11-02T00:00:00+02:00"`. |
| From the call | `request`, `stored`, `step` (and `artifact` after the call) | Read from the call request, saved context or an earlier step. The agent never sees it. |
| AI | `{"kind":"model","path":"/<input>"}` | The agent fills it from the conversation. During the call only. |
| Choose from a list | `{"kind":"model","path":"/<input>","options":[{"value":…,"label":…}]}` | The agent picks one of 1-20 choices by its label; the tool receives the value. Text inputs, or a list of text, only. |

```json theme={null}
{
  "id": "i_d3d44b7a_find_free_slots",
  "tool_revision_id": "9f1c2b3a-4d5e-4f60-8a7b-1c2d3e4f5a6b",
  "tool_revision_policy": "follow_current",
  "inputs": {
    "items": { "kind": "model", "path": "/items", "options": [
      { "value": "primary", "label": "Front desk" },
      { "value": "c_1a2b3c@group.calendar.google.com", "label": "Clinic" }
    ] },
    "time_min": { "kind": "model", "path": "/time_min" },
    "time_max": { "kind": "model", "path": "/time_max" }
  }
}
```

If the agent sends a value for an input you settled another way, it is ignored; any other argument it was not asked for is still refused. A Google Calendar action's calendar that has no source is the main calendar (`primary`). List an account's calendars with [`GET /tool-connections/{id}/options/calendars`](https://docs.goyappr.com/api-reference/tool-connections/options). Check and publish refuse a required input with no source (`missing_input_source`, naming the action and the input), a list on an input that does not take text (`options_type`) and a value listed twice (`options_duplicate`).

## Webhooks and transfers on every step

A saved webhook or call transfer can be given to every conversation step, like an app: an `integrations` entry `{"id": "tg_<tool>", "tool_id": "<tool uuid>", "binding_id": "t_<tool>"}` whose binding runs that tool. Add it with [`POST /agents/{id}/integrations`](https://docs.goyappr.com/api-reference/agents/integrations-add) and `tool_id`. At most 8 such entries (`tool_grant_limit`); only an HTTP or transfer tool (`tool_grant_kind`), each once (`tool_grant_duplicate`); a transfer needs the phone channel (`tool_grant_channel`); its binding must exist and run that tool (`tool_grant_binding_missing`, `tool_grant_mismatch`) and cannot run anywhere else (`integration_binding_shared`). Ids of the shapes `i_…`, `tg_…`, `t_<hex>` and `o_…` are kept for these entries.

## A step's own settings for an agent-wide action

`binding_overrides` on a conversation step maps an agent-wide binding (an app action or a tool on every step) to a binding of the step's own that runs the same tool with other inputs - for example a different calendar on one step:

```json theme={null}
{ "id": "booking", "type": "conversation", "binding_overrides": { "i_d3d44b7a_find_free_slots": "o_k3j9x0a2b1" } }
```

On that step the override runs instead of the agent-wide binding - reliably only with `strict_mode` on: with it off, both copies stay callable on every step and Check returns `override_needs_strict`. The key must be an agent-wide binding (`override_not_grant`) and the value must run the same tool (`override_mismatch`). When the agent-wide action goes, its overrides go with it.

## Canvas positions

`editor.positions` keeps where the dashboard draws each node: a conversation step by its id, and `before:<step id>`, `after:<trigger id>`, `after:<trigger id>/<step id>`, `grant:<integrations id>`, `#start`, `#answer` and `#decline`. A key that names nothing in the document is refused (`unknown_editor_node`). Positions never change what a call does.

## A line said while a step's tool runs

An action step may carry `hold_line`: one short sentence the caller hears while that step's tool
runs, so a slow lookup is not dead air.

```json theme={null}
{
  "id": "check-diary",
  "type": "action",
  "label": "Check the diary",
  "binding_id": "diary-lookup",
  "hold_line": "רגע אחד בבקשה."
}
```

* It starts when the tool starts, never when the step is entered: a step that still needs details
  from the caller asks for them first, and the line plays as the tool is sent.
* It is said in the agent's own voice, exactly as written, on both voice engines.
* The agent's next words wait until the line has been heard, so a fast tool's answer can come a
  little later than without it — never more than four seconds after the tool answered. A tool that
  takes longer than the line adds no wait at all.
* On GPT Live the agent says the line once it has finished its current sentence. If the tool
  answers before then, the line is skipped: the caller hears the answer instead.
* On Gemini Live, `"רגע אחד בבקשה."` and `"One moment please."` play a recording made in every
  voice. Any other line is recorded in the agent's voice when a call starts; on the very first call
  after you write it, a tool that runs in the first few seconds may run without it.

The line has to finish inside that four-second wait, so it is short: about 2.5 seconds of speech.

| Written in | Longest line |
| - | - |
| English and other alphabets (Latin, Cyrillic, Greek) | 28 characters, such as `"Just a moment, let me check."` |
| Hebrew or Arabic | about 25 characters, such as `"רק רגע בבקשה, בודקת ביומן"` |
| Korean, or Japanese in kana | about 16 characters |
| Chinese characters (and Japanese kanji) | about 10 characters |

Every character counts, spaces and punctuation included, and a digit counts as about three
characters because it is said as a word. A save refuses a `hold_line` that is not text of 1 to
28 characters (`422 WORKFLOW_DOCUMENT_INVALID`, `field_invalid` at
`/conversation/nodes/<n>/hold_line`, the step in `node_id`) and writes nothing; the dashboard and
the builder chat save under the same rule. [Check
workflow](https://docs.goyappr.com/api-reference/workflows/validate.md#conversation-graph-issues) refuses a shorter line that
still takes too long to say (`hold_line_too_long`), so every line that publishes fits in that
wait. `null`, or no `hold_line` at all, is no line of your own: the call then says
[the default line](#the-default-line) when its tool is slow.

The line is fixed text. It cannot carry a `{{...}}` reference or a random variation, and a
transfer step cannot have one — it says the announcement set on its transfer tool. A document
with a hold line compiles for runtimes that know the field (`compiler_version` `1.5.0`); a
document without one compiles as before and still gets the default line, which needs nothing in
the document. A flow agent's
[Play hold tone](https://docs.goyappr.com/api-reference/agents/flow-config-schema.md) (`pre_fire_announcement`) becomes this
line when the agent moves to a workflow, in the agent's language: the clip's own words,
`"רגע אחד בבקשה."` or `"One moment please."`, both inside the limit. A line is never cut short to
fit; one that did not fit would be left off the step, and the move would say so.

[Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md#conversation-graph-issues) names
`hold_line_blank`, `hold_line_not_fixed`, `hold_line_too_long` and `hold_line_on_transfer`.

### The default line

A slow tool with no `hold_line` is not met with silence either. When the agent is about to run
one, the call says a short fixed line itself as the tool starts: `"One moment please."` or
`"רגע אחד בבקשה."`, the shipped phrase of the call's language. It covers the tools a
conversation step offers (including the ones given to the whole agent) and an action step with
no `hold_line`.

* It is said only for a tool that really runs: not when the agent answers in words, not for End
  call or a transfer, and not when the call is refused before the tool is sent.
* It is said only for a tool that usually takes about two seconds or longer. The call learns this
  from that tool's recent runs on the same server; until it has a few, a connected app such as
  Google Calendar counts as slow and a tool you call by URL counts as fast. A tool that usually
  answers faster gets no line.
* English and Hebrew only. Another language, or an agent set to answer in several languages, gets
  no default line.
* It starts only while the tool is still running; a line the call has not started by the time the
  tool answers is dropped. The answer does not wait for it: never on GPT Live, and on Gemini Live
  for at most half a second, so the line is not cut off.
* On Gemini Live it is skipped when the agent is already talking. On GPT Live it is skipped when
  the agent has just said its own "one moment" or "let me check", and it waits for the agent to
  finish its current sentence first.
* On GPT Live, a tool that usually takes over six seconds (booking a calendar event) gets one
  more short line (`"Still working on it."` or `"עוד רגע בבקשה."`, then `"Thanks for your
  patience."` or `"תודה על הסבלנות."` on the next such tool) about four and a half seconds after
  the first, only while the tool is still running.

A `hold_line` you write on an action step replaces the default for that step. There is no field
to turn the default off, or to change its words, for a tool a conversation step offers.

## Branching inside a sequence

A sequence step may carry a condition and route its own outcome. Conditions are
declarative data: Yappr never evaluates a customer expression and never runs
customer code.

A condition is one comparison —
`{"kind":"compare","source":{…},"op":"…","value":{…}}` — or a combination of
comparisons: `{"kind":"all_of","conditions":[…]}`,
`{"kind":"any_of","conditions":[…]}` or `{"kind":"not","condition":{…}}`.
`all_of` and `any_of` take 1–16 conditions each. A condition nests at most four
levels — at most three `all_of`/`any_of`/`not` wrappers around a comparison —
and declares at most 32 parts in total.

Both `source` and `value` are ordinary input sources, limited to the kinds that
read data already frozen when the step is decided: `literal`, `request`,
`stored`, `sequence` and `step`. Live model arguments and produced call
artifacts are not readable in a condition.

### Operators

`exists`, `not_exists`, `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`,
`not_contains`, `in`, `not_in`, `is_true`, `is_false`, `is_empty`,
`is_not_empty`.

`exists`, `not_exists`, `is_true`, `is_false`, `is_empty` and `is_not_empty`
take no `value`. Every other operator requires one.

* Nothing is coerced. `"1"` never equals `1`; `1` and `1.0` are the same number.
* `gt`, `gte`, `lt` and `lte` apply to numbers only — a boolean is not a number.
* `in` and `not_in` need a list on the `value` side.
* `contains` is text inside text, or a list holding that exact value.
* `is_empty` and `is_not_empty` apply to text, lists and objects. A JSON `null`
  is none of those, so both answer false for it. Test for it with `eq` against
  `{"kind":"literal","value":null}`.
* `exists` asks whether the path resolved. A source that declares a `fallback`
  always resolves, so it always exists.

Types are checked when you publish, against each source's declared schema
wherever that schema commits to a type. A source whose schema declares none is
checked again while the call runs, where a value of the wrong type makes that
one comparison false rather than failing the call.

### Routes

`on_succeeded` and `on_failed` name another step in the same sequence, or
`"#end"` to finish the sequence early.

* `on_failed` requires `"on_failure": "continue"` on the same step; a stop is
  never overridden implicitly.
* Nothing may route back to the sequence's first step — that step is the one the
  sequence starts with.
* Declared dependencies and routes together must be acyclic.
* Steps with no route keep running in dependency order, so a sequence that
  declares no condition and no route behaves exactly as it did before.
* A sequence that branches runs endpoint-calling and connected-app steps only.
  Keep a transfer outside it.

### Skipped steps

A step whose condition is false is **skipped**: it is never dispatched, makes no
attempt and holds no result. So is a step that depends on a skipped one, and a
step that only a route could have started when no route reached it. Routing to
`"#end"` finishes the sequence and skips everything still outstanding. The run
carries on without the skipped step.

A skipped step produces nothing, so read one of its outputs only through a
source that declares a `fallback`, and map a required sequence output from such
a step only with a `fallback` — otherwise leave that output field optional.

[Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md) lists the issue codes these
rules raise and what to change for each.


## OpenAPI

````yaml PUT /agents/{id}/workflow
openapi: 3.1.0
info:
  title: Yappr API
  description: >
    Create and manage AI voice agents, purchase phone numbers, configure tools,
    and initiate calls — all via REST.
  version: 1.0.0
  contact:
    url: https://goyappr.com
servers:
  - url: https://api.goyappr.com
    description: Production
security:
  - apiKey: []
paths:
  /agents/{id}/workflow:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
          format: uuid
      - in: header
        name: x-company-id
        schema:
          type: string
          format: uuid
        description: >-
          Explicit active workspace. Optional; when sent it must be the API
          key's own workspace — any other value is refused with 403
          WORKSPACE_MISMATCH.
    put:
      tags:
        - Workflows
      summary: Save canonical workflow draft
      description: >-
        Requires agents:update. Replaces the complete draft under
        expected_version compare-and-swap. Document id/name are server-owned for
        workflow agents - send them back as read, and a save that changes either
        is refused (422 WORKFLOW_DOCUMENT_INVALID, server_owned at /id or
        /name); rename the agent with PATCH /agents/{id}. A save refuses the
        document's shape - a step kind the schema does not have
        (node_type_unknown at /conversation/nodes/<n>/type), a step without a
        member its kind requires (field_required, for example
        /after/0/steps/0/label) - every problem by path in one answer. An action
        step's hold_line that is not text of 1-28 characters (or null) is
        refused the same way (field_invalid at
        /conversation/nodes/<n>/hold_line, the step in node_id), and nothing is
        written. Saves do not publish; invalid executable graphs (a step nothing
        reaches, a binding reading a parameter the agent does not collect) can
        remain drafts, and Check names them. The total UTF-8 JSON request body
        is limited to600000 bytes; stored PostgreSQL document representation is
        limited to512KiB. Preserve arbitrary JSON numeric tokens with a lossless
        client. Never retry a conflict by overwriting the new version
        automatically; a refused save writes nothing, and re-sending the
        identical save after a lost answer is answered 200 instead of 409. An
        after-call input may also be read from the finished call by description
        - {"kind":"extract","instruction":"the time slot the caller agreed to"}
        with an optional type (text, number, yes_no, date or datetime; left out,
        it follows the tool input), on_missing ("skip", the default for a
        required input, or "fail") or a fallback {"value":…} (not both). The
        call's analysis answers it in the same single model call; a datetime is
        a day and a time in the workspace's time zone sent with that zone's
        offset. A value the call did not say is missing and is never guessed -
        the step is skipped (a skipped step is not a failure), or fails, or
        sends the fallback. A failed analysis blocks the step instead. Check
        refuses it anywhere but a follow-up step (extract_unavailable_phase). A
        sequence step may carry a when condition and on_succeeded/on_failed
        routes. A before-call step may route either outcome to "#decline", which
        refuses the call - an incoming call is refused at the carrier and never
        answered, and an outgoing one is never dialled and its call request ends
        failed with error_code before_declined. "#decline" is the only target a
        before-call step may name, and no other phase routes or carries a
        condition. An After trigger event may be any_end, which stands for
        call.ended, call.failed and call.no_answer, or request.failed, which is
        the request dying before anything was dialled; a <artifact>.ready
        trigger starts its follow-up only for a result that was actually
        produced. A document with before-call steps may also offer the web
        channel - a browser call is created, prepared and then started by the
        caller, the same way an outgoing call is. The preparation window is the
        platform's - 30s inbound, 5 minutes for an outgoing or browser call -
        with no field to set. global_instructions and a conversation step's
        instructions may quote a before-call result as {{before.step_id.field}}
        with an optional |fallback text. global_instructions, a conversation
        step's instructions and a tool binding's fixed input value may quote the
        call itself as {{call.field}} or {{call.field.subfield}} -
        {{call.caller_number}}, {{call.call_variables.first_name|there}} -
        naming a member of the CallPackage schema, or a relative time
        {{call.time.<when>.<zone>}} - now, start_of_today, end_of_today,
        start_of_tomorrow, end_of_tomorrow, in_hours.<1-8760> or
        in_days.<1-366>, then an IANA zone (UTC when left out) - worked out when
        it is substituted and sent as RFC 3339 with that zone's offset; any
        other spelling is a publish error (call_placeholder_time). In a fixed
        input the value is substituted into the request just before it is sent;
        in instructions it is substituted when the call starts. The field has to
        be one every phase that text runs in can know - a before-call step's
        input cannot read the call id, and neither an instruction nor anything
        that runs before the call ends can read the transcript. Those three
        places and a transfer tool's spoken line are the only places a call
        reference may be written; a step name, a route condition or a tool
        description is a publish error rather than braces the agent reads out.
        An after-call step reads what the agent extracted as an artifact source
        on the analysis artifact - kind artifact, artifact analysis, path
        /extracted_data/<parameter name>, or /extracted_data for the whole set -
        alongside /summary and /disposition_id on the same artifact. Every
        parameter the agent collects is a key on every call, and one the
        conversation never covered is stored as null there, so a fallback on
        that source never fires and an input reading a single field needs a type
        that accepts null. Saved context has no writer, so a stored source there
        is empty on every call. Saving checks none of this; validate and publish
        do. An action step may carry hold_line - one fixed sentence, said in the
        agent's voice while that step's tool runs, starting when the tool
        starts, with the agent's next words held until it has been heard (never
        more than four seconds past the tool's answer). It must finish inside
        that wait - about 2.5 seconds of speech, so up to 28 characters (a save
        refuses more, field_invalid), about 25 in Hebrew or Arabic, about 16 in
        Korean or Japanese kana, about 10 in Chinese characters, a digit
        counting as about three; Check refuses a line that takes longer to say
        (hold_line_too_long). It cannot carry a {{...}} reference or a random
        variation (hold_line_not_fixed), be blank (hold_line_blank), or sit on a
        transfer step (hold_line_on_transfer). A step with no hold_line of its
        own, and a tool a conversation step offers, still gets the call's
        default line - "One moment please." or the Hebrew "רגע אחד בבקשה." - as
        a slow tool starts (English and Hebrew calls only, tools that usually
        take about two seconds or longer, never for End call or a transfer); a
        hold_line on an action step replaces it, and there is no field to turn
        the default off.
      operationId: saveWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowSave'
      responses:
        '200':
          description: >-
            Saved draft with its new version. Re-sending the identical save
            after a lost answer returns this same 200 rather than a conflict:
            the draft already is the document that was asked for.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowState'
        '400':
          description: >-
            WORKFLOW_REQUEST_INVALID - a query parameter was sent (the save
            reads none), the body is not JSON, expected_version is missing or
            not a positive whole number (or null for a first draft), or a field
            other than expected_version and document was sent. issues[] names
            each one by path (/expected_version, /<field>).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowError'
        '401':
          description: >-
            MISSING_KEY, INVALID_KEY or EXPIRED_KEY - the key was not accepted.
            A valid key without the scope this operation needs is 403
            INSUFFICIENT_SCOPE, naming the scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >
            WORKSPACE_MISMATCH — `x-company-id` named a workspace other than the
            one this API key belongs to.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Agent missing, archived or outside the current company.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            WORKFLOW_CONFLICT; the saved version changed and nothing was
            written. A refused save never persists, so the draft is exactly what
            it was before the request. The answer names the draft's version as
            current_version, beside issues[0].path /expected_version; when it
            equals the version sent, something the draft pins changed instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: >-
            WORKFLOW_TOO_LARGE; request or stored document exceeds its technical
            byte budget.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            RESERVED_BINDING_ID - a binding id of the reserved shapes t_<hex> or
            o_<letters and digits> that no tool for every step and no step's own
            settings owns (issues[].path /bindings/<n>/id): those ids are kept
            for Tools & integrations, rename it. WORKFLOW_DOCUMENT_INVALID -
            document is missing or not an object (issues[].path /document),
            breaks a storage rule (/schema_version, /bindings), has a step kind
            the schema does not have (node_type_unknown) or a step without a
            member its kind requires (field_required), changes the server-owned
            id or name (server_owned, /id or /name), or fixes a calendar on an
            agent-wide action whose managed tool was set up before it could take
            one (config_input_needs_update at /bindings/<n>/inputs/<field>: POST
            /tool-connections/{id}/actions/prepare that action, or set it with
            PATCH /agents/{id}/integrations/{integration_id}); a reference
            problem on a binding (reference_is_tool_id, reference_unavailable,
            reference_invalid, tool_archived, connection_unavailable at
            /bindings/<n>/tool_revision_id) is named in the same answer.
            WORKFLOW_REFERENCE_INVALID - a binding names a tool revision this
            workspace cannot use; issues[] has one entry per binding it could
            pin, path /bindings/<n>/tool_revision_id, and says when the value is
            a tool id sent where its revision belongs (reference_is_tool_id,
            naming the revision to send), when the tool is archived
            (tool_archived) or when an app tool's account is no longer connected
            (connection_unavailable); those two carry node_id, label and
            tool_name, and say to restore the tool (or reconnect the account) or
            remove the step. Anything it cannot pin is one issue at /bindings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowError'
        '503':
          description: Authoring storage unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    WorkflowSave:
      type: object
      additionalProperties: false
      required:
        - expected_version
        - document
      properties:
        expected_version:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 9007199254740991
          description: >-
            Exact saved draft version. Null is accepted only when no draft
            exists; New Agent already creates version1.
        document:
          $ref: '#/components/schemas/WorkflowDocument'
    WorkflowState:
      type: object
      required:
        - agent_id
        - execution_version
        - draft
        - published
      properties:
        agent_id:
          type: string
          format: uuid
        execution_version:
          type: string
          enum:
            - legacy
            - workflow_v1
          readOnly: true
        draft:
          oneOf:
            - type: 'null'
            - type: object
              required:
                - version
                - document
                - updated_at
              properties:
                version:
                  type: integer
                  minimum: 1
                document:
                  $ref: '#/components/schemas/WorkflowDocument'
                updated_at:
                  type: string
                  format: date-time
        published:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/WorkflowRevisionSummary'
    WorkflowError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          required:
            - code
          properties:
            error:
              type: string
            code:
              type: string
            warnings:
              type: array
              description: >
                On WORKFLOW_VALIDATION_FAILED from Check or publish, the
                advisories beside the issues, in the shape of
                WorkflowValidation's warnings - strict_off_guidance when
                strict_mode is off, and every advisory about a binding or an
                input. The compiler's own graph advisories
                (during_output_advisory, sequence_branch_advisory,
                before_reference_missing_fallback, override_needs_strict,
                after_ending_coverage, after_any_end_waits,
                before_budget_inbound) arrive once the document compiles.
              items:
                type: object
                required:
                  - code
                  - message
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  path:
                    type: string
                    maxLength: 1000
                  node_id:
                    type: string
                    maxLength: 64
                  label:
                    type: string
                    maxLength: 200
                    description: The step's label. Present only with node_id.
                  tool_name:
                    type: string
                    maxLength: 200
                  field:
                    type: string
                    maxLength: 200
            issues:
              type: array
              maxItems: 100
              items:
                type: object
                required:
                  - code
                  - path
                  - message
                properties:
                  code:
                    type: string
                    maxLength: 100
                  path:
                    type: string
                    maxLength: 1000
                  message:
                    type: string
                    maxLength: 2000
                  node_id:
                    type: string
                    maxLength: 64
                    description: >-
                      The step the issue belongs to - a conversation step, a
                      before-call step, a follow-up or a step inside a sequence,
                      by its `id`. An issue about a binding names the first step
                      that runs or offers it; absent only when no single step is
                      concerned (a binding no step uses, a schema).
                  label:
                    type: string
                    maxLength: 200
                    description: >-
                      That step's label, as the workflow document spells it - on
                      every code. Present only with `node_id`.
                  tool_name:
                    type: string
                    maxLength: 200
                    description: >-
                      On an issue about a binding, the name of the tool it runs.
                      `label` is never the tool's name.
                  field:
                    type: string
                    maxLength: 200
                    description: >-
                      On an issue about one input of a binding
                      (`/bindings/{n}/inputs/{field}`), that input's name.
    Error:
      type: object
      required:
        - error
        - code
      description: >
        Every error response - the secret-key API and the browser data plane
        alike - carries a

        human-readable `error` and a stable machine `code`, and a refusal that
        names what is

        wrong with the request carries `issues[]` too. Branch on `code`, never
        on the `error`

        text. A refusal that names nothing more specific carries the code its
        status means:

        `BAD_REQUEST` (400), `UNAUTHORIZED` (401, the browser data plane; the
        secret-key API

        answers `MISSING_KEY`, `INVALID_KEY` or `EXPIRED_KEY`), `BILLING_ERROR`
        (402),

        `FORBIDDEN` (403), `NOT_FOUND` (404), `METHOD_NOT_ALLOWED` (405),
        `CONFLICT` (409),

        `GONE` (410), `PAYLOAD_TOO_LARGE` (413), `UNSUPPORTED_MEDIA_TYPE` (415),

        `UNPROCESSABLE_REQUEST` (422), `RATE_LIMIT` (429), `INTERNAL_ERROR`
        (500),

        `UPSTREAM_ERROR` (502), `SERVICE_UNAVAILABLE` (503), `UPSTREAM_TIMEOUT`
        (504). Some

        refusals add members of their own beside these (a call request's
        `status`, a workflow's

        `current_version`); the operation says which.
      properties:
        error:
          type: string
          description: The refusal, in one sentence for a person. Its wording may change.
        code:
          type: string
          description: The stable code to branch on.
        issues:
          type: array
          description: >
            Each thing at fault, on a 400 or 422 that names them: every query
            parameter or body field, not just the first. `path` is the
            parameter's name or the field's location.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                description: >-
                  query_param_unknown, query_param_repeated, query_param_blank,
                  query_param_invalid, field_unknown, field_required,
                  field_invalid, or the route's own word.
              path:
                type: string
              message:
                type: string
    WorkflowDocument:
      additionalProperties: false
      properties:
        schema_version:
          const: '1'
          default: '1'
          title: Schema Version
          type: string
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        name:
          maxLength: 200
          minLength: 1
          title: Name
          type: string
        strict_mode:
          default: false
          title: Strict Mode
          type: boolean
        global_instructions:
          default: ''
          description: >-
            Prose may read a Before-call step's output as
            {{before.<step_id>.<dotted.path>}}, optionally ending with |text
            used when the value is missing. The publisher validates the step and
            the path; the value is substituted once, at session start. {{option
            one|option two}} - two or more plain-text options separated by |,
            the first not starting with before. or call. - is a random
            variation: one option is said, picked once per call.
          maxLength: 100000
          title: Global Instructions
          type: string
        channels:
          items:
            enum:
              - phone
              - web
            type: string
          minItems: 1
          title: Channels
          type: array
        request_schema:
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1JsonValue'
          title: Request Schema
          type: object
        stored_schema:
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1JsonValue'
          title: Stored Schema
          type: object
        bindings:
          items:
            $ref: '#/components/schemas/WorkflowV1ToolBinding'
          maxItems: 512
          title: Bindings
          type: array
        before:
          $ref: '#/components/schemas/WorkflowV1BeforePhase'
        conversation:
          $ref: '#/components/schemas/WorkflowV1ConversationGraph'
        after:
          items:
            $ref: '#/components/schemas/WorkflowV1AfterTrigger'
          maxItems: 64
          title: After
          type: array
        sequences:
          items:
            $ref: '#/components/schemas/WorkflowV1ToolSequence'
          maxItems: 64
          title: Sequences
          type: array
        editor:
          $ref: '#/components/schemas/WorkflowV1EditorMetadata'
        integrations:
          description: >-
            Tools & integrations this agent may use on every step: connected
            apps (one entry per connected account, at most 8) and saved webhooks
            or call transfers (one entry per tool, at most 8). Each action names
            a binding in bindings; the save path offers every one of them on
            every conversation step. Manage them with /agents/{id}/integrations
            rather than by hand.
          items:
            anyOf:
              - $ref: '#/components/schemas/WorkflowV1IntegrationGrant'
              - $ref: '#/components/schemas/WorkflowV1ToolGrant'
          maxItems: 16
          title: Integrations
          type: array
      required:
        - id
        - name
        - conversation
      title: WorkflowDefinition
      type: object
    WorkflowRevisionSummary:
      type: object
      required:
        - id
        - version
        - content_hash
        - published_at
      properties:
        id:
          type: string
          format: uuid
        version:
          type: integer
          minimum: 1
        content_hash:
          type: string
          pattern: ^[a-f0-9]{64}$
        published_at:
          type: string
          format: date-time
        environment:
          type: string
          enum:
            - local
            - testing
            - production
          readOnly: true
          description: >
            The deployment plane that compiled and stored this revision. Decided
            by the deployment, never sent by the caller; the hosted API stores
            as testing. A call loads only a version stored on the plane it runs
            on, and publishing and calling through the same API are the same
            plane. See the List workflow versions page.
    WorkflowV1JsonValue:
      anyOf:
        - type: 'null'
        - type: boolean
        - type: number
        - type: string
        - type: array
          items:
            $ref: '#/components/schemas/WorkflowV1JsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1JsonValue'
    WorkflowV1ToolBinding:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        tool_revision_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Tool Revision Id
          type: string
        tool_revision_policy:
          default: follow_current
          enum:
            - follow_current
            - pinned
          title: Tool Revision Policy
          type: string
        inputs:
          additionalProperties:
            discriminator:
              mapping:
                artifact: '#/$defs/ArtifactSource'
                extract: '#/$defs/ExtractSource'
                literal: '#/$defs/LiteralSource'
                model: '#/$defs/ModelSource'
                request: '#/$defs/ContextSource'
                sequence: '#/$defs/ContextSource'
                step: '#/$defs/StepSource'
                stored: '#/$defs/ContextSource'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/WorkflowV1LiteralSource'
              - $ref: '#/components/schemas/WorkflowV1ModelSource'
              - $ref: '#/components/schemas/WorkflowV1ContextSource'
              - $ref: '#/components/schemas/WorkflowV1StepSource'
              - $ref: '#/components/schemas/WorkflowV1ArtifactSource'
              - $ref: '#/components/schemas/WorkflowV1ExtractSource'
          title: Inputs
          type: object
      required:
        - id
        - tool_revision_id
      title: ToolBinding
      type: object
    WorkflowV1BeforePhase:
      additionalProperties: false
      properties:
        steps:
          items:
            $ref: '#/components/schemas/WorkflowV1SequenceStep'
          maxItems: 256
          title: Steps
          type: array
        on_failure:
          default: stop_admission
          enum:
            - stop_admission
            - continue_with_available
          title: On Failure
          type: string
      title: BeforePhase
      type: object
    WorkflowV1ConversationGraph:
      additionalProperties: false
      properties:
        entry_node_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Entry Node Id
          type: string
        nodes:
          items:
            discriminator:
              mapping:
                action: '#/$defs/ActionNode'
                conversation: '#/$defs/ConversationNode'
                end: '#/$defs/EndNode'
                sequence: '#/$defs/SequenceNode'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/WorkflowV1ConversationNode'
              - $ref: '#/components/schemas/WorkflowV1ActionNode'
              - $ref: '#/components/schemas/WorkflowV1SequenceNode'
              - $ref: '#/components/schemas/WorkflowV1EndNode'
          maxItems: 256
          minItems: 1
          title: Nodes
          type: array
        edges:
          items:
            discriminator:
              mapping:
                conversation: '#/$defs/ConversationEdge'
                result: '#/$defs/ResultEdge'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/WorkflowV1ConversationEdge'
              - $ref: '#/components/schemas/WorkflowV1ResultEdge'
          maxItems: 1024
          title: Edges
          type: array
        global_edges:
          items:
            $ref: '#/components/schemas/WorkflowV1GlobalEdge'
          maxItems: 128
          title: Global Edges
          type: array
      required:
        - entry_node_id
        - nodes
      title: ConversationGraph
      type: object
    WorkflowV1AfterTrigger:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        event:
          enum:
            - call.answered
            - call.ended
            - call.failed
            - call.no_answer
            - ai_session.ended
            - transfer.accepted
            - transfer.answered
            - transfer.failed
            - transcript.ready
            - analysis.ready
            - recording.ready
            - lead.ready
            - billing.ready
            - any_end
            - request.failed
          title: Event
          type: string
        steps:
          items:
            $ref: '#/components/schemas/WorkflowV1SequenceStep'
          maxItems: 256
          title: Steps
          type: array
        when:
          anyOf:
            - discriminator:
                mapping:
                  all_of: '#/$defs/AllOf'
                  any_of: '#/$defs/AnyOf'
                  compare: '#/$defs/Comparison'
                  not: '#/$defs/NotCondition'
                propertyName: kind
              oneOf:
                - $ref: '#/components/schemas/WorkflowV1Comparison'
                - $ref: '#/components/schemas/WorkflowV1AllOf'
                - $ref: '#/components/schemas/WorkflowV1AnyOf'
                - $ref: '#/components/schemas/WorkflowV1NotCondition'
            - type: 'null'
          default: null
          description: >-
            Optional. An "Only if" on this follow-up: the steps run only when
            the condition holds for the call. Reads the call itself ({"kind":
            "call", "path": "/status"}) and fixed values, and only the facts
            this trigger's event guarantees: how the call ended (result, who
            ended it, duration) on an ending, the disposition and collected
            fields on analysis.ready, direction and channel on any event. When
            it does not hold, every step is recorded as skipped (guard_false)
            and the follow-up counts as done.
          title: When
      required:
        - id
        - event
      title: AfterTrigger
      type: object
    WorkflowV1ToolSequence:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        name:
          maxLength: 200
          minLength: 1
          title: Name
          type: string
        description:
          default: ''
          maxLength: 10000
          title: Description
          type: string
        input_schema:
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1JsonValue'
          title: Input Schema
          type: object
        output_schema:
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1JsonValue'
          title: Output Schema
          type: object
        output_mapping:
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1StepSource'
          title: Output Mapping
          type: object
        steps:
          items:
            $ref: '#/components/schemas/WorkflowV1SequenceStep'
          maxItems: 128
          minItems: 1
          title: Steps
          type: array
      required:
        - id
        - name
        - steps
      title: ToolSequence
      type: object
    WorkflowV1EditorMetadata:
      additionalProperties: false
      properties:
        positions:
          additionalProperties:
            $ref: '#/components/schemas/WorkflowV1Position'
          title: Positions
          type: object
      title: EditorMetadata
      type: object
    WorkflowV1IntegrationGrant:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        connection_id:
          pattern: ^[a-f0-9-]{36}$
          title: Connection Id
          type: string
        app:
          pattern: ^[a-z0-9_]{1,100}$
          title: App
          type: string
        actions:
          items:
            $ref: '#/components/schemas/WorkflowV1IntegrationAction'
          maxItems: 24
          minItems: 1
          title: Actions
          type: array
      required:
        - id
        - connection_id
        - app
        - actions
      title: IntegrationGrant
      type: object
    WorkflowV1ToolGrant:
      additionalProperties: false
      description: >-
        A saved webhook or call transfer the agent may use on every conversation
        step.


        Lives in the same `integrations` list as the app grants (the two shapes

        share no member, so the list stays unambiguous). `binding_id` names one

        binding in `bindings` that runs `tool_id`; the save path offers it on
        every

        conversation step, as it does an app grant's actions.
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        tool_id:
          pattern: ^[a-f0-9-]{36}$
          title: Tool Id
          type: string
        binding_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Binding Id
          type: string
      required:
        - id
        - tool_id
        - binding_id
      title: ToolGrant
      type: object
    WorkflowV1LiteralSource:
      additionalProperties: false
      properties:
        kind:
          const: literal
          title: Kind
          type: string
        value:
          $ref: '#/components/schemas/WorkflowV1JsonValue'
      required:
        - kind
        - value
      title: LiteralSource
      type: object
    WorkflowV1ModelSource:
      additionalProperties: false
      properties:
        kind:
          const: model
          title: Kind
          type: string
        path:
          pattern: ^/[^/]+$
          title: Path
          type: string
        options:
          anyOf:
            - items:
                $ref: '#/components/schemas/WorkflowV1ModelOption'
              maxItems: 20
              minItems: 1
              type: array
            - type: 'null'
          default: null
          description: >-
            Optional. The values the agent may choose from for this input, each
            with the label it reads. Only on a During-call binding; string
            values only.
          title: Options
      required:
        - kind
        - path
      title: ModelSource
      type: object
    WorkflowV1ContextSource:
      additionalProperties: false
      properties:
        kind:
          enum:
            - request
            - stored
            - sequence
          title: Kind
          type: string
        path:
          pattern: ^(|/.*)$
          title: Path
          type: string
        fallback:
          anyOf:
            - $ref: '#/components/schemas/WorkflowV1Fallback'
            - type: 'null'
          default: null
      required:
        - kind
        - path
      title: ContextSource
      type: object
    WorkflowV1StepSource:
      additionalProperties: false
      properties:
        kind:
          const: step
          title: Kind
          type: string
        scope:
          default: local
          enum:
            - local
            - before
            - during
          title: Scope
          type: string
        step_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Step Id
          type: string
        path:
          pattern: ^(|/.*)$
          title: Path
          type: string
        fallback:
          anyOf:
            - $ref: '#/components/schemas/WorkflowV1Fallback'
            - type: 'null'
          default: null
      required:
        - kind
        - step_id
        - path
      title: StepSource
      type: object
    WorkflowV1ArtifactSource:
      additionalProperties: false
      properties:
        kind:
          const: artifact
          title: Kind
          type: string
        artifact:
          enum:
            - transcript
            - analysis
            - recording
            - lead
            - billing
          title: Artifact
          type: string
        path:
          pattern: ^(|/.*)$
          title: Path
          type: string
        fallback:
          anyOf:
            - $ref: '#/components/schemas/WorkflowV1Fallback'
            - type: 'null'
          default: null
      required:
        - kind
        - artifact
        - path
      title: ArtifactSource
      type: object
    WorkflowV1ExtractSource:
      additionalProperties: false
      properties:
        kind:
          const: extract
          title: Kind
          type: string
        instruction:
          description: >-
            A value the finished call is asked for by description, such as "the
            time slot the caller agreed to". Only on an After-call step. `type`
            is worked out from the tool input when left out. When the call does
            not say it: `fallback` is used, else `on_missing` decides - "skip"
            skips the step (the default for a required input), "fail" fails it.
            `fallback` and `on_missing` are not written together. Never sent as
            a guess.
          maxLength: 500
          minLength: 1
          title: Instruction
          type: string
        type:
          anyOf:
            - enum:
                - text
                - number
                - yes_no
                - date
                - datetime
              type: string
            - type: 'null'
          default: null
          title: Type
        on_missing:
          anyOf:
            - enum:
                - skip
                - fail
              type: string
            - type: 'null'
          default: null
          title: On Missing
        fallback:
          anyOf:
            - $ref: '#/components/schemas/WorkflowV1Fallback'
            - type: 'null'
          default: null
      required:
        - kind
        - instruction
      title: ExtractSource
      type: object
    WorkflowV1SequenceStep:
      additionalProperties: false
      description: >-
        A step that may carry a guard and route its outcome.


        Sequence children use all three members. Before and After steps are the
        same

        shape so that a before-call step can route to `#decline`, and the
        publisher

        refuses every other use of them outside a sequence with its own code —
        the

        model is wide enough to state the mistake, not wide enough to run it.
        The

        serializer drops the three members whenever they hold their v1 default,
        so a

        step that declares no branching compiles and hashes to exactly the bytes
        it

        did before they existed.
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        label:
          maxLength: 200
          minLength: 1
          title: Label
          type: string
        binding_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Binding Id
          type: string
        depends_on:
          items:
            pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
            type: string
          maxItems: 256
          title: Depends On
          type: array
        requires:
          items:
            enum:
              - transcript
              - analysis
              - recording
              - lead
              - billing
            type: string
          title: Requires
          type: array
        on_failure:
          default: stop
          enum:
            - stop
            - continue
          title: On Failure
          type: string
        when:
          anyOf:
            - discriminator:
                mapping:
                  all_of: '#/$defs/AllOf'
                  any_of: '#/$defs/AnyOf'
                  compare: '#/$defs/Comparison'
                  not: '#/$defs/NotCondition'
                propertyName: kind
              oneOf:
                - $ref: '#/components/schemas/WorkflowV1Comparison'
                - $ref: '#/components/schemas/WorkflowV1AllOf'
                - $ref: '#/components/schemas/WorkflowV1AnyOf'
                - $ref: '#/components/schemas/WorkflowV1NotCondition'
            - type: 'null'
          default: null
          title: When
        on_succeeded:
          anyOf:
            - pattern: ^(#end|#decline|[A-Za-z0-9][A-Za-z0-9_-]{0,63})$
              type: string
            - type: 'null'
          default: null
          title: On Succeeded
        on_failed:
          anyOf:
            - pattern: ^(#end|#decline|[A-Za-z0-9][A-Za-z0-9_-]{0,63})$
              type: string
            - type: 'null'
          default: null
          title: On Failed
      required:
        - id
        - label
        - binding_id
      title: SequenceStep
      type: object
    WorkflowV1ConversationNode:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        label:
          maxLength: 200
          minLength: 1
          title: Label
          type: string
        type:
          const: conversation
          title: Type
          type: string
        instructions:
          description: >-
            Prose may read a Before-call step's output as
            {{before.<step_id>.<dotted.path>}}, optionally ending with |text
            used when the value is missing. The publisher validates the step and
            the path; the value is substituted once, at session start. {{option
            one|option two}} - two or more plain-text options separated by |,
            the first not starting with before. or call. - is a random
            variation: one option is said, picked once per call.
          maxLength: 100000
          title: Instructions
          type: string
        available_binding_ids:
          items:
            pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
            type: string
          maxItems: 128
          title: Available Binding Ids
          type: array
        binding_overrides:
          anyOf:
            - additionalProperties:
                pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
                type: string
              propertyNames:
                pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
              type: object
            - type: 'null'
          default: null
          description: >-
            Optional. This step's own settings for an action the whole agent
            has: maps the binding id an integration (or a tool for every step)
            owns to a binding of this document that runs the same tool with this
            step's inputs.
          title: Binding Overrides
      required:
        - id
        - label
        - type
        - instructions
      title: ConversationNode
      type: object
    WorkflowV1ActionNode:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        label:
          maxLength: 200
          minLength: 1
          title: Label
          type: string
        type:
          const: action
          title: Type
          type: string
        binding_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Binding Id
          type: string
        hold_line:
          anyOf:
            - maxLength: 28
              minLength: 1
              type: string
            - type: 'null'
          default: null
          description: >-
            A short fixed sentence the caller hears while this step's tool runs,
            such as "One moment please." It starts when the tool starts, in the
            agent's voice, and the agent's next words wait until it has been
            said. At most about 2.5 seconds of speech: up to 28 characters,
            about 25 in Hebrew or Arabic, fewer in Chinese, Japanese or Korean,
            and a digit counts as about three. Fixed text: no {{...}}
            references. Not on a transfer step, which has its own announcement.
          title: Hold Line
      required:
        - id
        - label
        - type
        - binding_id
      title: ActionNode
      type: object
    WorkflowV1SequenceNode:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        label:
          maxLength: 200
          minLength: 1
          title: Label
          type: string
        type:
          const: sequence
          title: Type
          type: string
        sequence_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Sequence Id
          type: string
      required:
        - id
        - label
        - type
        - sequence_id
      title: SequenceNode
      type: object
    WorkflowV1EndNode:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        label:
          maxLength: 200
          minLength: 1
          title: Label
          type: string
        type:
          const: end
          title: Type
          type: string
      required:
        - id
        - label
        - type
      title: EndNode
      type: object
    WorkflowV1ConversationEdge:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        source:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Source
          type: string
        target:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Target
          type: string
        kind:
          const: conversation
          title: Kind
          type: string
        condition:
          maxLength: 10000
          minLength: 1
          title: Condition
          type: string
      required:
        - id
        - source
        - target
        - kind
        - condition
      title: ConversationEdge
      type: object
    WorkflowV1ResultEdge:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        source:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Source
          type: string
        target:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Target
          type: string
        kind:
          const: result
          title: Kind
          type: string
        outcome:
          enum:
            - succeeded
            - failed
          title: Outcome
          type: string
        when:
          anyOf:
            - discriminator:
                mapping:
                  all_of: '#/$defs/AllOf'
                  any_of: '#/$defs/AnyOf'
                  compare: '#/$defs/Comparison'
                  not: '#/$defs/NotCondition'
                propertyName: kind
              oneOf:
                - $ref: '#/components/schemas/WorkflowV1Comparison'
                - $ref: '#/components/schemas/WorkflowV1AllOf'
                - $ref: '#/components/schemas/WorkflowV1AnyOf'
                - $ref: '#/components/schemas/WorkflowV1NotCondition'
            - type: 'null'
          default: null
          description: >-
            Optional, and only on a `succeeded` route in Strict mode. The route
            is taken only when this condition holds for what the step's tool
            answered: it reads fixed values and that step's own answer ({"kind":
            "step", "scope": "during", "step_id": <this edge's source>, "path":
            "/status"}). A step's guarded routes are tried in the order they are
            written; the one `succeeded` route with no condition is taken when
            none of them holds, so a step that has guarded routes must have
            exactly one. A `failed` route never has a condition.
          title: When
      required:
        - id
        - source
        - target
        - kind
        - outcome
      title: ResultEdge
      type: object
    WorkflowV1GlobalEdge:
      additionalProperties: false
      properties:
        id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Id
          type: string
        target:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Target
          type: string
        condition:
          maxLength: 10000
          minLength: 1
          title: Condition
          type: string
      required:
        - id
        - target
        - condition
      title: GlobalEdge
      type: object
    WorkflowV1Comparison:
      additionalProperties: false
      description: |-
        One declarative comparison. `value` is itself a source, so an absent
        right-hand side stays distinguishable from an explicit JSON null.
      properties:
        kind:
          const: compare
          title: Kind
          type: string
        source:
          discriminator:
            mapping:
              call: '#/$defs/CallSource'
              literal: '#/$defs/LiteralSource'
              request: '#/$defs/ContextSource'
              sequence: '#/$defs/ContextSource'
              step: '#/$defs/StepSource'
              stored: '#/$defs/ContextSource'
            propertyName: kind
          oneOf:
            - $ref: '#/components/schemas/WorkflowV1LiteralSource'
            - $ref: '#/components/schemas/WorkflowV1ContextSource'
            - $ref: '#/components/schemas/WorkflowV1StepSource'
            - $ref: '#/components/schemas/WorkflowV1CallSource'
          title: Source
        op:
          enum:
            - exists
            - not_exists
            - eq
            - neq
            - gt
            - gte
            - lt
            - lte
            - contains
            - not_contains
            - in
            - not_in
            - is_true
            - is_false
            - is_empty
            - is_not_empty
          title: Op
          type: string
        value:
          anyOf:
            - discriminator:
                mapping:
                  call: '#/$defs/CallSource'
                  literal: '#/$defs/LiteralSource'
                  request: '#/$defs/ContextSource'
                  sequence: '#/$defs/ContextSource'
                  step: '#/$defs/StepSource'
                  stored: '#/$defs/ContextSource'
                propertyName: kind
              oneOf:
                - $ref: '#/components/schemas/WorkflowV1LiteralSource'
                - $ref: '#/components/schemas/WorkflowV1ContextSource'
                - $ref: '#/components/schemas/WorkflowV1StepSource'
                - $ref: '#/components/schemas/WorkflowV1CallSource'
            - type: 'null'
          default: null
          title: Value
      required:
        - kind
        - source
        - op
      title: Comparison
      type: object
    WorkflowV1AllOf:
      additionalProperties: false
      properties:
        kind:
          const: all_of
          title: Kind
          type: string
        conditions:
          items:
            discriminator:
              mapping:
                all_of: '#/$defs/AllOf'
                any_of: '#/$defs/AnyOf'
                compare: '#/$defs/Comparison'
                not: '#/$defs/NotCondition'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/WorkflowV1Comparison'
              - $ref: '#/components/schemas/WorkflowV1AllOf'
              - $ref: '#/components/schemas/WorkflowV1AnyOf'
              - $ref: '#/components/schemas/WorkflowV1NotCondition'
          maxItems: 16
          minItems: 1
          title: Conditions
          type: array
      required:
        - kind
        - conditions
      title: AllOf
      type: object
    WorkflowV1AnyOf:
      additionalProperties: false
      properties:
        kind:
          const: any_of
          title: Kind
          type: string
        conditions:
          items:
            discriminator:
              mapping:
                all_of: '#/$defs/AllOf'
                any_of: '#/$defs/AnyOf'
                compare: '#/$defs/Comparison'
                not: '#/$defs/NotCondition'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/WorkflowV1Comparison'
              - $ref: '#/components/schemas/WorkflowV1AllOf'
              - $ref: '#/components/schemas/WorkflowV1AnyOf'
              - $ref: '#/components/schemas/WorkflowV1NotCondition'
          maxItems: 16
          minItems: 1
          title: Conditions
          type: array
      required:
        - kind
        - conditions
      title: AnyOf
      type: object
    WorkflowV1NotCondition:
      additionalProperties: false
      properties:
        kind:
          const: not
          title: Kind
          type: string
        condition:
          discriminator:
            mapping:
              all_of: '#/$defs/AllOf'
              any_of: '#/$defs/AnyOf'
              compare: '#/$defs/Comparison'
              not: '#/$defs/NotCondition'
            propertyName: kind
          oneOf:
            - $ref: '#/components/schemas/WorkflowV1Comparison'
            - $ref: '#/components/schemas/WorkflowV1AllOf'
            - $ref: '#/components/schemas/WorkflowV1AnyOf'
            - $ref: '#/components/schemas/WorkflowV1NotCondition'
          title: Condition
      required:
        - kind
        - condition
      title: NotCondition
      type: object
    WorkflowV1Position:
      additionalProperties: false
      properties:
        x:
          title: X
          type: number
        'y':
          title: 'Y'
          type: number
      required:
        - x
        - 'y'
      title: Position
      type: object
    WorkflowV1IntegrationAction:
      additionalProperties: false
      properties:
        action:
          pattern: ^[A-Z0-9_]{1,200}$
          title: Action
          type: string
        binding_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$
          title: Binding Id
          type: string
      required:
        - action
        - binding_id
      title: IntegrationAction
      type: object
    WorkflowV1ModelOption:
      additionalProperties: false
      properties:
        value:
          maxLength: 500
          minLength: 1
          title: Value
          type: string
        label:
          maxLength: 120
          minLength: 1
          title: Label
          type: string
      required:
        - value
        - label
      title: ModelOption
      type: object
    WorkflowV1Fallback:
      additionalProperties: false
      properties:
        value:
          $ref: '#/components/schemas/WorkflowV1JsonValue'
      required:
        - value
      title: Fallback
      type: object
    WorkflowV1CallSource:
      additionalProperties: false
      description: >-
        A fact the platform recorded about the call itself, in the call
        package's

        own names (`/status`, `/ended_by`, `/disposition/id`, ...).


        Read-only and only for a follow-up's "Only if": a trigger filter may
        read

        the call facts its event guarantees (`trigger_filter.py`), and the

        publisher refuses it anywhere else.
      properties:
        kind:
          const: call
          title: Kind
          type: string
        path:
          maxLength: 300
          pattern: ^/.+$
          title: Path
          type: string
      required:
        - kind
        - path
      title: CallSource
      type: object
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Your Yappr API key (e.g. `ypr_live_...`). Generate one in the dashboard
        under **Settings → API Keys**. No key is `401 MISSING_KEY`; a key that
        is not one of ours, or is revoked, is `401 INVALID_KEY`; an expired one
        is `401 EXPIRED_KEY`. A valid key without the scope an operation needs
        is `403 INSUFFICIENT_SCOPE` on every operation, and the message names
        the scope. Every response, a 401 included, carries X-RateLimit-Limit,
        X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a
        minute per API key. Every 429, whatever its code, carries Retry-After
        (whole seconds, never zero): the per-key budget's `RATE_LIMIT` asks for
        what is left of the minute, a route's daily cap (`RATE_LIMITED`) for the
        time until that cap resets. All four headers are listed in
        Access-Control-Expose-Headers, so a browser can read them. A path the
        API does not serve (an unknown sub-path, an id left empty) is `404
        ROUTE_NOT_FOUND`, and a method a served path does not take is `405
        METHOD_NOT_ALLOWED` with an `Allow` header; both are answered before any
        scope check, and nothing is read or changed. A trailing slash is ignored
        where it cannot be an id left empty (`POST /calls/` is `POST /calls`)
        and refused where it can (`GET /calls/`). A doubled slash inside a path
        is merged into one before the request reaches the API (`GET //calls` is
        `GET /calls`).

````

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