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

# Replace steps

> Replace the full step graph. Duplicate step IDs fail with `409 campaign_flow_duplicate_step_id`.



## OpenAPI

````yaml /api-reference/openapi.json put /v1/email-flows/{flowId}/steps
openapi: 3.1.0
info:
  title: Tented API
  version: 1.0.0
  description: >-
    The Tented public API: generate, publish, and manage AI-built web pages
    (tents), and run the email platform — contacts, reusable emails, one-time
    blasts, and triggered flows.


    ## Authentication

    Authenticate every request with a workspace API key: `Authorization: Bearer
    <api-key>`. Keys are created in **Workspace Settings → API Keys** and are
    scoped to a single workspace.


    ## Asynchronous work

    Tent generation, bulk creation, and email AI generation return `202
    Accepted` immediately. Poll the corresponding status endpoint (`GET
    /v1/tents/{tentId}`, `GET /v1/bulk-jobs/{bulkJobId}`, `GET
    /v1/emails/{emailId}/generations/{generationId}`) — no more than every 10
    seconds.


    ## Pagination

    Email listings use cursor pagination (`cursor`/`next_cursor`). Blast, flow,
    and member listings use page pagination (`page`/`limit` with a `pagination`
    object in the response).


    ## Conventions

    Request and response fields are snake_case, with two exceptions: analytics
    query parameters (`tentIdOrAlias`, `daysBack`) and segment rule trees
    (camelCase keys such as `listId` and `timeWindow`).
  contact:
    name: Tented Support
    email: support@tented.ai
servers:
  - url: https://api.tented.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Tents
    description: >-
      Create, edit, publish, and manage AI-generated pages, including asset
      uploads and bulk creation.
  - name: Analytics
    description: Traffic analytics for single tents and the whole workspace.
  - name: Contacts
    description: >-
      Batch create, update, and delete contacts. Up to 25 items per request with
      per-item results.
  - name: Emails
    description: >-
      Reusable email content: AI generation, direct HTML edits, plain-text
      control, and approval.
  - name: Email Blasts
    description: >-
      One-time sends to an audience: compose, schedule, track engagement, export
      recipients.
  - name: Triggered Flows
    description: >-
      Multi-step automations that enroll contacts on triggers and move them
      through a step graph.
  - name: Contact Imports
  - name: Contact Fields
  - name: Contact Lists
  - name: Email Templates
  - name: Tent Templates
    description: >-
      Reusable, AI-editable tent layouts. Create from HTML or an existing tent,
      iterate with AI, approve, and clone. Approved tent templates seed new
      tents.
paths:
  /v1/email-flows/{flowId}/steps:
    put:
      tags:
        - Triggered Flows
      summary: Replace steps
      description: >-
        Replace the full step graph. Duplicate step IDs fail with `409
        campaign_flow_duplicate_step_id`.
      operationId: replace-flow-steps
      parameters:
        - name: flowId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Flow ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                steps:
                  type: array
                  items:
                    $ref: '#/components/schemas/FlowStep'
                  maxItems: 100
                  description: The new step list (up to 100).
              required:
                - steps
      responses:
        '200':
          description: Steps replaced.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Flow'
        '400':
          description: >-
            Bad request — invalid parameters or request body. Validation
            failures include `details.issues` with per-field messages.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized — missing, malformed, revoked, or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            Not found — the resource does not exist in the workspace tied to
            your API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict — see `error_code` for the specific reason.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    FlowStep:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - send_email
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            email_id:
              type: string
              format: uuid
              description: >-
                Email to send. Must be approved before the flow can be
                activated.
            operational:
              type: boolean
              description: >-
                Send as operational/transactional (skips unsubscribe suppression
                and footer).
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: Send an email to the contact.
        - type: object
          properties:
            type:
              type: string
              enum:
                - wait
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            duration_amount:
              type: integer
              description: Wait length (with `duration_unit`).
            duration_unit:
              type: string
              enum:
                - minutes
                - hours
                - days
                - weeks
              description: Wait unit.
            until_date_field:
              type: string
              description: Wait until the date stored in this contact field.
            condition:
              $ref: '#/components/schemas/RuleNode'
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: >-
            Pause the contact. Configure exactly one mode: a fixed duration, a
            target date field, or a condition to wait for.
        - type: object
          properties:
            type:
              type: string
              enum:
                - update_contact
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            updates:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: Contact field or custom field API name.
                  value:
                    description: New value.
                  write_mode:
                    type: string
                    enum:
                      - overwrite
                      - skip_if_filled
                    default: overwrite
                    description: Whether to overwrite existing values.
                required:
                  - field
              description: Field updates to apply.
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: Update fields on the contact.
        - type: object
          properties:
            type:
              type: string
              enum:
                - add_to_list
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            list_id:
              type: string
              format: uuid
              description: Static list to add the contact to.
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: Add the contact to a static list.
        - type: object
          properties:
            type:
              type: string
              enum:
                - remove_from_list
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            list_id:
              type: string
              format: uuid
              description: Static list to remove the contact from.
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: Remove the contact from a static list.
        - type: object
          properties:
            type:
              type: string
              enum:
                - condition_check
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            condition:
              $ref: '#/components/schemas/RuleNode'
            true_step_id:
              type: string
              description: Step when the condition is true.
            false_step_id:
              type: string
              description: Step when the condition is false.
            default_step_id:
              type: string
              description: Fallback step.
          required:
            - type
            - step_id
          description: >-
            Branch on a condition. Flow-only `email_step` conditions can test
            engagement with an earlier `send_email` step.
        - type: object
          properties:
            type:
              type: string
              enum:
                - create_tent
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            source:
              type: string
              enum:
                - scratch
                - template
              description: Start from scratch or from a template.
            template_id:
              type: string
              description: 'Template ID (with `source: template`).'
            prompt:
              type: string
              description: Generation prompt. Supports `{{contact.*}}` merge tokens.
            auto_publish:
              type: boolean
              description: Publish automatically after generation.
            custom_page_alias:
              type: string
              description: Published alias. Supports `{{contact.*}}` merge tokens.
            tent_name:
              type: string
              description: Tent name. Supports `{{contact.*}}` merge tokens.
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: Generate a personalized tent for the contact.
        - type: object
          properties:
            type:
              type: string
              enum:
                - send_webhook
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
            endpoint_url:
              type: string
              description: Public HTTP(S) endpoint to call.
            method:
              type: string
              enum:
                - post
                - put
                - get
              default: post
              description: HTTP method.
            auth_type:
              type: string
              enum:
                - none
                - jwt
              description: Authentication for the call.
            token:
              type: string
              description: 'JWT signing token (with `auth_type: jwt`).'
            secret_arn:
              type: string
              description: 'Secret reference for the JWT key (with `auth_type: jwt`).'
            custom_fields:
              type: object
              additionalProperties: true
              description: Extra fields merged into the webhook payload.
            next_step_id:
              type: string
              description: Step to run next. Omit to end the flow after this step.
          required:
            - type
            - step_id
          description: Call an external webhook with contact context.
        - type: object
          properties:
            type:
              type: string
              enum:
                - drop_from_flow
            step_id:
              type: string
              minLength: 1
              maxLength: 120
              description: Unique step identifier within the flow (1–120 characters).
            label:
              type: string
              description: Optional display label.
          required:
            - type
            - step_id
          description: 'Terminal step: immediately remove the contact from the flow.'
      description: >-
        A flow step. A flow may contain up to 100 steps. Steps link via
        `next_step_id` (or the branch fields on `condition_check`); omitting a
        link ends the flow.
    Flow:
      type: object
      properties:
        flow_id:
          type: string
          format: uuid
          description: Flow ID.
        type:
          type: string
          description: Always `triggered_flow`.
        name:
          type: string
          description: Flow name.
        description:
          type:
            - string
            - 'null'
          description: Description.
        status:
          type: string
          enum:
            - draft
            - active
            - paused
            - archived
          description: >-
            Lifecycle state. Structure is editable only while `draft` or
            `paused`.
        triggers:
          type: array
          items:
            $ref: '#/components/schemas/FlowTrigger'
          description: Entry triggers.
        steps:
          type: array
          items:
            $ref: '#/components/schemas/FlowStep'
          description: Step graph.
        disqualification_rules:
          $ref: '#/components/schemas/RuleNode'
          description: >-
            Contacts matching these rules are dropped (evaluated continuously).
            `null` when unset.
        reentry_policy:
          type: string
          enum:
            - allow
            - no_reentry
          description: Whether contacts may re-enter after exiting.
        manual_membership_enabled:
          type: boolean
          description: Whether contacts can be added via the API.
        settings:
          type: object
          additionalProperties: true
          description: Free-form flow settings (max 16 KB).
        details:
          $ref: '#/components/schemas/FlowDetails'
        archived_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the flow was archived.
        created_at:
          type: string
          format: date-time
          description: Creation time.
        updated_at:
          type: string
          format: date-time
          description: Last update.
      required:
        - flow_id
        - type
        - name
        - status
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
        error_code:
          type: string
          description: >-
            Stable machine-readable error code (present on email, blast, flow,
            and related endpoints, e.g. `campaign_not_ready`,
            `generation_in_progress`).
        message:
          type: string
          description: Additional human-readable context (present on some tent endpoints).
        code:
          type: string
          description: >-
            Machine-readable code used by tent creation errors (e.g.
            `INVALID_PROMPT_INTENT`).
        details:
          type: object
          additionalProperties: true
          description: >-
            Additional error context. Validation errors include `issues`: an
            array of `{ path, message }` objects.
        limit:
          type: integer
          description: Plan limit that was hit (present on `429` publish-limit errors).
        current:
          type: integer
          description: >-
            Current usage against the limit (present on `429` publish-limit
            errors).
      required:
        - error
      description: >-
        Error response. All errors include `error`; the other fields vary by
        endpoint group.
    RuleNode:
      oneOf:
        - $ref: '#/components/schemas/RuleGroup'
        - $ref: '#/components/schemas/RuleCondition'
      description: >-
        A rule tree node: either a group of nested conditions or a single
        condition. NOTE: rule trees use camelCase keys (`listId`,
        `fieldDefinitionId`, `timeWindow`), unlike the rest of the API.
    FlowTrigger:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - added_to_static_list
            list_id:
              type: string
              format: uuid
              description: Static list to watch.
          required:
            - type
            - list_id
          description: Fires when a contact is added to the list.
        - type: object
          properties:
            type:
              type: string
              enum:
                - removed_from_static_list
            list_id:
              type: string
              format: uuid
              description: Static list to watch.
          required:
            - type
            - list_id
          description: Fires when a contact is removed from the list.
        - type: object
          properties:
            type:
              type: string
              enum:
                - contact_created
          required:
            - type
          description: Fires when a contact is created.
        - type: object
          properties:
            type:
              type: string
              enum:
                - contact_updated
            field:
              type: string
              description: >-
                Contact field to watch — camelCase standard key (e.g.
                `leadStatus`) or a custom field API name.
            operator:
              type: string
              description: Optional filter on the new value; `changed` fires on any change.
            value:
              description: Value to compare against, when `operator` takes one.
          required:
            - type
            - field
          description: Fires when a contact field changes.
        - type: object
          properties:
            type:
              type: string
              enum:
                - date_based
            field:
              type: string
              description: '`createdAt` or an active custom date field.'
            mode:
              type: string
              enum:
                - on_date
                - before_date
                - after_date
              description: When to fire relative to the date.
            days_before:
              type: integer
              minimum: 0
              description: Days before the date (with `before_date`).
            days_after:
              type: integer
              minimum: 0
              description: Days after the date (with `after_date`).
            include_anniversaries:
              type: boolean
              description: Fire every year on the anniversary.
            trigger_time:
              type: string
              default: '09:00'
              description: Time of day, `HH:00` or `HH:30`.
            timezone:
              type: string
              default: UTC
              description: IANA timezone.
          required:
            - type
            - field
            - mode
          description: Fires on (or around) a date stored on the contact.
        - type: object
          properties:
            type:
              type: string
              enum:
                - form_submitted
            tent_id:
              type: string
              format: uuid
              description: Tent containing the form.
            form_id:
              type: string
              maxLength: 200
              description: Form identifier within the tent.
          required:
            - type
            - tent_id
            - form_id
          description: Fires when a specific tent form is submitted.
      description: >-
        A flow entry trigger. A flow may define up to 25 triggers. Triggers fire
        on new events only — activating a flow never retroactively enrolls
        contacts.
    FlowDetails:
      type: object
      properties:
        total_entered:
          type: integer
          description: Contacts that ever entered.
        active_count:
          type: integer
          description: Currently active members.
        waiting_count:
          type: integer
          description: Members in a wait step.
        completed_count:
          type: integer
          description: Members that completed the flow.
        dropped_count:
          type: integer
          description: Members dropped before completing.
        most_recent_entry_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Most recent enrollment.
      description: Aggregate membership counters.
    RuleGroup:
      type: object
      properties:
        kind:
          type: string
          enum:
            - group
          description: Set to `group` (default when `conditions` is present).
        operator:
          type: string
          enum:
            - and
            - or
          default: and
          description: How child conditions combine.
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/RuleNode'
          description: >-
            Child nodes. Groups nest up to 5 levels; a tree may contain at most
            100 nodes.
      required:
        - conditions
    RuleCondition:
      type: object
      properties:
        kind:
          type: string
          enum:
            - condition
          description: >-
            Set to `condition` (default when `operator` is present without
            `conditions`).
        source:
          type: string
          enum:
            - contact
            - custom_field
            - activity
            - list_membership
            - email_step
          default: contact
          description: What the condition tests.
        field:
          type: string
          description: >-
            Standard contact field in camelCase (e.g. `leadStatus`,
            `tentedScore`, `createdAt`). Used with `source: contact`.
        fieldDefinitionId:
          type: string
          format: uuid
          description: 'Active custom-field definition ID. Used with `source: custom_field`.'
        activityType:
          type: string
          description: >-
            Activity type (e.g. `form_submission`). Used with `source:
            activity`.
        listId:
          type: string
          format: uuid
          description: 'Static list ID. Used with `source: list_membership`.'
        nodeId:
          type: string
          description: >-
            `step_id` of an earlier `send_email` step. Used with `source:
            email_step` (flows only).
        metric:
          type: string
          enum:
            - sent
            - delivered
            - opened
            - clicked
            - bounced
            - unsubscribed
          description: 'Email engagement metric. Used with `source: email_step`.'
        operator:
          type: string
          description: >-
            Comparison operator. Strings: `equals`, `not_equals`, `contains`,
            `not_contains`, `starts_with`, `ends_with`. Numbers/dates: `equals`,
            `not_equals`, `greater_than`, `greater_than_or_equal`, `less_than`,
            `less_than_or_equal`. Booleans: `is_true`, `is_false`. Any:
            `is_empty`, `is_not_empty`. Membership: `is_member`,
            `is_not_member`. Activity: `has_activity`, `has_no_activity`.
            Shorthand aliases (`eq`, `neq`, `gt`, `gte`, `lt`, `lte`,
            `member_of`) are accepted.
        value:
          description: Comparison value, when the operator takes one.
        timeWindow:
          type: object
          properties:
            amount:
              type: integer
              minimum: 1
              maximum: 1000
              description: Window size.
            unit:
              type: string
              enum:
                - hour
                - day
                - week
                - month
                - year
              description: Window unit.
          description: Optional look-back window for activity conditions.
      required:
        - operator
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, e.g. `Authorization: Bearer tented_...`. Create keys
        in Workspace Settings → API Keys.

````