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

# Update or publish an automation

> One endpoint, two mutually-exclusive modes:

- **Update** — supply one or more of `name`, `description`, `nodes`, `connections`, `triggerEventId`. Graph updates persist a new `automationVersionId` on the same `automationId`. Add `dryRun: true` to validate a graph update without persisting.
- **Lifecycle** — supply `published: true` to promote the stored latest version live (validates the graph first → `409 PUBLISH_VALIDATION_FAILED` on blockers; optionally pin `automationVersionId` to publish a specific version), or `published: false` to unpublish.

Graph updates use the same strict typed filter/split condition contract as create: explicit `type`, canonical snake_case `operator`, no `value` for unary operators, and type-correct values everywhere else.

The two modes cannot be combined: publishing promotes the stored graph, so update first, then PATCH `{ "published": true }`. Returns the bare automation row.



## OpenAPI

````yaml /api-reference/openapi-public-v1.yaml patch /v1/automations/{automationId}
openapi: 3.1.0
info:
  title: Brew Public API v1
  version: 1.0.0
  description: >-
    Generated from the Brew app Zod contracts (`lib/<domain>/contracts.ts`).
    This file is the source of truth for the public API documentation.


    ## Resource paths


    Identity lives in the URL path (`/v1/analytics/sends/{sendId}`) — never in a
    query param or request body. Collections are plural top-level segments
    (`/v1/emails`); query params exist only for collection pagination + simple
    filters. Relationships are sub-resources (`/v1/emails/{emailId}/sends`), and
    non-CRUD operations are explicit action sub-paths
    (`/v1/automations/{automationId}/test`).


    ## Response envelopes


    - Lists: `{ data: Row[], pagination: { limit, cursor: string | null, hasMore
    } }` — loop `while (cursor !== null)`.

    - Get-one and writes: the bare resource (creates return `201`; async sends
    `202`).

    - Deletes: `{ <idField>, deleted: boolean }` — idempotent (already-gone ids
    resolve with `deleted: false`).

    - Errors: `{ error: { code, type, message, param?, suggestion, docs } }` —
    branch on the stable `code`.

    - ONE exception: `POST /v1/automations/triggers/{triggerEventId}/fire`
    responds with the legacy fire envelope `{ success, status, code, message,
    receivedAt, details }` (shared with internal webhook infrastructure).


    ## Brand scoping


    API keys are always scoped to a specific brand. The brand is resolved from
    the key on every request. **No public endpoint accepts a `brandId` field**
    in its request body or query string — sending one returns `400
    INVALID_REQUEST`. Resources that exist in a different brand surface as `404`
    (never `403`), so the API does not leak cross-brand existence. `GET
    /v1/templates` is organization-wide and not constrained to the key brand.
    Brands themselves are managed in the Brew dashboard.


    ## Idempotency


    Send an `Idempotency-Key` header (≤ 100 chars) on any POST your code might
    retry. Same key + same body within 24h returns the original response; same
    key + different body returns `409 IDEMPOTENCY_CONFLICT`.
  contact:
    name: Brew Support
    url: https://docs.brew.new
    email: support@brew.new
servers:
  - url: https://brew.new/api
    description: Production
  - url: http://localhost:3000/api
    description: Local development
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Emails
    description: >-
      Email designs and sending. Generate a design with the Brew email agent,
      edit, version, restore — then send it: `POST /v1/sends` delivers a design
      to a target (a saved audience, an inline list, or a single address) via a
      verified domain, and `POST /v1/sends/test` fires a one-off test. Sending
      is not campaign-specific. Send reads (list, status, per-send event feeds)
      live under Analytics (`/v1/analytics/sends`).
  - name: Analytics
    description: >-
      Read-only cross-resource analytics: lifetime per-campaign KPIs, windowed
      automation performance, the unified event feed, send reads
      (`/v1/analytics/sends`), and the fired-trigger audit log
      (`/v1/analytics/trigger-instances`).
  - name: Automations
    description: >-
      Automation graphs — deterministic create from explicit `nodes` +
      `connections`, update, version, publish / unpublish, test. Includes
      trigger event definitions + the fire endpoint (`/v1/automations/triggers`)
      and run history (`/v1/automations/runs`).
  - name: Contacts
    description: Create, search, patch, and delete contacts. Email is the primary key.
  - name: Contact Fields
    description: List, create, and delete custom contact field definitions.
  - name: Audiences
    description: Saved contact filter sets — a recipient target for sends.
  - name: Domains
    description: 'Sending domains: add, read DNS records, verify, configure sender defaults.'
  - name: Templates
    description: Public template gallery (read-only) usable as generation references.
  - name: Brand
    description: The single brand bound to the API key.
  - name: Chats
    description: >-
      Read a brand-scoped digest of a Brew chat — referenced
      emails/automations/triggers + a trimmed transcript — so an external agent
      can resume the conversation.
  - name: Meta
    description: >-
      Public discovery surface (no auth): the machine-readable API catalog
      (`/v1/help`).
paths:
  /v1/automations/{automationId}:
    patch:
      tags:
        - Automations
      summary: Update or publish an automation
      description: >-
        One endpoint, two mutually-exclusive modes:


        - **Update** — supply one or more of `name`, `description`, `nodes`,
        `connections`, `triggerEventId`. Graph updates persist a new
        `automationVersionId` on the same `automationId`. Add `dryRun: true` to
        validate a graph update without persisting.

        - **Lifecycle** — supply `published: true` to promote the stored latest
        version live (validates the graph first → `409
        PUBLISH_VALIDATION_FAILED` on blockers; optionally pin
        `automationVersionId` to publish a specific version), or `published:
        false` to unpublish.


        Graph updates use the same strict typed filter/split condition contract
        as create: explicit `type`, canonical snake_case `operator`, no `value`
        for unary operators, and type-correct values everywhere else.


        The two modes cannot be combined: publishing promotes the stored graph,
        so update first, then PATCH `{ "published": true }`. Returns the bare
        automation row.
      operationId: updateAutomation
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 64
            description: >-
              Automation id returned by `POST /v1/automations` and listed by
              `GET /v1/automations`.
            example: auto_abc
          required: true
          description: >-
            Automation id returned by `POST /v1/automations` and listed by `GET
            /v1/automations`.
          name: automationId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationsUpdateRequest'
            examples:
              rename:
                summary: Rename
                value:
                  name: Welcome flow v2
              graph:
                summary: Replace the graph
                value:
                  nodes:
                    - id: trg
                      label: On signup
                      type: trigger
                      config:
                        actionType: trigger
                    - id: send_welcome
                      label: Welcome
                      type: sendEmail
                      config:
                        actionType: sendEmail
                        emailId: eml_welcome
                        emailVersionId: emv_welcome_v1
                        domainId: kx7bkh53hasmfeh5kd7sqgykt187g8ww
                        subject: Welcome to Brew, {{firstName | there}}!
                        previewText: Thanks for signing up — get started in 2 minutes.
                        fromName: Brew
                        replyTo: support@example.com
                  connections:
                    - from: trg
                      to: send_welcome
              publish:
                summary: Publish (promote live)
                value:
                  published: true
              publishVersion:
                summary: Publish a pinned version
                value:
                  published: true
                  automationVersionId: av_v2
              unpublish:
                summary: Unpublish
                value:
                  published: false
      responses:
        '200':
          description: >-
            Updated / published / unpublished. The bare automation row (or the
            dry-run result when `dryRun: true`).
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
            X-RateLimit-Limit:
              schema:
                type: integer
                description: Requests allowed in the current rolling rate limit window.
                example: 100
              required: true
              description: Requests allowed in the current rolling rate limit window.
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: Requests remaining in the current rolling rate limit window.
                example: 99
              required: true
              description: Requests remaining in the current rolling rate limit window.
            X-RateLimit-Reset:
              schema:
                type: integer
                description: >-
                  Unix timestamp in seconds for when the rolling window fully
                  resets.
                example: 1712592360
              required: true
              description: >-
                Unix timestamp in seconds for when the rolling window fully
                resets.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationRow'
              example:
                automationId: auto_abc
                automationVersionId: av_v1
                triggerEventId: tri_signup
                name: Welcome flow
                version: latest
                published: false
                nodes:
                  - id: trg
                    label: On signup
                    type: trigger
                    config:
                      actionType: trigger
                  - id: send_welcome
                    label: Welcome
                    type: sendEmail
                    config:
                      actionType: sendEmail
                      emailId: eml_welcome
                      emailVersionId: emv_welcome_v1
                      domainId: kx7bkh53hasmfeh5kd7sqgykt187g8ww
                      subject: Welcome to Brew, {{firstName | there}}!
                      previewText: Thanks for signing up — get started in 2 minutes.
                      fromName: Brew
                      replyTo: support@example.com
                connections:
                  - from: trg
                    to: send_welcome
                emailIds:
                  - eml_welcome
                createdAt: '2026-04-08T12:00:00.000Z'
                updatedAt: '2026-04-08T12:00:00.000Z'
        '400':
          description: >-
            Strict-body violation, no actionable field supplied, `published`
            combined with update fields, or `AUTOMATION_GRAPH_INVALID` (see
            `details.issues`).
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: INVALID_REQUEST
                  type: invalid_request
                  message: >-
                    Provide `published` to publish/unpublish, or at least one of
                    `name`, `description`, `nodes`, `connections`, or
                    `triggerEventId` to update.
                  suggestion: >-
                    Send a lifecycle (`published`) or at least one editable
                    field.
                  docs: https://docs.brew.new/api-reference/api/errors
                  param: published
        '401':
          description: The API key was missing, invalid, or revoked.
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: INVALID_API_KEY
                  type: authentication_error
                  message: The provided API key is invalid.
                  suggestion: Check the API key format and retry with a valid active key.
                  docs: https://docs.brew.new/api-reference/api/authentication
        '403':
          description: The caller does not have the required `automations` permission.
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: INSUFFICIENT_PERMISSIONS
                  type: authorization_error
                  message: The caller does not have the required permission.
                  suggestion: Use an API key or session with the required permission.
                  docs: https://docs.brew.new/api-reference/api/authentication
                  param: automations
        '404':
          description: >-
            Automation not found in the API-key brand. Cross-brand ids
            intentionally surface as 404 (never 403) so the API does not leak
            cross-brand existence.
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: AUTOMATION_NOT_FOUND
                  type: not_found
                  message: Automation 'auto_xxx' was not found.
                  suggestion: List automations with GET /v1/automations.
                  docs: https://docs.brew.new/api-reference/api/errors
                  param: automationId
        '409':
          description: >-
            `PUBLISH_VALIDATION_FAILED` — `published: true` but the graph has
            blockers (see `details.blockers`).
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: PUBLISH_VALIDATION_FAILED
                  type: conflict
                  message: Add at least one Send Email action
                  suggestion: >-
                    Fix every blocker reported in `details.blockers` then
                    publish again.
                  docs: https://docs.brew.new/api-reference/api/errors
                  param: published
        '422':
          description: >-
            `AUTOMATION_NOT_PUBLISHED` — `published: false` but the automation
            was never published (nothing to unpublish).
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: AUTOMATION_NOT_PUBLISHED
                  type: invalid_request
                  message: >-
                    Automation 'auto_abc' is not currently published — nothing
                    to unpublish.
                  suggestion: >-
                    Verify the automation is published via GET
                    /v1/automations?automationId=.
                  docs: https://docs.brew.new/api-reference/api/errors
                  param: published
        '429':
          description: The request hit the rolling rate limit window.
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
            X-RateLimit-Limit:
              schema:
                type: integer
                description: Requests allowed in the current rolling rate limit window.
                example: 100
              required: true
              description: Requests allowed in the current rolling rate limit window.
            X-RateLimit-Remaining:
              schema:
                type: integer
                description: Requests remaining in the current rolling rate limit window.
                example: 99
              required: true
              description: Requests remaining in the current rolling rate limit window.
            X-RateLimit-Reset:
              schema:
                type: integer
                description: >-
                  Unix timestamp in seconds for when the rolling window fully
                  resets.
                example: 1712592360
              required: true
              description: >-
                Unix timestamp in seconds for when the rolling window fully
                resets.
            Retry-After:
              schema:
                type: integer
                description: Seconds to wait before retrying the request.
                example: 42
              required: true
              description: Seconds to wait before retrying the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: RATE_LIMITED
                  type: rate_limit
                  message: Too many requests.
                  suggestion: Wait for the retry window before sending another request.
                  docs: https://docs.brew.new/api-reference/api/rate-limits
                  retryAfter: 42
        '500':
          description: Unexpected internal error.
          headers:
            x-request-id:
              schema:
                type: string
                description: >-
                  Unique request identifier. Share this with support when
                  debugging a request.
                example: req_8cac13fd94e6420cacdd75a1aa403a28
              required: true
              description: >-
                Unique request identifier. Share this with support when
                debugging a request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              example:
                error:
                  code: INTERNAL_ERROR
                  type: internal_error
                  message: An unexpected error occurred.
                  suggestion: Retry the request. If it keeps failing, contact support.
                  docs: https://docs.brew.new/api-reference/api/errors
components:
  schemas:
    AutomationsUpdateRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        description:
          type: string
          maxLength: 2000
        nodes:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - trigger
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      mode:
                        type: string
                        enum:
                          - event
                          - manualAudience
                      triggerEventId:
                        type: string
                      audienceId:
                        type: string
                      eventName:
                        type: string
                required:
                  - id
                  - label
                  - type
                  - config
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - sendEmail
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      emailId:
                        type: string
                        minLength: 1
                      emailVersionId:
                        type: string
                        minLength: 1
                      domainId:
                        type: string
                        minLength: 1
                      subject:
                        type: string
                        minLength: 1
                      previewText:
                        type: string
                        minLength: 1
                      messageClass:
                        type: string
                        enum:
                          - marketing
                          - transactional
                        default: marketing
                      fromName:
                        type: string
                        minLength: 1
                      replyTo:
                        type: string
                        format: email
                      emailTitle:
                        type: string
                      fromAddress:
                        type: string
                    required:
                      - emailId
                      - emailVersionId
                      - domainId
                      - subject
                      - previewText
                    additionalProperties: false
                required:
                  - id
                  - label
                  - type
                  - config
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - wait
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      duration:
                        type: number
                      unit:
                        type: string
                        enum:
                          - ms
                          - seconds
                          - minutes
                          - hours
                          - days
                          - weeks
                    required:
                      - duration
                      - unit
                required:
                  - id
                  - label
                  - type
                  - config
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - filter
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      logicalOperator:
                        type: string
                        enum:
                          - AND
                          - OR
                      conditions:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - string
                                operator:
                                  type: string
                                  enum:
                                    - equals
                                    - not_equals
                                    - contains
                                    - not_contains
                                    - starts_with
                                    - ends_with
                                value:
                                  type: string
                                  description: String value to compare against.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - number
                                operator:
                                  type: string
                                  enum:
                                    - equals
                                    - not_equals
                                    - gt
                                    - gte
                                    - lt
                                    - lte
                                value:
                                  type: number
                                  description: Finite numeric value to compare against.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - date
                                operator:
                                  type: string
                                  enum:
                                    - equals
                                    - not_equals
                                    - gt
                                    - gte
                                    - lt
                                    - lte
                                value:
                                  anyOf:
                                    - type: string
                                      minLength: 1
                                    - type: number
                                  description: >-
                                    ISO date string or Unix timestamp in
                                    milliseconds to compare against.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - string
                                operator:
                                  type: string
                                  enum:
                                    - in
                                    - not_in
                                    - contains_any
                                    - not_contains_any
                                value:
                                  type: array
                                  items:
                                    type: string
                                    minLength: 1
                                  minItems: 1
                                  description: >-
                                    Non-empty array of string values to compare
                                    against.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - number
                                operator:
                                  type: string
                                  enum:
                                    - in
                                    - not_in
                                value:
                                  type: array
                                  items:
                                    type: number
                                  minItems: 1
                                  description: >-
                                    Non-empty array of finite numbers to compare
                                    against.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - number
                                operator:
                                  type: string
                                  enum:
                                    - between
                                value:
                                  type: array
                                  prefixItems:
                                    - type: number
                                    - type: number
                                  description: Inclusive [minimum, maximum] numeric bounds.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - date
                                operator:
                                  type: string
                                  enum:
                                    - between
                                value:
                                  type: array
                                  prefixItems:
                                    - anyOf:
                                        - type: string
                                          minLength: 1
                                        - type: number
                                    - anyOf:
                                        - type: string
                                          minLength: 1
                                        - type: number
                                  description: >-
                                    Inclusive [start, end] ISO-date or
                                    Unix-millisecond timestamp bounds.
                              required:
                                - field
                                - type
                                - operator
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - string
                                operator:
                                  type: string
                                  enum:
                                    - is_empty
                                    - is_not_empty
                                  description: Unary empty check; do not provide a value.
                              required:
                                - field
                                - type
                                - operator
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - number
                                operator:
                                  type: string
                                  enum:
                                    - is_empty
                                    - is_not_empty
                                  description: Unary empty check; do not provide a value.
                              required:
                                - field
                                - type
                                - operator
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - date
                                operator:
                                  type: string
                                  enum:
                                    - is_empty
                                    - is_not_empty
                                  description: Unary empty check; do not provide a value.
                              required:
                                - field
                                - type
                                - operator
                              additionalProperties: false
                            - type: object
                              properties:
                                field:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Trigger payload field name or dot path, for
                                    example trackingNumber or order.total.
                                type:
                                  type: string
                                  enum:
                                    - bool
                                operator:
                                  type: string
                                  enum:
                                    - is_true
                                    - is_false
                                  description: Unary boolean check; do not provide a value.
                              required:
                                - field
                                - type
                                - operator
                              additionalProperties: false
                        minItems: 1
                    required:
                      - logicalOperator
                      - conditions
                    additionalProperties: false
                required:
                  - id
                  - label
                  - type
                  - config
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - split
                  config:
                    oneOf:
                      - type: object
                        properties:
                          actionType:
                            type: string
                          mode:
                            type: string
                            enum:
                              - percentage
                          leftLabel:
                            type: string
                          rightLabel:
                            type: string
                          leftPercentage:
                            type: number
                            minimum: 0
                            maximum: 100
                          seed:
                            type: string
                        required:
                          - mode
                          - leftLabel
                          - rightLabel
                          - leftPercentage
                        additionalProperties: false
                      - type: object
                        properties:
                          actionType:
                            type: string
                          mode:
                            type: string
                            enum:
                              - condition
                          leftLabel:
                            type: string
                          rightLabel:
                            type: string
                          logicalOperator:
                            type: string
                            enum:
                              - AND
                              - OR
                          conditions:
                            type: array
                            items:
                              anyOf:
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - string
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                        - contains
                                        - not_contains
                                        - starts_with
                                        - ends_with
                                    value:
                                      type: string
                                      description: String value to compare against.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - number
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                        - gt
                                        - gte
                                        - lt
                                        - lte
                                    value:
                                      type: number
                                      description: Finite numeric value to compare against.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - date
                                    operator:
                                      type: string
                                      enum:
                                        - equals
                                        - not_equals
                                        - gt
                                        - gte
                                        - lt
                                        - lte
                                    value:
                                      anyOf:
                                        - type: string
                                          minLength: 1
                                        - type: number
                                      description: >-
                                        ISO date string or Unix timestamp in
                                        milliseconds to compare against.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - string
                                    operator:
                                      type: string
                                      enum:
                                        - in
                                        - not_in
                                        - contains_any
                                        - not_contains_any
                                    value:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                      minItems: 1
                                      description: >-
                                        Non-empty array of string values to
                                        compare against.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - number
                                    operator:
                                      type: string
                                      enum:
                                        - in
                                        - not_in
                                    value:
                                      type: array
                                      items:
                                        type: number
                                      minItems: 1
                                      description: >-
                                        Non-empty array of finite numbers to
                                        compare against.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - number
                                    operator:
                                      type: string
                                      enum:
                                        - between
                                    value:
                                      type: array
                                      prefixItems:
                                        - type: number
                                        - type: number
                                      description: >-
                                        Inclusive [minimum, maximum] numeric
                                        bounds.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - date
                                    operator:
                                      type: string
                                      enum:
                                        - between
                                    value:
                                      type: array
                                      prefixItems:
                                        - anyOf:
                                            - type: string
                                              minLength: 1
                                            - type: number
                                        - anyOf:
                                            - type: string
                                              minLength: 1
                                            - type: number
                                      description: >-
                                        Inclusive [start, end] ISO-date or
                                        Unix-millisecond timestamp bounds.
                                  required:
                                    - field
                                    - type
                                    - operator
                                    - value
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - string
                                    operator:
                                      type: string
                                      enum:
                                        - is_empty
                                        - is_not_empty
                                      description: >-
                                        Unary empty check; do not provide a
                                        value.
                                  required:
                                    - field
                                    - type
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - number
                                    operator:
                                      type: string
                                      enum:
                                        - is_empty
                                        - is_not_empty
                                      description: >-
                                        Unary empty check; do not provide a
                                        value.
                                  required:
                                    - field
                                    - type
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - date
                                    operator:
                                      type: string
                                      enum:
                                        - is_empty
                                        - is_not_empty
                                      description: >-
                                        Unary empty check; do not provide a
                                        value.
                                  required:
                                    - field
                                    - type
                                    - operator
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    field:
                                      type: string
                                      minLength: 1
                                      description: >-
                                        Trigger payload field name or dot path,
                                        for example trackingNumber or
                                        order.total.
                                    type:
                                      type: string
                                      enum:
                                        - bool
                                    operator:
                                      type: string
                                      enum:
                                        - is_true
                                        - is_false
                                      description: >-
                                        Unary boolean check; do not provide a
                                        value.
                                  required:
                                    - field
                                    - type
                                    - operator
                                  additionalProperties: false
                            minItems: 1
                        required:
                          - mode
                          - leftLabel
                          - rightLabel
                          - logicalOperator
                          - conditions
                        additionalProperties: false
                required:
                  - id
                  - label
                  - type
                  - config
                additionalProperties: false
          maxItems: 500
        connections:
          type: array
          items:
            type: object
            properties:
              from:
                type: string
                minLength: 1
              to:
                type: string
                minLength: 1
              branch:
                type: string
                enum:
                  - left
                  - right
            required:
              - from
              - to
            additionalProperties: false
          maxItems: 1000
        triggerEventId:
          type: string
          minLength: 1
          maxLength: 256
        dryRun:
          type: boolean
        published:
          type: boolean
        automationVersionId:
          type: string
          minLength: 1
          maxLength: 64
        stop_in_flight:
          type: boolean
        paused:
          type: boolean
      additionalProperties: false
    AutomationRow:
      type: object
      properties:
        automationId:
          type: string
          minLength: 1
          maxLength: 64
        automationVersionId:
          type: string
          minLength: 1
          maxLength: 64
        triggerEventId:
          type: string
          minLength: 1
          maxLength: 256
        name:
          type: string
          minLength: 1
          maxLength: 120
        description:
          type: string
          maxLength: 2000
        version:
          anyOf:
            - type: integer
              minimum: 0
            - type: string
              enum:
                - latest
        published:
          type: boolean
        paused:
          type: boolean
        pausedAt:
          type: number
        nodes:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - trigger
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      mode:
                        type: string
                        enum:
                          - event
                          - manualAudience
                      triggerEventId:
                        type: string
                      audienceId:
                        type: string
                      eventName:
                        type: string
                required:
                  - id
                  - label
                  - type
                  - config
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - sendEmail
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      emailId:
                        type: string
                      emailVersionId:
                        type: string
                      emailTitle:
                        type: string
                      subject:
                        type: string
                      previewText:
                        type: string
                      messageClass:
                        type: string
                        enum:
                          - marketing
                          - transactional
                      fromName:
                        type: string
                      fromAddress:
                        type: string
                      domainId:
                        type: string
                      replyTo:
                        type: string
                      to: {}
                      html:
                        type: string
                      variables:
                        type: object
                        additionalProperties: {}
                required:
                  - id
                  - label
                  - type
                  - config
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - wait
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      duration:
                        type: number
                      unit:
                        type: string
                        enum:
                          - ms
                          - seconds
                          - minutes
                          - hours
                          - days
                          - weeks
                    required:
                      - duration
                      - unit
                required:
                  - id
                  - label
                  - type
                  - config
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - filter
                  config:
                    type: object
                    properties:
                      actionType:
                        type: string
                      logicalOperator:
                        type: string
                        enum:
                          - AND
                          - OR
                      conditions:
                        type: array
                        items:
                          type: object
                          properties:
                            field:
                              type: string
                            operator:
                              type: string
                            value:
                              anyOf:
                                - type: string
                                - type: number
                                - type: boolean
                                - type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                            type:
                              type: string
                              enum:
                                - string
                                - number
                                - date
                                - bool
                          required:
                            - field
                            - operator
                    required:
                      - logicalOperator
                      - conditions
                required:
                  - id
                  - label
                  - type
                  - config
              - type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  description:
                    type: string
                  type:
                    type: string
                    enum:
                      - split
                  config:
                    oneOf:
                      - type: object
                        properties:
                          actionType:
                            type: string
                          mode:
                            type: string
                            enum:
                              - percentage
                          leftLabel:
                            type: string
                          rightLabel:
                            type: string
                          leftPercentage:
                            type: number
                          seed:
                            type: string
                        required:
                          - mode
                          - leftLabel
                          - rightLabel
                          - leftPercentage
                      - type: object
                        properties:
                          actionType:
                            type: string
                          mode:
                            type: string
                            enum:
                              - condition
                          leftLabel:
                            type: string
                          rightLabel:
                            type: string
                          logicalOperator:
                            type: string
                            enum:
                              - AND
                              - OR
                          conditions:
                            type: array
                            items:
                              type: object
                              properties:
                                field:
                                  type: string
                                operator:
                                  type: string
                                value:
                                  anyOf:
                                    - type: string
                                    - type: number
                                    - type: boolean
                                    - type: array
                                      items:
                                        anyOf:
                                          - type: string
                                          - type: number
                                type:
                                  type: string
                                  enum:
                                    - string
                                    - number
                                    - date
                                    - bool
                              required:
                                - field
                                - operator
                        required:
                          - mode
                          - leftLabel
                          - rightLabel
                          - logicalOperator
                          - conditions
                required:
                  - id
                  - label
                  - type
                  - config
        connections:
          type: array
          items:
            type: object
            properties:
              from:
                type: string
                minLength: 1
              to:
                type: string
                minLength: 1
              branch:
                type: string
                enum:
                  - left
                  - right
            required:
              - from
              - to
        emailIds:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 64
        createdBy:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        publishedAt:
          type: string
          format: date-time
        versions:
          type: array
          items:
            type: object
            properties:
              version:
                anyOf:
                  - type: integer
                    minimum: 0
                  - type: string
                    enum:
                      - latest
              automationVersionId:
                type: string
                minLength: 1
                maxLength: 64
            required:
              - version
              - automationVersionId
            additionalProperties: false
      required:
        - automationId
        - automationVersionId
        - name
        - version
        - published
        - emailIds
      additionalProperties: false
    ApiErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              minLength: 1
            type:
              type: string
              enum:
                - authentication_error
                - authorization_error
                - invalid_request
                - not_found
                - not_implemented
                - conflict
                - rate_limit
                - payment_required
                - service_unavailable
                - internal_error
            message:
              type: string
              minLength: 1
            param:
              type: string
              minLength: 1
            suggestion:
              type: string
              minLength: 1
            docs:
              type: string
              format: uri
            retryAfter:
              type: integer
              minimum: 0
            details:
              type: object
              additionalProperties: {}
          required:
            - code
            - type
            - message
            - suggestion
            - docs
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'Send your Brew API key as `Authorization: Bearer brew_xxx`.'
      x-default: Bearer brew_your_api_key
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'Send your Brew API key as `X-API-Key: brew_xxx`.'
      x-default: brew_your_api_key

````