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

# Retrieve the workflow catalog

> **Available for AI agents only.**

Lists what an AI agent's workflows can be built from on the project's plan: the trigger events, the actions and whether the plan includes them, the conditions branch steps can test, waits, and the limits on one workflow. It also shows how many workflows and runs the plan allows.



## OpenAPI

````yaml /api-reference/v3/openapi.json get /workflows/catalog
openapi: 3.1.0
info:
  title: Chatling API
  version: 3.0.0-draft
  summary: Manage Chatling AI agents and chatbots with an API key.
  description: >
    Internal draft, not published yet. It documents every endpoint in
    `routes/api_public_v3.php`, and
    `tests/Feature/PublicApiV3/OpenApiSpecTest.php` fails if this file and the
    routes differ.


    ## Authentication


    The Chatling API uses API keys to authenticate requests. Create and manage
    keys in the dashboard under Project settings > API keys. Each key belongs to
    one project, and the project's plan must include API access.


    Send the key in the `Authorization` header as a bearer token:
    `Authorization: Bearer <key>`.


    ## Key restrictions


    You can restrict a key in three ways when you create it in the dashboard:


    - **Permissions:** Read and write (the default), read only, or custom.
    Custom permissions grant create, read, update, and delete access for each
    permission group, and publish access for workflows, which makes a workflow
    run on users' conversations. `GET` requests need read access, `POST` create,
    `PATCH` update, and `DELETE` delete, unless an endpoint says otherwise.

    - **Agent access:** All agents, or selected agents. A key limited to
    selected agents gets 404 for other agents, and can't use project-wide
    endpoints such as Create an AI agent.

    - **Expiry:** Requests with an expired key fail with 401 `api_key_expired`.


    ## Errors


    Chatling uses conventional HTTP response codes to indicate the success or
    failure of an API request. Codes in the 2xx range indicate success. Codes in
    the 4xx range indicate an error caused by the request, such as a missing
    parameter. Codes in the 5xx range indicate an error with Chatling's servers.


    Every error returns an `error` object:


    ```json

    {
      "error": {
        "type": "invalid_request_error",
        "code": "validation_failed",
        "message": "The name field is required.",
        "param": "name",
        "request_id": "req_8fK2mQ9xLp4TzR7vWc1Ns3Yb",
        "errors": [
          { "param": "name", "message": "The name field is required." },
          { "param": "color", "message": "The color must be a hex color such as #3B82F6." }
        ]
      }
    }

    ```


    | Field | Description |

    | --- | --- |

    | `type` | The type of error. One of the types listed below. |

    | `code` | A short string identifying the error, such as `validation_failed`
    or `conversation_ended`. Codes are stable, so handle errors by `code`. New
    codes may be added. |

    | `message` | A human-readable message with more details. The wording can
    change, so don't parse it. |

    | `param` | If the error is parameter-specific, the parameter related to the
    error, such as `name`. Nested fields and array items use dot notation, such
    as `variables.plan` or `member_ids.1` for the second item. `null` if no
    single parameter caused the error. |

    | `request_id` | The ID of the request, also returned in the `X-Request-Id`
    header. Include it when you contact support. |

    | `errors` | For `validation_failed` only: every invalid parameter, each
    with its own `param` and `message`. The top-level `param` and `message`
    match the first entry. |


    Every `code` is listed under Error codes below.


    | `type` | Status | Description |

    | --- | --- | --- |

    | `authentication_error` | 401 | No valid API key was provided. |

    | `permission_error` | 403 | The API key or the project's plan doesn't allow
    the request. |

    | `not_found_error` | 404, 410 | The resource doesn't exist, or the API key
    can't access it. |

    | `invalid_request_error` | 400, 405, 409, 413, 422 | The request has
    invalid parameters or conflicts with the resource's current state. |

    | `idempotency_error` | 409, 422 | An `Idempotency-Key` was reused for a
    different request, or its first request is still running. |

    | `rate_limit_error` | 429 | Too many requests hit the API too quickly.
    Retry after `Retry-After` seconds. |

    | `api_error` | 500, 503 | Something went wrong on Chatling's end. These are
    rare. |


    ## Agents


    Chatling has two kinds of agent: AI agents and flow-builder chatbots. Most
    endpoints work with both. Resources that belong to an agent, such as
    conversations, contacts, knowledge base sources, and labels, take either
    kind's ID as `agent_id`. Pass it in the query string when listing, and in
    the body when creating. It's required.


    Only the endpoints that manage the agent itself are separate: `/agents` for
    AI agents and `/chatbots` for chatbots. Using one kind's ID at the other's
    path returns 404, with a message pointing to the right path.


    Endpoints available for AI agents only, such as WhatsApp templates and
    variables, return 409 `unsupported_agent_type` for a chatbot.


    Endpoints for a single resource, such as `/conversations/{conversation}`,
    don't take `agent_id`. The resource's `agent` field has the agent's `id`,
    `type` (`ai_agent` or `chatbot`), and `name`.


    A chatbot's flow doesn't run through the API. When you send a chatbot a user
    message, it answers from its knowledge base using the AI settings in `ai`.


    ## Pagination


    Lists of members, agents, chatbots, conversations, messages, contacts,
    knowledge base sources, and analytics rankings return one page at a time:
    `{"object": "list", "data", "has_more", "next_cursor"}`. To fetch the next
    page, pass `next_cursor` as `cursor`, with the same filters. `limit` sets
    the page size, from 1 to 100. It defaults to 20 unless a list says
    otherwise, and can change between pages.


    Cursors are opaque and expire after 24 hours. They only work with the same
    list, filters, and project. Otherwise, the request fails with 422
    `invalid_cursor`.


    Pages follow the list's order, not an offset, so items that exist the whole
    time are returned exactly once, even if others are added or removed while
    you page. Items added while you page might be missed. Start again from the
    first page to include them.


    Analytics rankings, such as List countries, page by rank instead. Keep the
    same `limit` on every page. If the data refreshes while you page, a row can
    move to another page.


    AI models, labels, teams, topics, and variables always return every item in
    one page.


    ## Rate limits


    Each API key can make 500 requests per minute. Every response includes the
    `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` (a
    Unix timestamp) headers. Requests over the limit fail with 429
    `rate_limit_exceeded` and a `Retry-After` header.


    ## Idempotent requests


    The API supports idempotency for safely retrying `POST` requests without
    performing the same operation twice. Send an `Idempotency-Key` header with a
    unique value of 1 to 255 printable ASCII characters, such as a V4 UUID.


    For 24 hours, retrying with the same key and the same request returns the
    saved response with an `Idempotent-Replayed: true` header, instead of
    running the request again. Reusing a key for a different request fails with
    422 `idempotency_key_reused`.


    Only successful responses are saved, so you can retry a failed request with
    the same key. The exception is `message_not_saved` from Send a WhatsApp
    template: the template was already delivered, so don't retry.


    ## Request IDs


    Each API request has a request ID, returned in the `X-Request-Id` header and
    in error responses. Include it when you contact support.


    ## Error codes


    Every `code` the API returns, grouped by `type`. New codes may be added, so
    handle unknown codes by their `type`.


    ### `authentication_error`


    No valid API key was provided.


    | Code | Status | Description |

    | --- | --- | --- |

    | `missing_api_key` | 401 | No API key was provided in the `Authorization`
    header. |

    | `invalid_api_key` | 401 | The API key doesn't exist or was revoked. |

    | `api_key_expired` | 401 | The API key has expired. |


    ### `permission_error`


    The API key or the project's plan doesn't allow the request.


    | Code | Status | Description |

    | --- | --- | --- |

    | `insufficient_permission` | 403 | The API key doesn't have permission to
    perform the request. |

    | `project_suspended` | 403 | The project is suspended or no longer exists.
    |

    | `plan_feature_unavailable` | 403 | The project's plan doesn't include this
    feature, such as API access, attachments, auto-sync, or a workflow action. |

    | `agent_limit_reached` | 403 | The plan's limit on AI agents and chatbots
    was reached. |

    | `agent_suspended` | 403 | The agent is suspended. It can't be updated,
    duplicated, or reply. |

    | `ai_credits_exhausted` | 403 | The project has no AI credits left, so the
    agent can't reply. |

    | `agent_credit_limit_reached` | 403 | The agent reached its AI credit
    limit. |

    | `user_blocked` | 403 | The user is blocked from messaging this agent. |

    | `knowledge_base_limit_reached` | 403 | The plan's knowledge base character
    limit was reached. |

    | `resync_credits_exhausted` | 403 | The project has no resync credits left.
    |

    | `invalid_attachment_url` | 403 | The attachment URL is invalid or expired.
    List the conversation's messages to get a new one. |


    ### `not_found_error`


    The resource doesn't exist, or the API key can't access it.


    | Code | Status | Description |

    | --- | --- | --- |

    | `resource_not_found` | 404 | The resource doesn't exist, or the API key
    can't access it. |

    | `route_not_found` | 404 | No endpoint matches the method and path. |

    | `attachment_unavailable` | 410 | The channel no longer has the file. |


    ### `invalid_request_error`


    The request has invalid parameters or conflicts with the resource's current
    state. Fix the request before retrying, except for `resource_busy` and
    `source_not_ready`, which you can retry unchanged later.


    | Code | Status | Description |

    | --- | --- | --- |

    | `invalid_json` | 400 | The request body isn't valid JSON. |

    | `invalid_idempotency_key` | 400 | The `Idempotency-Key` header isn't 1 to
    255 printable ASCII characters. |

    | `method_not_allowed` | 405 | The endpoint doesn't support this HTTP
    method. |

    | `request_too_large` | 413 | The request body is too large. |

    | `validation_failed` | 422 | One or more parameters are invalid. `errors`
    lists each one. |

    | `invalid_cursor` | 422 | The pagination cursor is invalid or expired.
    Start again from the first page. |

    | `resource_busy` | 409 | Another request for this project is still running.
    Retry shortly. |

    | `conversation_ended` | 409 | The conversation has ended and can't take new
    messages or attachments. |

    | `reply_window_closed` | 409 | The channel's reply window is closed, so
    team members can't reply. |

    | `wrong_channel` | 409 | The action is only available for conversations on
    the API channel. |

    | `contact_already_exists` | 409 | A contact with this email already exists.
    |

    | `message_not_rateable` | 409 | Only AI-written answers can be rated. |

    | `channel_not_connected` | 409 | The channel isn't connected to the agent.
    Connect it in the dashboard first. |

    | `unsupported_agent_type` | 409 | The endpoint is available for AI agents
    only, and the agent is a chatbot. |

    | `whatsapp_send_failed` | 409 | Meta didn't send the WhatsApp template.
    `message` includes Meta's reason. |

    | `system_variable_read_only` | 409 | System variables can't be updated or
    deleted. |

    | `workflow_not_published` | 409 | The workflow was never published, so it
    can't be turned on or off. Publish it in the dashboard first. |

    | `knowledge_base_linked` | 409 | The agent uses another agent's knowledge
    base and has no sources of its own. |

    | `source_already_exists` | 409 | The knowledge base already has a source
    with this URL. |

    | `source_not_ready` | 409 | The source is still training. Retry after it's
    processed or failed. |

    | `resync_already_queued` | 409 | The source is already queued for a resync.
    |

    | `resync_unavailable` | 409 | This type of source, such as a document,
    can't be resynced. |

    | `upload_already_used` | 409 | The upload was already added as a knowledge
    base source. |

    | `attachments_unavailable` | 409 | The conversation doesn't accept these
    attachments in its current mode. |

    | `too_many_pending_attachments` | 409 | Too many uploaded files are waiting
    to be sent. Send or delete some first. |

    | `unsupported_file_type` | 422 | The file type isn't supported. |

    | `file_too_large` | 422 | The file exceeds the size limit. |

    | `file_type_not_allowed` | 422 | The AI agent's attachment settings don't
    allow this file type. |

    | `invalid_image` | 422 | The image can't be read. |

    | `attachment_rejected` | 422 | The image violates the content policy. |

    | `too_many_attachments` | 422 | The message has more attachments than
    allowed. |

    | `attachment_not_found` | 422 | An attachment doesn't exist in this
    conversation, or was already sent. |

    | `attachment_not_allowed` | 422 | An attachment is no longer allowed in
    this conversation. |


    ### `idempotency_error`


    The `Idempotency-Key` can't be used for this request.


    | Code | Status | Description |

    | --- | --- | --- |

    | `idempotency_key_reused` | 422 | The key was already used for a different
    request. |

    | `idempotency_request_in_progress` | 409 | The first request with this key
    is still running. Retry shortly. |


    ### `rate_limit_error`


    Too many requests hit the API too quickly. Retry after `Retry-After`
    seconds.


    | Code | Status | Description |

    | --- | --- | --- |

    | `rate_limit_exceeded` | 429 | The API key's rate limit, or the agent's
    per-user message limit, was reached. |


    ### `api_error`


    Something went wrong on Chatling's end. Retry shortly.


    | Code | Status | Description |

    | --- | --- | --- |

    | `internal_error` | 500 | An unexpected error occurred. Include the
    `request_id` if you contact support. |

    | `service_unavailable` | 503 | The API is temporarily unavailable. |

    | `message_not_saved` | 503 | The team message couldn't be saved. If the
    request was Send a WhatsApp template, the template was already sent, so
    don't retry. |

    | `end_failed` | 503 | The conversation couldn't be ended. |

    | `upload_failed` | 503 | The file couldn't be stored. |

    | `delete_failed` | 503 | The attachment couldn't be deleted. |

    | `attachment_check_unavailable` | 503 | The image couldn't be checked
    against the content policy. |

    | `analytics_unavailable` | 503 | Analytics couldn't be loaded. |

    | `whatsapp_request_failed` | 503 | Meta couldn't be reached or rejected the
    request. |
servers:
  - url: https://api.chatling.ai/v3
security:
  - apiKey: []
tags:
  - name: API key
    description: The API key making the request.
  - name: Project
    description: >-
      The project the API key belongs to, and its usage against its plan,
      add-ons, and lifetime grants.


      Permission groups: `project` (read, update) and `usage` (read).
  - name: Members
    description: >-
      The project's team members and pending invites. Invite, change, and remove
      members in the dashboard. A member's `account_id` identifies them as a
      conversation assignee, a team member, and the author of replies and notes.


      Permission group: `members` (read).
  - name: AI models
    description: >-
      The AI models available to AI agents, and to chatbot replies sent through
      the API.


      Permission group: `agents`.
  - name: Agents
    description: >-
      AI agents and their settings, such as the business name, time zone, and AI
      settings like the model and instructions. Chatbots have their own
      endpoints under Chatbots.


      Permission group: `agents`.
  - name: Chatbots
    description: >-
      Flow-builder chatbots. You build and publish a chatbot's flow in the
      dashboard. The API can create, list, update, duplicate, and delete
      chatbots.


      Use a chatbot's `id` as `agent_id` in endpoints for resources that belong
      to it, such as conversations, contacts, and the knowledge base. Endpoints
      that only support AI agents say so.


      Permission group: `agents`.
  - name: Analytics
    description: >-
      An agent's analytics over a range of days, matching the dashboard's
      Analytics page: an overview with totals and daily series, and rankings of
      countries, channels, pages, topics, and busiest hours. Days are in UTC,
      and data refreshes every hour.


      Requires analytics on the plan. Topics and sentiment also require advanced
      analytics, and are only available for AI agents.


      Permission group: `analytics` (read).
  - name: Channels
    description: >-
      The WhatsApp, Instagram, Messenger, and Telegram accounts connected to an
      agent, and each channel's settings. Connect and disconnect channels in the
      dashboard. The website widget isn't listed because it doesn't need a
      connection.


      Chatbots built for WhatsApp can only use WhatsApp, and web chatbots have
      no channels.


      Permission group: `channels` (read, update).
  - name: WhatsApp
    description: >-
      Message templates of the WhatsApp account connected to an AI agent. Create
      and edit templates in the dashboard. Meta reviews each template before it
      can be sent.


      Permission group: `whatsapp`. Listing and retrieving templates requires
      read access, sending requires create, refreshing requires update, and
      deleting requires delete.
  - name: Conversations
    description: >-
      Conversations with AI agents and chatbots on every channel. Use these
      endpoints to chat with an agent as a user over the API channel, and to
      handle live chat as the team: send replies and internal notes, hand
      conversations over, assign them, and end them. Playground tests are
      included with `channel: playground`.


      Permission group: `conversations`. Read covers conversations, messages,
      and usage. Create covers starting conversations, sending messages,
      replies, and notes, and uploading attachments. Update covers changing and
      ending conversations. Delete covers deleting conversations and unsent
      attachments.
  - name: Contacts
    description: >-
      The people an agent has details for, such as a name and email, collected
      in conversations or added through the API. Each contact belongs to one
      agent. To link a contact to a new conversation, pass `contact_id` to
      [Start a
      conversation](/api-reference/v3/conversations/start-conversation). To find
      a contact's conversations, filter [List
      conversations](/api-reference/v3/conversations/list-conversations) by
      `contact_id`.


      Permission group: `contacts`.
  - name: Knowledge base
    description: >-
      An agent's knowledge base sources: the web pages, text, FAQs, and
      documents its answers draw on. New and changed sources train in the
      background. A source starts as `pending`, and the agent uses it once it's
      `processed`.


      Adding sources uses the plan's knowledge base characters, and retraining a
      source uses resync credits. Adding a document takes three requests,
      described in [Create a document
      upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload).
      You can delete or resync up to 100 sources in one request.


      Zoho Desk, Zendesk, Notion, and SharePoint sources are added in the
      dashboard through a connection. The API can list, resync, and delete them,
      and change their auto-sync. Website crawls are also started in the
      dashboard, and the pages they add are `link` sources. An agent that uses
      another agent's knowledge base has no sources of its own.


      Permission group: `knowledge_base`.
  - name: Labels
    description: >-
      Labels an agent can add to its conversations. Add them to a conversation
      with [Update a
      conversation](/api-reference/v3/conversations/update-conversation).


      Permission group: `labels`.
  - name: Teams
    description: >-
      An agent's teams of members. Conversations can be assigned to a team, and
      live chat routing uses teams. Team members must be active, have the owner,
      admin, or agent role, and have access to the agent.


      Permission group: `teams`.
  - name: Topics
    description: >-
      The topics and subtopics an AI agent sorts its conversations into. Create
      and edit topics in the dashboard. Add topics to a conversation with
      [Update a
      conversation](/api-reference/v3/conversations/update-conversation), which
      requires topic analysis on the plan.


      Permission group: `topics` (read).
  - name: Variables
    description: >-
      An AI agent's variables, which store values such as an order number during
      a conversation. You can create, update, and delete custom variables.
      System variables, such as the contact's first name, are built in and
      read-only. Set a custom variable's value for one conversation with [Start
      a conversation](/api-reference/v3/conversations/start-conversation) or
      [Update a
      conversation](/api-reference/v3/conversations/update-conversation).


      Permission group: `variables`.
  - name: Workflows
    description: >-
      An AI agent's workflows. A workflow runs steps, such as sending a message,
      updating a contact, or calling an integration, when an event happens, such
      as a conversation starting. Workflows are built and published in the
      dashboard. The API lists them, shows what they do and how their runs went,
      and turns published workflows on or off.


      To help plan a workflow before it's built in the dashboard, [Retrieve the
      workflow catalog](/api-reference/v3/workflows/get-workflow-catalog) lists
      the triggers, actions, conditions, and limits the project's plan allows.


      Permission group: `workflows`.
paths:
  /workflows/catalog:
    get:
      tags:
        - Workflows
      summary: Retrieve the workflow catalog
      description: >-
        **Available for AI agents only.**


        Lists what an AI agent's workflows can be built from on the project's
        plan: the trigger events, the actions and whether the plan includes
        them, the conditions branch steps can test, waits, and the limits on one
        workflow. It also shows how many workflows and runs the plan allows.
      operationId: getWorkflowCatalog
      parameters:
        - $ref: '#/components/parameters/AgentIdQuery'
        - name: actions
          in: query
          description: >-
            Up to 10 action types, comma-separated, to include each one's
            `config_schema`: the settings its step's `config` takes.
          schema:
            type: string
          example: send_message,http_request
      responses:
        '200':
          description: The catalog.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowCatalog'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            `insufficient_permission`, `project_suspended`, or
            `plan_feature_unavailable` (no API access on the plan, or workflows
            aren't available for the project yet).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  type: permission_error
                  code: plan_feature_unavailable
                  message: Workflows aren't available for this project yet.
                  param: null
                  request_id: req_8Fq2kLm9TzX4vB7nC1dR5sYw
        '404':
          $ref: '#/components/responses/AgentNotFound'
        '409':
          $ref: '#/components/responses/UnsupportedAgentType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    AgentIdQuery:
      name: agent_id
      in: query
      required: true
      description: ID of the agent.
      schema:
        type: string
        maxLength: 64
      example: '3132353852'
  schemas:
    WorkflowCatalog:
      type: object
      required:
        - object
        - agent
        - dashboard_url
        - catalog_version
        - usage
        - trigger_types
        - triggers
        - actions
        - step_types
        - conditions
        - priorities
        - agent_actions
        - tokens
        - wait
        - rules
        - limits
      properties:
        object:
          const: workflow_catalog
        agent:
          $ref: '#/components/schemas/AgentReference'
        dashboard_url:
          type: string
          format: uri
          description: Where to build the agent's workflows in the dashboard.
          example: >-
            https://app.chatling.ai/projects/a1b2c3d4e5/chatbots/f6g7h8i9j0/workflows
        catalog_version:
          type: string
          description: >-
            Changes when anything the catalog offers changes, apart from `usage`
            and `integration_connected`, so a cached copy can be checked.
          example: 5d41402abc4b2a76
        usage:
          type: object
          required:
            - workflows
            - workflow_runs
          properties:
            workflows:
              oneOf:
                - $ref: '#/components/schemas/UsageMeter'
                - type: 'null'
              description: >-
                The agent's workflows against the plan's limit per agent. `null`
                if it couldn't be loaded.
            workflow_runs:
              oneOf:
                - $ref: '#/components/schemas/UsageMeter'
                - type: 'null'
              description: >-
                The project's workflow runs this billing period against the
                plan's limit. `null` if it couldn't be loaded.
        trigger_types:
          type: array
          items:
            type: object
            required:
              - type
              - name
              - description
              - can_create
            properties:
              type:
                type: string
                enum:
                  - automatic
                  - manual
              name:
                type: string
              description:
                type: string
              can_create:
                type: boolean
                description: >-
                  Whether workflows with this trigger can be built through the
                  API.
        triggers:
          type: array
          description: The events that can start a workflow.
          items:
            type: object
            required:
              - type
              - name
              - category
              - provides
              - may_provide
              - filters
              - unsupported_channels
            properties:
              type:
                type: string
                description: What a trigger event's `type` holds.
                example: conversation.status_changed
              name:
                type: string
                example: Conversation status changed
              category:
                type: string
                example: Conversation
              provides:
                type: array
                items:
                  type: string
                  enum:
                    - conversation
                    - message
                    - contact
                    - action_execution
                description: >-
                  What the event is always about. An action's `requires` must be
                  among these for every event.
              may_provide:
                type: array
                items:
                  type: string
                  enum:
                    - conversation
                    - message
                    - contact
                    - action_execution
                description: >-
                  What the event is about when there is one, such as the
                  conversation's contact. Conditions can test it; actions can't
                  rely on it.
              filters:
                type: array
                items:
                  type: object
                  required:
                    - field
                    - name
                    - type
                    - required
                  properties:
                    field:
                      type: string
                      example: to_status
                    name:
                      type: string
                      example: New status
                    type:
                      type: string
                      enum:
                        - enum
                        - entity
                        - object
                    required:
                      type: boolean
                    options:
                      type: array
                      items:
                        type: object
                        required:
                          - id
                          - name
                        properties:
                          id: {}
                          name:
                            type: string
                      description: The values the filter takes.
                    options_from:
                      type: string
                      enum:
                        - priorities
                        - agent_actions
                      description: The catalog section that lists the filter's values.
                    description:
                      type: string
                description: >-
                  What the event can be limited to, such as the status a
                  conversation changed to.
              unsupported_channels:
                type: array
                items:
                  type: string
                description: Channels where the event doesn't happen.
        actions:
          type: array
          description: >-
            The actions a step can run. Each action can also include details for
            planning it, such as `operations` for integrations, `methods` and
            `body_types` for HTTP requests, `writable_fields` for contact
            actions, `result_fields` that results can be saved from, and
            `from_address` for emails.
          items:
            type: object
            required:
              - action_type
              - name
              - category
              - available
              - unavailable_reason
              - requires
              - integration
              - outputs
              - unsupported_channels
            properties:
              action_type:
                type: string
                description: What a step's `config.action_type` holds.
                example: send_message
              name:
                type: string
                example: Send message
              category:
                type: string
                example: Conversation
              available:
                type: boolean
                description: Whether the project's plan includes the action.
              unavailable_reason:
                type:
                  - string
                  - 'null'
                example: null
              requires:
                type: array
                items:
                  type: string
                  enum:
                    - conversation
                    - message
                    - contact
                    - action_execution
                description: >-
                  What every trigger event must provide for the action to run,
                  such as a conversation to send a message to.
                example:
                  - conversation
              integration:
                type:
                  - string
                  - 'null'
                enum:
                  - whatsapp
                  - google_sheets
                  - hubspot
                  - zendesk
                  - slack
                  - airtable
                  - null
                description: >-
                  The integration the action uses, which must be connected to
                  the agent in the dashboard.
              integration_connected:
                type: boolean
                description: >-
                  Integration actions only: whether the agent has a working
                  account for the integration. The user chooses which in the
                  dashboard's builder.
              outputs:
                type: array
                items:
                  type: string
                description: 'The step''s outputs: `next`, or `success` and `failure`.'
                example:
                  - next
              unsupported_channels:
                type: array
                items:
                  type: string
                description: >-
                  Channels the action can't run on. See the
                  `unsupported_channel` rule.
              filled_in_editor:
                type: array
                items:
                  type: string
                description: >-
                  Settings the user chooses in the dashboard's builder, from the
                  connected account, such as the account and the Slack channel.
                example:
                  - slack_account_id
                  - channel_id
                  - channel_name
                  - recipient
                  - recipient_name
              config_schema:
                type: object
                additionalProperties: true
                description: >-
                  Only for the actions listed in `actions`: a JSON Schema of the
                  settings its step's `config` takes, besides `action_type`.
                  Integrations have `operations`, with a schema for each
                  operation, and list the settings chosen in the builder in
                  `x-filled-in-editor`. `x-accepts-tokens` marks text that can
                  hold tokens, `x-options-from` names where valid values come
                  from (a tool such as `list_teams`, or a catalog list such as
                  `priorities` or `variables`), and `x-secret` marks values read
                  back as `{"secret_ref": "..."}`.
                example:
                  type: object
                  required:
                    - message
                  properties:
                    message:
                      type: string
                      maxLength: 16000
                      description: What the agent sends the user.
                      x-accepts-tokens: true
              operations:
                type: array
                items:
                  type: object
                  required:
                    - id
                    - name
                  properties:
                    id: {}
                    name:
                      type: string
                description: >-
                  For integrations, what the action can do: a step's
                  `config.operation`.
              result_fields:
                type: array
                items:
                  type: object
                  required:
                    - id
                    - name
                  properties:
                    id: {}
                    name:
                      type: string
                description: Results the action can save into variables.
              limits:
                type: object
                additionalProperties:
                  type: integer
                description: The action's own limits, such as `max_message_length`.
                example:
                  max_message_length: 16000
            additionalProperties: true
        step_types:
          type: array
          items:
            type: object
            required:
              - type
              - outputs
              - description
            properties:
              type:
                type: string
                enum:
                  - action
                  - branch
                  - wait
                  - end
              outputs:
                type:
                  - array
                  - 'null'
                items:
                  type: string
                description: The step's outputs, or `null` when they depend on the step.
              description:
                type: string
              max_paths:
                type: integer
        conditions:
          type: array
          description: >-
            What conditions can test, in branch paths and the trigger's
            audience. `event` fields are about the trigger event, and `workflow`
            fields test the agent's variables.
          items:
            type: object
            required:
              - scope
              - field
              - name
              - type
              - operators
            properties:
              scope:
                type: string
                enum:
                  - event
                  - conversation
                  - message
                  - contact
                  - workflow
                description: What a condition's `scope` holds.
                example: conversation
              field:
                type: string
                example: status
              name:
                type: string
                example: Status
              type:
                type: string
                enum:
                  - enum
                  - entity
                  - text
                  - boolean
                  - scalar
              operators:
                type: array
                items:
                  type: string
                example:
                  - is
                  - is_not
              options:
                type: array
                items:
                  type: object
                  required:
                    - id
                    - name
                  properties:
                    id: {}
                    name:
                      type: string
                description: The values the field can have.
              options_from:
                type: string
                enum:
                  - priorities
                  - list_members
                  - list_teams
                description: >-
                  Where the field's values come from: the catalog's
                  `priorities`, the `account_id` of a member from
                  `list_members`, or a team's `id` from `list_teams`.
              only_for_triggers:
                type: array
                items:
                  type: string
                description: The trigger events the field applies to.
        priorities:
          type: array
          items:
            type: object
            required:
              - id
              - name
            properties:
              id:
                type: integer
                example: 3
              name:
                type: string
                example: High
          description: >-
            Conversation priorities, by the ID priority conditions, filters and
            actions use.
        agent_actions:
          type: array
          description: >-
            The agent's AI actions, by the ID the `agent_action.executed`
            trigger's filters use.
          items:
            type: object
            required:
              - id
              - name
              - trigger_phases
            properties:
              id:
                type: integer
                example: 812
              name:
                type: string
                example: Book a demo
              trigger_phases:
                type: array
                items:
                  type: string
                  enum:
                    - executed
                    - submitted
                description: >-
                  When the action can trigger a workflow: when the AI runs it,
                  or also when the user submits its form or booking.
        tokens:
          type: object
          required:
            - syntax
            - fields
            - variables
            - description
          description: What `{{ }}` can insert into text settings.
          properties:
            syntax:
              type: string
            fields:
              type: array
              items:
                type: object
                required:
                  - token
                  - name
                  - requires
                properties:
                  token:
                    type: string
                    example: contact_fname
                  name:
                    type: string
                  requires:
                    oneOf:
                      - type: string
                        enum:
                          - conversation
                          - message
                          - contact
                          - action_execution
                      - type: 'null'
                    description: >-
                      What every trigger event must provide for the token to be
                      used.
            variables:
              type: array
              items:
                type: object
                required:
                  - token
                properties:
                  token:
                    type: string
                    example: order_number
              description: The agent's variables.
            description:
              type: string
        wait:
          type: object
          required:
            - units
            - min_seconds
            - max_seconds
          description: Wait steps pause a run before its next step.
          properties:
            units:
              type: array
              items:
                type: string
              example:
                - minutes
                - hours
                - days
            min_seconds:
              type: integer
              example: 60
            max_seconds:
              type: integer
              example: 7776000
        rules:
          type: array
          description: >-
            Rules that span several steps, with the issue code that reports
            them.
          items:
            type: object
            required:
              - code
              - description
            properties:
              code:
                type: string
                example: unsupported_channel
              description:
                type: string
        limits:
          type: object
          description: Limits on one workflow.
          required:
            - steps
            - links
            - trigger_events
            - path_depth
            - branches_per_step
            - conditions_per_branch
            - condition_depth
            - notes
            - definition_bytes
          properties:
            steps:
              type: integer
              example: 100
            links:
              type: integer
              example: 200
              description: Outputs that can be linked to a step, across the workflow.
            trigger_events:
              type: integer
              description: Events one trigger can listen for.
              example: 10
            path_depth:
              type: integer
              description: Steps on the longest path from the trigger.
              example: 35
            branches_per_step:
              type: integer
              example: 10
            conditions_per_branch:
              type: integer
              example: 20
            condition_depth:
              type: integer
              description: How deeply condition groups can nest.
              example: 3
            notes:
              type: integer
              example: 100
            definition_bytes:
              type: integer
              example: 1048576
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - param
            - request_id
          properties:
            type:
              type: string
              enum:
                - authentication_error
                - permission_error
                - not_found_error
                - invalid_request_error
                - idempotency_error
                - rate_limit_error
                - api_error
              description: The type of error returned.
            code:
              type: string
              description: >-
                A short string identifying the error. Codes are stable, so
                handle errors by `code`. New codes may be added.
              examples:
                - validation_failed
                - insufficient_permission
                - resource_not_found
            message:
              type: string
              description: >-
                A human-readable message with more details about the error. The
                wording can change, so don't parse it.
            param:
              type:
                - string
                - 'null'
              description: >-
                If the error is parameter-specific, the parameter related to the
                error, in dot notation for nested fields, such as
                `member_ids.1`. For `validation_failed`, the first entry of
                `errors`.
            request_id:
              type: string
              description: >-
                The ID of the request, also returned in the `X-Request-Id`
                header. Include it when you contact support.
            errors:
              type: array
              description: >-
                For `validation_failed` only: every invalid parameter. The
                top-level `param` and `message` match the first entry.
              items:
                type: object
                required:
                  - param
                  - message
                properties:
                  param:
                    type: string
                    description: The invalid parameter, in dot notation for nested fields.
                  message:
                    type: string
                    description: >-
                      A human-readable message about the problem. The wording
                      can change.
    AgentReference:
      type: object
      description: The agent this belongs to.
      required:
        - id
        - type
        - name
      properties:
        id:
          type: string
          description: ID of the agent, as passed in `agent_id`.
          example: '3132353852'
        type:
          $ref: '#/components/schemas/AgentType'
        name:
          type: string
          example: Support agent
    UsageMeter:
      type: object
      required:
        - used
        - limit
        - remaining
      properties:
        used:
          type: number
          example: 1250.5
        limit:
          type:
            - number
            - 'null'
          description: >-
            The plan's allowance plus add-ons and lifetime grants. `null` if
            unlimited.
          example: 5000
        remaining:
          type:
            - number
            - 'null'
          description: '`limit` minus `used`, never below 0. `null` if unlimited.'
          example: 3749.5
    AgentType:
      type: string
      enum:
        - ai_agent
        - chatbot
      description: >-
        `ai_agent` for an AI agent, at `/agents`, or `chatbot` for a
        flow-builder chatbot, at `/chatbots`.
  responses:
    Unauthorized:
      description: '`missing_api_key`, `invalid_api_key`, or `api_key_expired`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: authentication_error
              code: invalid_api_key
              message: The API key is invalid or has been revoked.
              param: null
              request_id: req_8Fq2kLm9TzX4vB7nC1dR5sYw
    AgentNotFound:
      description: >-
        `resource_not_found`: No agent with this ID exists in the project, or
        the key can't access it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: not_found_error
              code: resource_not_found
              message: No agent with this ID exists, or this API key can't access it.
              param: null
              request_id: req_8Fq2kLm9TzX4vB7nC1dR5sYw
    UnsupportedAgentType:
      description: '`unsupported_agent_type`: The agent is a chatbot.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: invalid_request_error
              code: unsupported_agent_type
              message: This endpoint only works with AI agents, and this is a chatbot.
              param: agent_id
              request_id: req_8Fq2kLm9TzX4vB7nC1dR5sYw
    ValidationFailed:
      description: '`validation_failed`, or `invalid_cursor` for lists.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: invalid_request_error
              code: validation_failed
              message: The name field is required.
              param: name
              request_id: req_8Fq2kLm9TzX4vB7nC1dR5sYw
              errors:
                - param: name
                  message: The name field is required.
    RateLimited:
      description: '`rate_limit_exceeded`.'
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  headers:
    RetryAfter:
      description: The number of seconds to wait before retrying.
      schema:
        type: integer
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: A project API key, created in the dashboard.

````

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