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

> Update, append or remove steps in one transactional batch, in any status. Use to change copy or delays on a live sequence without disturbing people mid-journey.

# Surgically edit steps — update content/delays, append, remove (any status)



## OpenAPI

````yaml patch /sequences/{sequenceId}/steps
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /sequences/{sequenceId}/steps:
    patch:
      summary: >-
        Surgically edit steps — update content/delays, append, remove (any
        status)
      description: >-
        One transactional batch of typed edits. Execution order is fixed:
        removes (highest index first), then appends, then updates — indices
        address the array AFTER earlier phases of the same batch. Content/delay
        updates are allowed on any step (people already past it keep what they
        received); append is always allowed (completed people do not revive);
        remove is refused for any step somebody already reached. Any illegal
        edit rejects the whole batch, named by its position.
      operationId: editSequenceSteps
      parameters:
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          in: path
          name: sequenceId
          required: true
          description: The unique identifier of the sequence
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditSequenceStepsDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SequenceDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    EditSequenceStepsDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/EditSequenceStepsDtoInput'
      type: object
      properties:
        edits:
          minItems: 1
          maxItems: 50
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  op:
                    type: string
                    const: update
                  step_index:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  content:
                    description: >-
                      New content for the step. Must keep the step on its
                      current channel.
                    anyOf:
                      - type: object
                        properties:
                          type:
                            type: string
                            const: whatsapp_template
                          template_name:
                            type: string
                            minLength: 1
                          template_language:
                            type: string
                            minLength: 1
                          variables:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties:
                              type: object
                              properties:
                                source:
                                  type: string
                                  enum:
                                    - display_name
                                    - phone
                                    - email
                                fallback:
                                  type: string
                              required:
                                - source
                        required:
                          - type
                          - template_name
                          - template_language
                          - variables
                      - type: object
                        properties:
                          type:
                            type: string
                            const: voice_call
                          extra_instructions:
                            type: string
                            minLength: 1
                            maxLength: 8000
                          variables:
                            type: object
                            propertyNames:
                              type: string
                              minLength: 1
                              maxLength: 64
                            additionalProperties:
                              type: object
                              properties:
                                source:
                                  type: string
                                  enum:
                                    - display_name
                                    - phone
                                    - email
                                fallback:
                                  type: string
                              required:
                                - source
                        required:
                          - type
                      - type: object
                        properties:
                          type:
                            type: string
                            const: email
                          subject:
                            type: string
                            minLength: 1
                          html:
                            type: string
                            minLength: 1
                          text:
                            type: string
                            minLength: 1
                          variables:
                            default: {}
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties:
                              type: object
                              properties:
                                source:
                                  type: string
                                  enum:
                                    - display_name
                                    - phone
                                    - email
                                fallback:
                                  type: string
                              required:
                                - source
                        required:
                          - type
                          - subject
                          - html
                          - text
                  delay_minutes:
                    description: New wait before this step, in minutes. Step 0 must stay 0.
                    type: integer
                    minimum: 0
                    maximum: 129600
                required:
                  - op
                  - step_index
              - type: object
                properties:
                  op:
                    type: string
                    const: append
                  steps:
                    minItems: 1
                    maxItems: 20
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            channel:
                              type: string
                              const: whatsapp
                            content:
                              type: object
                              properties:
                                type:
                                  type: string
                                  const: whatsapp_template
                                template_name:
                                  type: string
                                  minLength: 1
                                template_language:
                                  type: string
                                  minLength: 1
                                variables:
                                  type: object
                                  propertyNames:
                                    type: string
                                  additionalProperties:
                                    type: object
                                    properties:
                                      source:
                                        type: string
                                        enum:
                                          - display_name
                                          - phone
                                          - email
                                      fallback:
                                        type: string
                                    required:
                                      - source
                              required:
                                - type
                                - template_name
                                - template_language
                                - variables
                            delay_minutes:
                              type: integer
                              minimum: 0
                              maximum: 129600
                          required:
                            - channel
                            - content
                            - delay_minutes
                        - type: object
                          properties:
                            channel:
                              type: string
                              const: voice
                            content:
                              type: object
                              properties:
                                type:
                                  type: string
                                  const: voice_call
                                extra_instructions:
                                  type: string
                                  minLength: 1
                                  maxLength: 8000
                                variables:
                                  type: object
                                  propertyNames:
                                    type: string
                                    minLength: 1
                                    maxLength: 64
                                  additionalProperties:
                                    type: object
                                    properties:
                                      source:
                                        type: string
                                        enum:
                                          - display_name
                                          - phone
                                          - email
                                      fallback:
                                        type: string
                                    required:
                                      - source
                              required:
                                - type
                            delay_minutes:
                              type: integer
                              minimum: 0
                              maximum: 129600
                          required:
                            - channel
                            - content
                            - delay_minutes
                        - type: object
                          properties:
                            channel:
                              type: string
                              const: email
                            content:
                              type: object
                              properties:
                                type:
                                  type: string
                                  const: email
                                subject:
                                  type: string
                                  minLength: 1
                                html:
                                  type: string
                                  minLength: 1
                                text:
                                  type: string
                                  minLength: 1
                                variables:
                                  default: {}
                                  type: object
                                  propertyNames:
                                    type: string
                                  additionalProperties:
                                    type: object
                                    properties:
                                      source:
                                        type: string
                                        enum:
                                          - display_name
                                          - phone
                                          - email
                                      fallback:
                                        type: string
                                    required:
                                      - source
                              required:
                                - type
                                - subject
                                - html
                                - text
                            delay_minutes:
                              type: integer
                              minimum: 0
                              maximum: 129600
                          required:
                            - channel
                            - content
                            - delay_minutes
                    description: Steps added at the END of the journey, in order.
                required:
                  - op
                  - steps
              - type: object
                properties:
                  op:
                    type: string
                    const: remove
                  step_index:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                required:
                  - op
                  - step_index
      required:
        - edits
    SequenceDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SequenceDto'
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        org_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        name:
          type: string
        status:
          type: string
          enum:
            - draft
            - active
            - paused
        steps:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  channel:
                    type: string
                    const: whatsapp
                  content:
                    type: object
                    properties:
                      type:
                        type: string
                        const: whatsapp_template
                      template_name:
                        type: string
                        minLength: 1
                      template_language:
                        type: string
                        minLength: 1
                      variables:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: object
                          properties:
                            source:
                              type: string
                              enum:
                                - display_name
                                - phone
                                - email
                            fallback:
                              type: string
                          required:
                            - source
                          additionalProperties: false
                    required:
                      - type
                      - template_name
                      - template_language
                      - variables
                    additionalProperties: false
                  delay_minutes:
                    type: integer
                    minimum: 0
                    maximum: 129600
                required:
                  - channel
                  - content
                  - delay_minutes
                additionalProperties: false
              - type: object
                properties:
                  channel:
                    type: string
                    const: voice
                  content:
                    type: object
                    properties:
                      type:
                        type: string
                        const: voice_call
                      extra_instructions:
                        type: string
                        minLength: 1
                        maxLength: 8000
                      variables:
                        type: object
                        propertyNames:
                          type: string
                          minLength: 1
                          maxLength: 64
                        additionalProperties:
                          type: object
                          properties:
                            source:
                              type: string
                              enum:
                                - display_name
                                - phone
                                - email
                            fallback:
                              type: string
                          required:
                            - source
                          additionalProperties: false
                    required:
                      - type
                    additionalProperties: false
                  delay_minutes:
                    type: integer
                    minimum: 0
                    maximum: 129600
                required:
                  - channel
                  - content
                  - delay_minutes
                additionalProperties: false
              - type: object
                properties:
                  channel:
                    type: string
                    const: email
                  content:
                    type: object
                    properties:
                      type:
                        type: string
                        const: email
                      subject:
                        type: string
                        minLength: 1
                      html:
                        type: string
                        minLength: 1
                      text:
                        type: string
                        minLength: 1
                      variables:
                        default: {}
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: object
                          properties:
                            source:
                              type: string
                              enum:
                                - display_name
                                - phone
                                - email
                            fallback:
                              type: string
                          required:
                            - source
                          additionalProperties: false
                    required:
                      - type
                      - subject
                      - html
                      - text
                      - variables
                    additionalProperties: false
                  delay_minutes:
                    type: integer
                    minimum: 0
                    maximum: 129600
                required:
                  - channel
                  - content
                  - delay_minutes
                additionalProperties: false
        settings:
          type: object
          properties:
            block_active_elsewhere:
              type: boolean
            block_contacted_before:
              type: boolean
            respect_office_hours:
              type: boolean
            office_hours_id:
              type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          additionalProperties: false
        brief:
          type: string
        reply_instructions:
          type: string
        criteria:
          type: object
          properties:
            must:
              maxItems: 20
              type: array
              items:
                type: object
                properties:
                  label:
                    type: string
                    minLength: 2
                    maxLength: 60
                    description: >-
                      A few words naming this criterion, shown in the dashboard
                      — "Recent invoicing complaint", "Business account". Not a
                      sentence.
                  text:
                    type: string
                    minLength: 3
                    maxLength: 500
                    description: >-
                      The full instruction the judge reads. Name the boundary
                      explicitly — what counts and what does not. Never shown in
                      the table.
                required:
                  - label
                  - text
                additionalProperties: false
            nice:
              maxItems: 20
              type: array
              items:
                type: object
                properties:
                  label:
                    type: string
                    minLength: 2
                    maxLength: 60
                    description: >-
                      A few words naming this criterion, shown in the dashboard
                      — "Recent invoicing complaint", "Business account". Not a
                      sentence.
                  text:
                    type: string
                    minLength: 3
                    maxLength: 500
                    description: >-
                      The full instruction the judge reads. Name the boundary
                      explicitly — what counts and what does not. Never shown in
                      the table.
                  grade:
                    type: string
                    enum:
                      - high
                      - medium
                      - low
                required:
                  - label
                  - text
                  - grade
                additionalProperties: false
          required:
            - must
            - nice
          additionalProperties: false
        columns:
          maxItems: 12
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                minLength: 1
                maxLength: 59
                pattern: ^[a-z0-9_]+$
              label:
                type: string
                minLength: 1
                maxLength: 60
              path:
                type: string
                minLength: 1
                maxLength: 300
              type:
                type: string
                enum:
                  - string
                  - number
                  - boolean
                  - date
                  - string[]
                  - number[]
            required:
              - key
              - label
              - path
              - type
            additionalProperties: false
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
      required:
        - id
        - org_id
        - name
        - status
        - steps
        - settings
        - brief
        - reply_instructions
        - criteria
        - columns
        - created_at
        - updated_at
        - deleted_at
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````