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

# Get a flow

> One flow with its full definition and its etag. Scope: read.

Returns the full `definition` and the `etag` you send back when you [change the flow](https://docs.flowapt.com/flowiq-api-reference/endpoint/update-flow.md).

## Basic Usage

```bash theme={null}
curl https://api.flowiq.live/v1/flows/$FLOW_ID \
  -H "Authorization: Bearer fiq_YOUR_API_KEY"
```


## OpenAPI

````yaml flowiq-api-reference/openapi-flows.json GET /v1/flows/{id}
openapi: 3.1.0
info:
  title: FlowIQ Flows API
  version: 1.0.0
  description: List, read, create, change and switch on FlowIQ flows.
servers:
  - url: https://api.flowiq.live
    description: FlowIQ Production API
security:
  - BearerAuth: []
tags:
  - name: Flows
paths:
  /v1/flows/{id}:
    get:
      tags:
        - Flows
      summary: Get a flow
      description: 'One flow with its full definition and its etag. Scope: read.'
      operationId: getFlow
      parameters:
        - name: id
          in: path
          required: true
          description: The flow's id
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The flow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Flow'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No flow with that id in your organisation (code not_found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    Flow:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          example: Abandoned checkout
        description:
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - live
            - 'off'
          example: 'off'
        repeat:
          type: string
          enum:
            - 'off'
            - once_per_contact
            - once_per_order
            - once_per_order_per_day
            - once_per_subscription
            - reenter_after
          description: >-
            How often one person can go through the flow. `reenter_after` uses
            `definition.reenter_after_days`.
        trigger:
          oneOf:
            - $ref: '#/components/schemas/Trigger'
            - type: 'null'
        definition:
          allOf:
            - $ref: '#/components/schemas/Definition'
          example:
            trigger:
              type: event
              event: checkouts/create
              source: shopify
            steps:
              - id: w1
                type: delay
                value: 1
                unit: hours
              - id: m1
                type: action
                action_type: send_message
                config:
                  template_name: cart_reminder_v1
                  body_parameters:
                    param1: '{{contact.first_name}}'
        etag:
          type: string
          description: Send it back as If-Match when you change the flow.
          example: 3f9a1c0d7e2b4a61
        stats:
          type:
            - object
            - 'null'
          additionalProperties: true
          example:
            total_sent: 0
            total_triggered: 0
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        message:
          type: string
        request_id:
          type: string
          format: uuid
    Trigger:
      description: What starts the flow. One of the shapes below.
      oneOf:
        - $ref: '#/components/schemas/TriggerOrder'
        - $ref: '#/components/schemas/TriggerSubscription'
        - $ref: '#/components/schemas/TriggerContact'
        - $ref: '#/components/schemas/TriggerMessage'
        - $ref: '#/components/schemas/TriggerDate'
        - $ref: '#/components/schemas/TriggerProduct'
        - $ref: '#/components/schemas/TriggerApiEvent'
        - $ref: '#/components/schemas/TriggerStore'
    Definition:
      type: object
      title: Flow definition
      description: >-
        The flow itself. At most 25 steps at the top level and 80 counting every
        split path.
      required:
        - trigger
        - steps
      properties:
        trigger:
          $ref: '#/components/schemas/Trigger'
        steps:
          type: array
          minItems: 1
          maxItems: 25
          items:
            $ref: '#/components/schemas/Step'
        exit_rules:
          type: object
          description: >-
            Stop rules: checked before every message and after every wait; when
            they hold the run ends.
          properties:
            logic:
              type: string
              enum:
                - any
                - all
              description: ''
              default: any
            conditions:
              type: array
              items:
                $ref: '#/components/schemas/Check'
        reenter_after_days:
          type: integer
          description: >-
            With repeat reenter_after: how many days before the same person can
            go through again.
          minimum: 1
          maximum: 365
          default: 30
        schedule:
          type: object
          description: >-
            Switch the flow on and / or off at a set time (checked every 5
            minutes; each time is used once).
          properties:
            on_at:
              type: string
              description: ISO 8601
              format: date-time
            off_at:
              type: string
              description: ISO 8601
              format: date-time
    TriggerOrder:
      type: object
      title: Order or checkout
      description: >-
        Starts when a store order or checkout event arrives. Shopify events use
        source `shopify`, WooCommerce events source `woocommerce` (each fires
        once per order). `popup_signup` starts when someone signs up on a FlowIQ
        pop-up that has a Flows webhook (source `popup`).
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - orders/paid
            - orders/fulfilled
            - orders/create
            - checkouts/create
            - checkouts/update
            - wc/order.created
            - wc/order.on_hold
            - wc/order.paid
            - wc/order.processing
            - wc/order.completed
            - wc/order.cancelled
            - wc/order.refunded
            - popup_signup
          description: What starts the flow.
        source:
          type: string
          enum:
            - shopify
            - woocommerce
            - popup
          description: >-
            Must match the event: shopify for orders/* and checkouts/*,
            woocommerce for wc/order.*, popup for popup_signup.
      required:
        - type
        - event
        - source
      example:
        type: event
        event: orders/paid
        source: shopify
    TriggerSubscription:
      type: object
      title: Subscription
      description: >-
        Starts on a FlowIQ subscription event. Billing events use source
        `stitch`, actions taken on a subscription use source `manage`.
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - subscription.created
            - subscription.renewed
            - payment.failed
            - subscription.expired
            - subscription.paused
            - subscription.resumed
            - subscription.cancelled
            - subscription.reactivated
            - subscription.items_changed
            - subscription.activated
            - subscription.card_connected
          description: >-
            created / renewed / payment.failed / expired / activated /
            card_connected come from billing (source stitch); paused / resumed /
            cancelled / reactivated / items_changed from an action on the
            subscription (source manage).
        source:
          type: string
          enum:
            - stitch
            - manage
          description: stitch for billing events, manage for actions.
      required:
        - type
        - event
        - source
      example:
        type: event
        event: subscription.cancelled
        source: manage
    TriggerContact:
      type: object
      title: Contact
      description: >-
        Starts when a tag is added to or taken off a contact, or a new contact
        is added.
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - contact.tag_added
            - contact.tag_removed
            - contact.created
          description: >-
            contact.created fires for a new contact from any source (first
            message, pop-up, order, import).
        source:
          const: contact
        tag:
          type: string
          description: The tag (contact.tag_added and contact.tag_removed only).
      required:
        - type
        - event
      example:
        type: event
        event: contact.tag_added
        source: contact
        tag: vip
    TriggerMessage:
      type: object
      title: Message
      description: >-
        Starts when someone writes to the business for the first time, or sends
        a keyword.
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - message.first
            - message.keyword
        source:
          const: message
        keywords:
          type: array
          items:
            type: string
          description: 'message.keyword: the words to listen for.'
        match:
          type: string
          enum:
            - contains
            - exact
            - starts
          description: 'message.keyword: how the message must match a keyword.'
          default: contains
      required:
        - type
        - event
      example:
        type: event
        event: message.keyword
        source: message
        keywords:
          - menu
        match: exact
    TriggerDate:
      type: object
      title: Date
      description: >-
        Starts on a date: a date saved on the contact (a birthday), a number of
        days after their last order, days before a subscription's next charge,
        or Sunset (opted in, but has not read, tapped, replied, visited the
        store or ordered). Date triggers are checked hourly; Sunset daily at
        10:15 South African time.
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - date.attribute
            - date.after_last_order
            - date.before_renewal
            - date.unengaged
        source:
          const: date
        attribute:
          type: string
          description: >-
            date.attribute: the contact attribute that holds the date (letters,
            digits, _).
          default: birthday
        offset_days:
          type: integer
          description: 'date.attribute: days from the date; negative = before.'
          minimum: -365
          maximum: 365
          default: 0
        yearly:
          type: boolean
          description: 'date.attribute: every year (birthdays, anniversaries).'
          default: true
        days:
          type: integer
          description: >-
            date.after_last_order: 1-730 (default 30). date.before_renewal: 0-60
            (default 3). date.unengaged: the look-back, 7-365 (default 90).
          minimum: 0
          maximum: 730
        min_sent:
          type: integer
          description: >-
            date.unengaged: how many messages they must have been sent in that
            time.
          minimum: 1
          maximum: 50
          default: 3
      required:
        - type
        - event
      example:
        type: event
        event: date.after_last_order
        source: date
        days: 60
    TriggerProduct:
      type: object
      title: Product
      description: >-
        Starts when the price drops, or stock runs low, on a product the contact
        asked about or put in a cart.
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - product.price_drop
            - product.low_stock
        source:
          const: product
        lookback_days:
          type: integer
          description: How far back their interest counts.
          minimum: 1
          maximum: 180
          default: 30
        min_drop_percent:
          type: integer
          description: 'product.price_drop: the smallest drop that counts.'
          minimum: 0
          maximum: 90
          default: 0
        threshold:
          type: integer
          description: 'product.low_stock: stock at or below this.'
          minimum: 1
          maximum: 1000
          default: 5
      required:
        - type
        - event
      example:
        type: event
        event: product.price_drop
        source: product
        lookback_days: 30
        min_drop_percent: 10
    TriggerApiEvent:
      type: object
      title: Your own event
      description: >-
        Starts when your system sends an event: through an Endpoint, or with
        [Send an event](/flowiq-api-reference/send-event). The event's fields
        are available as {{trigger.<field>}}.
      properties:
        type:
          const: event
        event:
          const: api.event
        source:
          const: api
        event_name:
          type: string
          description: 'The event''s name: letters, digits, _ . : - , up to 128 characters.'
          example: delivery.successful
      required:
        - type
        - event
        - event_name
      example:
        type: event
        event: api.event
        source: api
        event_name: delivery.successful
    TriggerStore:
      type: object
      title: Store browsing
      description: >-
        Starts from the FlowIQ app's store pixel (Shopify): a known, opted-in
        shopper viewed a product and did not view it again, cart it, check out
        or order within wait_hours; or a known shopper is on the store (once a
        day).
      properties:
        type:
          const: event
        event:
          type: string
          enum:
            - store.browse_abandoned
            - store.active
        source:
          const: storefront
        wait_hours:
          type: integer
          description: 'store.browse_abandoned: hours to wait after the view.'
          minimum: 1
          maximum: 72
          default: 4
        repeat_days:
          type: integer
          description: >-
            store.browse_abandoned: at most once per product in this many days
            (and one product a day).
          minimum: 1
          maximum: 90
          default: 7
        quiet_days:
          type: integer
          description: >-
            store.active: 0 = every visit day; above 0 = only when they come
            back after that many days away.
          minimum: 0
          maximum: 365
          default: 0
      required:
        - type
        - event
      example:
        type: event
        event: store.browse_abandoned
        source: storefront
        wait_hours: 4
        repeat_days: 7
    Step:
      description: One step. Steps run top to bottom; a split ends its list.
      oneOf:
        - $ref: '#/components/schemas/StepWait'
        - $ref: '#/components/schemas/StepCheck'
        - $ref: '#/components/schemas/StepSplit'
        - $ref: '#/components/schemas/StepWhatsApp'
        - $ref: '#/components/schemas/StepEmail'
        - $ref: '#/components/schemas/StepContact'
        - $ref: '#/components/schemas/StepCode'
        - $ref: '#/components/schemas/StepAlert'
        - $ref: '#/components/schemas/StepWebhook'
        - $ref: '#/components/schemas/StepBrief'
        - $ref: '#/components/schemas/StepWaitReply'
        - $ref: '#/components/schemas/StepShopifyTags'
    Check:
      description: One check. All checks in a list must hold unless logic is any.
      oneOf:
        - $ref: '#/components/schemas/CheckOrderHistory'
        - $ref: '#/components/schemas/CheckOrderItems'
        - $ref: '#/components/schemas/CheckOrderDetail'
        - $ref: '#/components/schemas/CheckFirstOrder'
        - $ref: '#/components/schemas/CheckInStock'
        - $ref: '#/components/schemas/CheckContactField'
        - $ref: '#/components/schemas/CheckSubscription'
        - $ref: '#/components/schemas/CheckNotSentRecently'
        - $ref: '#/components/schemas/CheckSupportActive'
        - $ref: '#/components/schemas/CheckReplied'
        - $ref: '#/components/schemas/CheckMessageEngagement'
        - $ref: '#/components/schemas/CheckEngagement'
        - $ref: '#/components/schemas/CheckStoreActivity'
        - $ref: '#/components/schemas/CheckHoldout'
        - $ref: '#/components/schemas/CheckRandom'
    StepWait:
      type: object
      title: Wait
      description: >-
        Waits, then carries on. With until_time / weekdays it then waits for
        that time of day (South African time) on one of those days.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: delay
        value:
          type: number
          minimum: 0
        unit:
          type: string
          enum:
            - minutes
            - hours
            - days
            - weeks
            - months
        until_time:
          type: string
          description: HH:MM, 24-hour, South African time.
          pattern: ^([01]\d|2[0-3]):[0-5]\d$
        weekdays:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 7
          description: 1 = Monday … 7 = Sunday.
      required:
        - id
        - type
        - value
        - unit
      example:
        id: w1
        type: delay
        value: 1
        unit: days
        until_time: '09:00'
        weekdays:
          - 1
          - 2
          - 3
          - 4
          - 5
    StepCheck:
      type: object
      title: Only if
      description: Carries on only if the checks hold; otherwise the run ends here.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: condition
        config:
          type: object
          required:
            - conditions
          properties:
            logic:
              type: string
              enum:
                - all
                - any
              description: ''
              default: all
            conditions:
              type: array
              items:
                $ref: '#/components/schemas/Check'
      required:
        - id
        - type
        - config
      example:
        id: c1
        type: condition
        config:
          logic: all
          conditions:
            - type: first_order
              operator: is
    StepSplit:
      type: object
      title: Split
      description: >-
        Sends each person down the first path whose checks hold, or Everyone
        else. Paths with random_sample shares make an A/B test; with ab.auto the
        test picks its winner and sends everyone that way. A split is always the
        last step of its list (paths do not join back up).
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: split
        config:
          type: object
          required:
            - paths
          properties:
            paths:
              type: array
              minItems: 1
              maxItems: 19
              items:
                type: object
                required:
                  - id
                  - name
                  - conditions
                properties:
                  id:
                    type: string
                    description: Path id.
                  name:
                    type: string
                    description: Shown in the editor and the report.
                  logic:
                    type: string
                    enum:
                      - all
                      - any
                    description: ''
                    default: all
                  conditions:
                    type: array
                    minItems: 1
                    items:
                      $ref: '#/components/schemas/Check'
                  steps:
                    type: array
                    items:
                      $ref: '#/components/schemas/Step'
            otherwise:
              type: object
              description: Everyone else.
              properties:
                id:
                  type: string
                  description: ''
                name:
                  type: string
                  description: ''
                  default: Everyone else
                steps:
                  type: array
                  items:
                    $ref: '#/components/schemas/Step'
            ab:
              type: object
              description: A/B test that decides itself.
              properties:
                auto:
                  type: boolean
                metric:
                  type: string
                  enum:
                    - clicked
                    - orders
                    - revenue
                    - read
                  description: ''
                  default: clicked
                min_per_path:
                  type: integer
                  description: People per path before deciding.
                  minimum: 1
                max_days:
                  type: integer
                  description: Decide after this many days at the latest.
                  minimum: 1
      required:
        - id
        - type
        - config
      example:
        id: s1
        type: split
        config:
          paths:
            - id: pa
              name: A
              conditions:
                - type: random_sample
                  percent: 50
              steps: []
          otherwise:
            id: po
            name: Everyone else
            steps: []
          ab:
            auto: true
            metric: clicked
    StepWhatsApp:
      type: object
      title: Send a WhatsApp message
      description: >-
        Sends an approved WhatsApp template. On a Meta (Cloud API) line, if they
        wrote in the last 24 hours the template's text goes as a normal message
        instead, with no template fee.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: action
        action_type:
          const: send_message
        config:
          type: object
          required:
            - template_name
          properties:
            template_name:
              type: string
              description: >-
                An approved template. While building, "choose-template" with
                send_status draft is allowed.
            body_parameters:
              type: object
              additionalProperties:
                type: string
              description: >-
                param1 … paramN for the template's body variables. Values may
                use merge fields.
            button_parameters:
              type: object
              additionalProperties:
                type: string
              description: param1 for a dynamic-URL button.
            header_media_strategy:
              type: string
              description: >-
                custom = use header_media_url; leave out for the template's own
                media; other values pick an image of a product in the order.
            header_media_url:
              type: string
              description: custom header image / video / document (public URL).
            send_status:
              type: string
              enum:
                - live
                - manual
                - draft
              description: manual = waits for your OK in the app; draft = skipped.
              default: live
            skip_smart_sending:
              type: boolean
              description: Ignore the account's message cap for this message.
              default: false
            button_followups:
              type: object
              description: >-
                What happens when they tap a quick-reply button (messages
                outside a split, after every wait).
              properties:
                wait_days:
                  type: integer
                  description: How long a tap still counts.
                  minimum: 1
                  maximum: 30
                  default: 7
                buttons:
                  type: array
                  maxItems: 10
                  items:
                    type: object
                    required:
                      - button
                      - reply
                    properties:
                      button:
                        type: string
                        description: The button's label.
                      reply:
                        type: string
                        enum:
                          - message
                          - agent
                          - none
                      message:
                        type: string
                        description: 'reply message: the text (up to 1,024).'
                      add_tags:
                        type: array
                        items:
                          type: string
                      remove_tags:
                        type: array
                        items:
                          type: string
                      assign_to:
                        type: string
                        description: A team member's user id.
                      agent_off:
                        type: boolean
      required:
        - id
        - type
        - action_type
        - config
      example:
        id: m1
        type: action
        action_type: send_message
        config:
          template_name: cart_reminder_v1
          body_parameters:
            param1: '{{contact.first_name}}'
          button_parameters:
            param1: '{{cart_link_code}}'
    StepEmail:
      type: object
      title: Send an email
      description: >-
        Sends an email from the account's connected mailbox, only to people who
        agreed to email (unless require_consent is false), with an unsubscribe
        link. Plain text, or a design from Broadcast → Email.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: email
        config:
          type: object
          required:
            - subject
          properties:
            subject:
              type: string
              description: May use merge fields.
            body:
              type: string
              description: Plain text (when content is not design).
            content:
              type: string
              enum:
                - text
                - design
              description: ''
              default: text
            design:
              type: object
              description: >-
                content design: an email builder design { version, settings,
                blocks }.
            require_consent:
              type: boolean
              default: true
            send_status:
              type: string
              enum:
                - live
                - manual
                - draft
              description: ''
              default: live
      required:
        - id
        - type
        - config
      example:
        id: e1
        type: email
        config:
          subject: Still thinking it over, {{contact.first_name}}?
          body: 'Your cart is waiting: {{cart_link}}'
    StepContact:
      type: object
      title: Tag or update the contact
      description: Adds or removes tags, or sets an attribute.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: update_contact
        config:
          type: object
          required:
            - operations
          properties:
            operations:
              type: array
              minItems: 1
              items:
                type: object
                required:
                  - op
                properties:
                  op:
                    type: string
                    enum:
                      - add_tag
                      - remove_tag
                      - set_attribute
                  value:
                    type: string
                    description: The tag, or the attribute's value.
                  key:
                    type: string
                    description: 'set_attribute: the attribute name.'
      required:
        - id
        - type
        - config
      example:
        id: t1
        type: update_contact
        config:
          operations:
            - op: add_tag
              value: cart-reminded
    StepCode:
      type: object
      title: Make a discount code
      description: >-
        Makes a one-person discount code in the store (Shopify or WooCommerce);
        later steps use it as {{flow.discount_code}}.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: discount_code
        config:
          type: object
          properties:
            kind:
              type: string
              enum:
                - percentage
                - fixed_amount
                - free_shipping
              description: ''
              default: percentage
            value:
              type: number
              description: 'percentage: 1-100; fixed_amount: above 0.'
            expiry_days:
              type: integer
              description: ''
              minimum: 1
              maximum: 365
              default: 30
            code_prefix:
              type: string
              description: e.g. COMEBACK
            min_subtotal:
              type: number
            collection_gid:
              type: string
              description: 'Shopify: only for this collection.'
      required:
        - id
        - type
        - config
      example:
        id: d1
        type: discount_code
        config:
          kind: percentage
          value: 10
          expiry_days: 14
          code_prefix: COMEBACK
    StepAlert:
      type: object
      title: Alert the team
      description: Sends your team a WhatsApp and / or email about this customer.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: alert
        config:
          type: object
          required:
            - message
          properties:
            message:
              type: string
              description: May use merge fields.
            team_id:
              type: string
              description: A team id.
            whatsapp_numbers:
              type: array
              items:
                type: string
            emails:
              type: array
              items:
                type: string
            include_link:
              type: boolean
              description: Add a link to the chat.
      required:
        - id
        - type
        - config
      example:
        id: a1
        type: alert
        config:
          message: '{{contact.full_name}} ordered over R5,000'
          emails:
            - sales@example.com
    StepWebhook:
      type: object
      title: Send to your webhook
      description: >-
        Posts this run's customer and trigger data to one of your account's
        webhooks (Settings → Webhooks), with retries.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: webhook
        config:
          type: object
          required:
            - webhook_id
          properties:
            webhook_id:
              type: string
              description: The webhook's id.
      required:
        - id
        - type
        - config
      example:
        id: h1
        type: webhook
        config:
          webhook_id: 0b9f7a4e-2c1d-4e8a-9a51-6d2f0c7b1e33
    StepBrief:
      type: object
      title: Brief the AI agent
      description: >-
        Gives the AI agent a one-time instruction for this customer's next
        conversation.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: agent_brief
        config:
          type: object
          required:
            - instruction
          properties:
            instruction:
              type: string
              description: ''
            turn_on_agent:
              type: boolean
      required:
        - id
        - type
        - config
      example:
        id: b1
        type: agent_brief
        config:
          instruction: They left a mattress in their cart. Offer help choosing a size.
    StepWaitReply:
      type: object
      title: Wait for a reply
      description: >-
        Pauses until they reply (optionally with one of match_keywords), or
        until timeout_hours. Not inside a split.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: wait_for_reply
        config:
          type: object
          properties:
            timeout_hours:
              type: number
            match_keywords:
              type: array
              items:
                type: string
      required:
        - id
        - type
      example:
        id: r1
        type: wait_for_reply
        config:
          timeout_hours: 48
    StepShopifyTags:
      type: object
      title: Sync tags to Shopify
      description: Copies the contact's FlowIQ tags to their Shopify customer.
      properties:
        id:
          type: string
          description: >-
            Your id for this step, unique in the flow (letters, digits, _ and
            -). The report and the editor refer to steps by it.
          example: m1
        type:
          const: shopify_tags
      required:
        - id
        - type
      example:
        id: st1
        type: shopify_tags
    CheckOrderHistory:
      type: object
      title: What they have ordered
      description: >-
        Their order history: have they placed an order, or bought certain
        products?
      properties:
        type:
          const: event
        field:
          const: contact
        action:
          type: string
          enum:
            - placed_order
            - bought_product
        operator:
          type: string
          enum:
            - has
            - has_not
        timeframe:
          type: object
          description: When it counts. Leave out for ever.
          properties:
            type:
              type: string
              enum:
                - in_the_last
                - since_trigger
              description: >-
                in_the_last = in the last value + unit; since_trigger = only
                since this run started (the order that started it never counts).
            value:
              type: integer
              description: 'in_the_last: how many.'
              minimum: 1
            unit:
              type: string
              enum:
                - days
                - weeks
                - months
              description: 'in_the_last: the unit.'
              default: days
        where:
          type: object
          description: 'bought_product: which products. Leave out for any product.'
          properties:
            field:
              type: string
              enum:
                - product_title
                - variant_id
                - sku
                - any
            values:
              type: array
              items:
                type: string
            match:
              type: string
              enum:
                - contains
                - exact
              description: 'product_title only: contains = part of the name, any case.'
              default: exact
      required:
        - type
        - action
        - operator
      example:
        type: event
        field: contact
        action: placed_order
        operator: has_not
        timeframe:
          type: in_the_last
          value: 45
          unit: days
    CheckOrderItems:
      type: object
      title: What is in this order
      description: The items in the order that started the run.
      properties:
        type:
          const: line_item_check
        field:
          type: string
          enum:
            - title
            - sku
            - variant_id
            - product_type
            - collection
          description: >-
            collection = the item is in that Shopify collection (checked when
            the step runs).
          default: title
        match:
          type: string
          enum:
            - contains
            - exact
          description: ''
          default: contains
        operator:
          type: string
          enum:
            - has
            - has_not
          description: ''
          default: has
        values:
          type: array
          items:
            type: string
          description: One or more values; any one matching counts.
      required:
        - type
        - values
      example:
        type: line_item_check
        field: title
        match: contains
        operator: has
        values:
          - Mattress
    CheckOrderDetail:
      type: object
      title: A detail of the order or event
      description: A field of the order or event that started the run.
      properties:
        type:
          const: payload_check
        field:
          type: string
          description: >-
            The field, e.g. total_price, financial_status, or a field of your
            own event.
        operator:
          type: string
          enum:
            - eq
            - neq
            - gt
            - gte
            - lt
            - lte
            - contains
            - not_contains
            - truthy
            - falsy
          description: ''
          default: eq
        value:
          description: What to compare with (not needed for truthy / falsy).
      required:
        - type
        - field
      example:
        type: payload_check
        field: total_price
        operator: gt
        value: 1500
    CheckFirstOrder:
      type: object
      title: First order
      description: Was the order that started the run their first at the store?
      properties:
        type:
          const: first_order
        operator:
          type: string
          enum:
            - is
            - is_not
      required:
        - type
        - operator
      example:
        type: first_order
        operator: is
    CheckInStock:
      type: object
      title: Still in stock
      description: Are the order's products still in stock when the step runs?
      properties:
        type:
          const: stock_check
        require:
          type: string
          enum:
            - all
            - any
          description: ''
          default: all
      required:
        - type
      example:
        type: stock_check
        require: all
    CheckContactField:
      type: object
      title: A contact field
      description: A field on the contact, such as their tags.
      properties:
        type:
          const: property
        data_source:
          const: contacts
        field:
          type: string
          description: The contact column, e.g. tags, email, allow_broadcast.
        operator:
          type: string
          enum:
            - equals
            - not_equals
            - contains
            - not_contains
        value:
          description: The value to compare with.
      required:
        - type
        - data_source
        - field
        - operator
      example:
        type: property
        data_source: contacts
        field: tags
        operator: not_contains
        value: vip
    CheckSubscription:
      type: object
      title: Their subscription
      description: >-
        A field of the subscription that started the run (subscription triggers
        only), e.g. still cancelled, still paused.
      properties:
        type:
          const: sub_status
        field:
          type: string
          description: e.g. cancelled, paused, status, offered_save_gift, is_test.
        operator:
          type: string
          enum:
            - eq
            - neq
            - truthy
            - falsy
          description: ''
          default: eq
        value:
          description: For eq / neq.
      required:
        - type
        - field
      example:
        type: sub_status
        field: cancelled
        operator: truthy
    CheckNotSentRecently:
      type: object
      title: Not sent recently
      description: >-
        This flow has not completed for them in the last N days (one message for
        a customer who triggers it twice).
      properties:
        type:
          const: flow_not_sent_within
        days:
          type: integer
          description: ''
          minimum: 1
          maximum: 365
      required:
        - type
        - days
      example:
        type: flow_not_sent_within
        days: 30
    CheckSupportActive:
      type: object
      title: Talking to support
      description: >-
        Are they being helped by the team right now: an open ticket, or a team
        member wrote recently?
      properties:
        type:
          const: support_active
        operator:
          type: string
          enum:
            - is
            - is_not
          description: Use is_not so outreach never cuts into a support conversation.
        human_reply_hours:
          type: integer
          description: A team reply within this many hours counts.
        customer_message_hours:
          type: integer
          description: A message from them within this many hours counts.
      required:
        - type
        - operator
      example:
        type: support_active
        operator: is_not
    CheckReplied:
      type: object
      title: Replied
      description: >-
        Did they write to us (any channel) since the run started, or in the last
        N hours / days? Mostly used as a stop rule.
      properties:
        type:
          const: replied
        operator:
          type: string
          enum:
            - has
            - has_not
          description: ''
          default: has
        timeframe:
          type: object
          properties:
            type:
              type: string
              enum:
                - since_trigger
                - in_the_last
            value:
              type: integer
              description: ''
              minimum: 1
            unit:
              type: string
              enum:
                - hours
                - days
      required:
        - type
      example:
        type: replied
        operator: has
        timeframe:
          type: since_trigger
    CheckMessageEngagement:
      type: object
      title: Opened or clicked a message
      description: >-
        Did they open or click a message this flow sent them? Email: real opens
        and clicks (Apple Mail privacy and link scanners are not counted).
        WhatsApp: read, and a tap on the message's link.
      properties:
        type:
          const: message_engagement
        signal:
          type: string
          enum:
            - opened
            - clicked
        operator:
          type: string
          enum:
            - did
            - did_not
        step_id:
          type: string
          description: >-
            The message step to ask about. Leave out for the last message the
            flow sent.
      required:
        - type
        - signal
        - operator
      example:
        type: message_engagement
        signal: opened
        operator: did_not
        step_id: m1
    CheckEngagement:
      type: object
      title: Engaged lately
      description: Did they read, tap, reply, visit the store or order in the last N days?
      properties:
        type:
          const: engagement
        operator:
          type: string
          enum:
            - engaged
            - not_engaged
        days:
          type: integer
          description: ''
          minimum: 1
          maximum: 365
          default: 90
      required:
        - type
        - operator
      example:
        type: engagement
        operator: not_engaged
        days: 90
    CheckStoreActivity:
      type: object
      title: On the store lately
      description: Were they on the store (FlowIQ store pixel) in the last N days?
      properties:
        type:
          const: store_activity
        operator:
          type: string
          enum:
            - did
            - did_not
        event:
          type: string
          enum:
            - any
            - product_viewed
            - product_added_to_cart
            - checkout_started
          description: ''
          default: any
        days:
          type: integer
          description: ''
          minimum: 1
          maximum: 365
          default: 7
      required:
        - type
        - operator
      example:
        type: store_activity
        operator: did
        event: product_viewed
        days: 7
    CheckHoldout:
      type: object
      title: Comparison group
      description: >-
        Keeps a stable share of customers out of the flow so you can measure
        what it adds. The same customer is always in the same group.
      properties:
        type:
          const: holdout_check
        holdout_pct:
          type: integer
          description: The share held out, 1-99.
          minimum: 1
          maximum: 99
        programme:
          type: string
          description: Name the group so several flows share it.
          default: default
      required:
        - type
        - holdout_pct
      example:
        type: holdout_check
        holdout_pct: 10
        programme: replenishment
    CheckRandom:
      type: object
      title: Random share (split paths only)
      description: >-
        In a split path: this share of people, chosen at random, take the path.
        Paths with random shares make an A/B test; the shares may add up to 100
        at most.
      properties:
        type:
          const: random_sample
        percent:
          type: integer
          description: ''
          minimum: 1
          maximum: 100
      required:
        - type
        - percent
      example:
        type: random_sample
        percent: 50
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key lacks the read or write scope (code forbidden_scope)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        More than 600 reads or 60 changes a minute per key; Retry-After says
        when
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: fiq_ API key
      description: >-
        Your FlowIQ organisation API key (Settings → API Keys), sent as a bearer
        token. Format: `Bearer fiq_YOUR_API_KEY`

````

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