> ## 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 a sequence. Use when driving the outbound-sequencing engine programmatically.

# Update a sequence



## OpenAPI

````yaml patch /sequences/{sequence_id}
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: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /sequences/{sequence_id}:
    patch:
      summary: Update a sequence
      operationId: updateSequence
      parameters:
        - schema:
            type: string
          in: path
          name: sequence_id
          required: true
          description: The unique identifier of the sequence
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  default: New Sequence
                  type: string
                custom_id:
                  type: string
                is_continuous:
                  default: true
                  type: boolean
                filter:
                  anyOf:
                    - type: object
                      properties:
                        or:
                          minItems: 1
                          type: array
                          items:
                            type: object
                            properties:
                              and:
                                type: array
                                items:
                                  $ref: '#/components/schemas/ContactsFilter'
                            required:
                              - and
                      required:
                        - or
                    - type: 'null'
                steps:
                  minItems: 1
                  type: array
                  items:
                    type: object
                    properties:
                      action:
                        anyOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - send_emails
                              data:
                                type: object
                                properties:
                                  from_email:
                                    type: string
                                  email_subject:
                                    type: string
                                  email_body:
                                    type: string
                                  email_sender_name:
                                    type: string
                                  email_is_transactional:
                                    type: boolean
                                required:
                                  - from_email
                                  - email_subject
                                  - email_body
                                  - email_sender_name
                                  - email_is_transactional
                            required:
                              - type
                              - data
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - make_phone_calls
                              data:
                                type: object
                                properties:
                                  aiPhoneAgentId:
                                    type: string
                                required:
                                  - aiPhoneAgentId
                            required:
                              - type
                              - data
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - send_sms_messages
                              data:
                                type: object
                                properties:
                                  message:
                                    type: string
                                required:
                                  - message
                            required:
                              - type
                              - data
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - send_whatsapp_messages
                              data:
                                type: object
                                properties:
                                  phone_number_id:
                                    type: string
                                  template:
                                    type: object
                                    properties:
                                      name:
                                        type: string
                                      language:
                                        type: string
                                      parameters:
                                        $ref: >-
                                          #/components/schemas/WhatsAppTemplateMappingDto
                                    required:
                                      - name
                                      - language
                                      - parameters
                                required:
                                  - phone_number_id
                                  - template
                            required:
                              - type
                              - data
                      delay_in_minutes:
                        type: number
                        minimum: 0
                    required:
                      - action
      responses:
        '200':
          description: Default Response
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    ContactsFilter:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ContactsFilter'
      anyOf:
        - type: object
          properties:
            type:
              type: string
              const: all_contacts
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contact_id_in
            contact_ids:
              type: array
              items:
                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)$
          required:
            - type
            - contact_ids
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_created_at_between
            after:
              type: string
              format: date-time
            before:
              type: string
              format: date-time
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_email_domain_name_in
            domain_name_in:
              type: array
              items:
                type: string
          required:
            - type
            - domain_name_in
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_affected_by_sequence
            sequence_id:
              type: string
          required:
            - type
            - sequence_id
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_name_in
            name_in:
              type: array
              items:
                type: string
          required:
            - type
            - name_in
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_phone_number_in
            phone_number_in:
              type: array
              items:
                type: string
          required:
            - type
            - phone_number_in
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_email_in
            email_in:
              type: array
              items:
                type: string
          required:
            - type
            - email_in
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_attributes_in
            attributes:
              type: array
              items:
                type: object
                propertyNames:
                  type: string
                additionalProperties:
                  type: string
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contacts_sessions_attributes_in
            attributes:
              type: array
              items:
                type: object
                propertyNames:
                  type: string
                additionalProperties:
                  type: string
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: contact_belongs_to_segment
            segment_id:
              type: string
          required:
            - type
            - segment_id
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: last_contacted_at_between
            after:
              type: string
              format: date-time
            before:
              type: string
              format: date-time
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: last_contacted_at_with_handoff_between
            after:
              type: string
              format: date-time
            before:
              type: string
              format: date-time
          required:
            - type
          additionalProperties: false
    WhatsAppTemplateMappingDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/WhatsAppTemplateMappingDto'
      type: object
      properties:
        header:
          type: object
          properties:
            type:
              type: string
              const: header
            parameters:
              type: array
              items:
                oneOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        const: text
                      text:
                        $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                      parameter_name:
                        description: Required if parameters are named
                        type: string
                    required:
                      - type
                      - text
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        const: image
                        description: JPEG, JPG, PNG
                      image:
                        type: object
                        properties:
                          link:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                        required:
                          - link
                        additionalProperties: false
                    required:
                      - type
                      - image
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        const: video
                        description: MP4
                      video:
                        type: object
                        properties:
                          link:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                        required:
                          - link
                        additionalProperties: false
                    required:
                      - type
                      - video
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        const: document
                        description: PDF
                      document:
                        type: object
                        properties:
                          link:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                        required:
                          - link
                        additionalProperties: false
                    required:
                      - type
                      - document
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        const: location
                      location:
                        type: object
                        properties:
                          latitude:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                          longitude:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                          name:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                          address:
                            $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                        required:
                          - latitude
                          - longitude
                          - name
                          - address
                        additionalProperties: false
                    required:
                      - type
                      - location
                    additionalProperties: false
          required:
            - type
            - parameters
          additionalProperties: false
        body:
          type: object
          properties:
            type:
              type: string
              const: body
            parameters:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    const: text
                  text:
                    $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                  parameter_name:
                    description: Required if parameters are named
                    type: string
                required:
                  - type
                  - text
                additionalProperties: false
          required:
            - type
            - parameters
          additionalProperties: false
        buttons:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                const: button
              index:
                type: string
                enum:
                  - '0'
                  - '1'
                  - '2'
                  - '3'
                  - '4'
                  - '5'
                  - '6'
                  - '7'
                  - '8'
                  - '9'
              sub_type:
                type: string
                const: url
              parameters:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      const: text
                    text:
                      $ref: '#/components/schemas/WhatsAppTemplateVariableDto'
                  required:
                    - type
                    - text
                  additionalProperties: false
            required:
              - type
              - index
              - sub_type
              - parameters
            additionalProperties: false
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    WhatsAppTemplateVariableDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/WhatsAppTemplateVariableDto'
      oneOf:
        - type: object
          properties:
            type:
              type: string
              const: GLOBAL_DYNAMIC
            ref:
              type: string
              enum:
                - CONTACT_NAME
                - CONTACT_EMAIL
                - CONTACT_NUMBER
            fallback:
              type: string
          required:
            - type
            - ref
            - fallback
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: DYNAMIC
            ref:
              type: string
            fallback:
              type: string
          required:
            - type
            - ref
            - fallback
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: CONSTANT
            value:
              type: string
          required:
            - type
            - value
          additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````