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

# Create or Duplicate Tenant Automation

> Create a new tenant automation in the draft state



## OpenAPI

````yaml POST /api/automations
openapi: 3.0.0
info:
  title: Reach API
  version: 1.0.0
  description: API documentation for Reach platform
servers:
  - url: https://api.embedreach.com
    description: Production server
security: []
paths:
  /api/automations:
    post:
      tags:
        - Tenant Automation
      summary: Create or Duplicate Tenant Automation
      description: Create a new tenant automation in the draft state
      parameters:
        - name: reach-tenant-id
          in: header
          required: false
          schema:
            type: string
            description: >-
              If using a platform scoped JWT, you can pass in a header to
              impersonate a specific tenant to impersonate the request as.
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - type: object
                  properties:
                    duplicate:
                      type: boolean
                      enum:
                        - true
                    source_id:
                      type: string
                      description: The ID of the automation to duplicate
                    name:
                      type: string
                      description: The name of the automation
                    description:
                      type: string
                      description: A description for the automation
                  required:
                    - duplicate
                    - source_id
                    - name
                - type: object
                  properties:
                    name:
                      type: string
                      description: A friendly name for the automation
                    description:
                      type: string
                      description: A description for the automation
                    trigger:
                      oneOf:
                        - type: object
                          properties:
                            triggerType:
                              type: string
                              enum:
                                - one_time
                            scheduledAt:
                              anyOf:
                                - type: string
                                  nullable: true
                                  description: >-
                                    String in ISO 8601 format with timezone
                                    information (e.g.,
                                    "2024-03-20T15:00:00-07:00" or
                                    "2024-03-20T15:00:00Z")
                                - type: string
                                  enum:
                                    - now
                                  description: >-
                                    Schedule the automation to run 5 minutes
                                    from marking it as active
                                - nullable: true
                            timezone:
                              type: string
                              description: >-
                                Timezone in IANA format (e.g.,
                                "America/New_York"). This is used for auditing
                                and frontend display. Times are automatically
                                converted to UTC when stored.
                          required:
                            - triggerType
                            - scheduledAt
                        - type: object
                          properties:
                            triggerType:
                              type: string
                              enum:
                                - trigger_based
                            eventName:
                              type: string
                            eventFilter:
                              type: object
                              additionalProperties:
                                type: string
                            cooldownSeconds:
                              type: number
                            artifactOutputKeys:
                              type: array
                              items:
                                type: string
                            triggerIdKey:
                              type: string
                            rootActionId:
                              type: string
                            customTriggerCopy:
                              type: string
                          required:
                            - triggerType
                            - eventName
                            - eventFilter
                            - cooldownSeconds
                            - artifactOutputKeys
                            - triggerIdKey
                            - rootActionId
                        - type: object
                          properties:
                            triggerType:
                              type: string
                              enum:
                                - date_based
                            monthDayTriggerType:
                              type: string
                              enum:
                                - fixed_date
                            dayToTrigger:
                              type: number
                              description: Day of the month to trigger on
                            monthToTrigger:
                              type: number
                              description: Month to trigger on
                            customTriggerCopy:
                              type: string
                              description: >-
                                Optional copy to use when displaying in the
                                frontend
                            rootActionId:
                              type: string
                          required:
                            - triggerType
                            - monthDayTriggerType
                            - dayToTrigger
                            - monthToTrigger
                            - rootActionId
                      description: The trigger for the automation
                    type:
                      type: string
                      enum:
                        - one_time
                        - trigger_based
                        - date_based
                      description: The type of automation
                    include_segments:
                      type: array
                      items:
                        type: string
                      description: The segments to include in the automation
                    exclude_segments:
                      type: array
                      items:
                        type: string
                      description: The segments to exclude from the automation
                    action:
                      type: array
                      items:
                        type: object
                        properties:
                          actionType:
                            type: string
                            enum:
                              - send_communication
                              - wait_until_next_fixed_time
                              - wait_until_next_occurrence
                              - wait_for_duration
                              - check_segment_membership
                          actionMetadata:
                            oneOf:
                              - type: object
                                properties:
                                  currentActionId:
                                    type: string
                                  nextActionId:
                                    type: string
                                  templateActionId:
                                    type: string
                                    format: uuid
                                  actionType:
                                    type: string
                                    enum:
                                      - send_communication
                                  communicationGroupId:
                                    type: string
                                  customBlockText:
                                    type: string
                                  reputationTemplateType:
                                    type: string
                                    enum:
                                      - feedback-request
                                      - google-review
                                      - feedback-request-reminder
                                      - google-review-reminder
                                required:
                                  - actionType
                                  - communicationGroupId
                              - type: object
                                properties:
                                  currentActionId:
                                    type: string
                                  nextActionId:
                                    type: string
                                  templateActionId:
                                    type: string
                                    format: uuid
                                  actionType:
                                    type: string
                                    enum:
                                      - wait_until_next_fixed_time
                                  hour:
                                    type: number
                                  minute:
                                    type: number
                                  timezone:
                                    type: string
                                    enum:
                                      - America/New_York
                                required:
                                  - actionType
                                  - hour
                                  - minute
                                  - timezone
                              - type: object
                                properties:
                                  currentActionId:
                                    type: string
                                  nextActionId:
                                    type: string
                                  templateActionId:
                                    type: string
                                    format: uuid
                                  actionType:
                                    type: string
                                    enum:
                                      - wait_until_next_occurrence
                                  hour:
                                    type: number
                                  minute:
                                    type: number
                                  timezone:
                                    type: string
                                    enum:
                                      - America/New_York
                                required:
                                  - actionType
                                  - hour
                                  - minute
                                  - timezone
                              - type: object
                                properties:
                                  currentActionId:
                                    type: string
                                  nextActionId:
                                    type: string
                                  templateActionId:
                                    type: string
                                    format: uuid
                                  actionType:
                                    type: string
                                    enum:
                                      - wait_for_duration
                                  days:
                                    type: number
                                    minimum: 0
                                    default: 0
                                  hours:
                                    type: number
                                    minimum: 0
                                    default: 0
                                  minutes:
                                    type: number
                                    minimum: 0
                                    default: 0
                                  seconds:
                                    type: number
                                    minimum: 0
                                    default: 0
                                required:
                                  - actionType
                              - type: object
                                properties:
                                  currentActionId:
                                    type: string
                                  nextActionId:
                                    type: string
                                  templateActionId:
                                    type: string
                                    format: uuid
                                  actionType:
                                    type: string
                                    enum:
                                      - check_segment_membership
                                  segmentIds:
                                    type: array
                                    items:
                                      type: string
                                      format: uuid
                                required:
                                  - actionType
                                  - segmentIds
                        required:
                          - actionType
                          - actionMetadata
                      description: The action for the automation
                  required:
                    - name
                    - type
      responses:
        '200':
          description: Status 200 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: The id of the automation
                      name:
                        type: string
                        description: The name of the automation
                      description:
                        type: string
                        nullable: true
                        description: The description of the automation
                      triggerMetadata:
                        oneOf:
                          - type: object
                            properties:
                              triggerType:
                                type: string
                                enum:
                                  - one_time
                              scheduledAt:
                                anyOf:
                                  - type: string
                                    nullable: true
                                    description: >-
                                      String in ISO 8601 format with timezone
                                      information (e.g.,
                                      "2024-03-20T15:00:00-07:00" or
                                      "2024-03-20T15:00:00Z")
                                  - type: string
                                    enum:
                                      - now
                                    description: >-
                                      Schedule the automation to run 5 minutes
                                      from marking it as active
                                  - nullable: true
                              timezone:
                                type: string
                                description: >-
                                  Timezone in IANA format (e.g.,
                                  "America/New_York"). This is used for auditing
                                  and frontend display. Times are automatically
                                  converted to UTC when stored.
                            required:
                              - triggerType
                              - scheduledAt
                          - type: object
                            properties:
                              triggerType:
                                type: string
                                enum:
                                  - trigger_based
                              eventName:
                                type: string
                              eventFilter:
                                type: object
                                additionalProperties:
                                  type: string
                              cooldownSeconds:
                                type: number
                              artifactOutputKeys:
                                type: array
                                items:
                                  type: string
                              triggerIdKey:
                                type: string
                              rootActionId:
                                type: string
                              customTriggerCopy:
                                type: string
                            required:
                              - triggerType
                              - eventName
                              - eventFilter
                              - cooldownSeconds
                              - artifactOutputKeys
                              - triggerIdKey
                              - rootActionId
                          - type: object
                            properties:
                              triggerType:
                                type: string
                                enum:
                                  - date_based
                              monthDayTriggerType:
                                type: string
                                enum:
                                  - fixed_date
                              dayToTrigger:
                                type: number
                                description: Day of the month to trigger on
                              monthToTrigger:
                                type: number
                                description: Month to trigger on
                              customTriggerCopy:
                                type: string
                                description: >-
                                  Optional copy to use when displaying in the
                                  frontend
                              rootActionId:
                                type: string
                            required:
                              - triggerType
                              - monthDayTriggerType
                              - dayToTrigger
                              - monthToTrigger
                              - rootActionId
                          - nullable: true
                      triggerType:
                        type: string
                        enum:
                          - one_time
                          - trigger_based
                          - date_based
                      actionData:
                        type: array
                        nullable: true
                        items:
                          type: object
                          properties:
                            actionType:
                              type: string
                              enum:
                                - send_communication
                                - wait_until_next_fixed_time
                                - wait_until_next_occurrence
                                - wait_for_duration
                                - check_segment_membership
                            actionMetadata:
                              oneOf:
                                - type: object
                                  properties:
                                    currentActionId:
                                      type: string
                                    nextActionId:
                                      type: string
                                    templateActionId:
                                      type: string
                                      format: uuid
                                    actionType:
                                      type: string
                                      enum:
                                        - send_communication
                                    communicationGroupId:
                                      type: string
                                    customBlockText:
                                      type: string
                                    reputationTemplateType:
                                      type: string
                                      enum:
                                        - feedback-request
                                        - google-review
                                        - feedback-request-reminder
                                        - google-review-reminder
                                  required:
                                    - actionType
                                    - communicationGroupId
                                - type: object
                                  properties:
                                    currentActionId:
                                      type: string
                                    nextActionId:
                                      type: string
                                    templateActionId:
                                      type: string
                                      format: uuid
                                    actionType:
                                      type: string
                                      enum:
                                        - wait_until_next_fixed_time
                                    hour:
                                      type: number
                                    minute:
                                      type: number
                                    timezone:
                                      type: string
                                      enum:
                                        - America/New_York
                                  required:
                                    - actionType
                                    - hour
                                    - minute
                                    - timezone
                                - type: object
                                  properties:
                                    currentActionId:
                                      type: string
                                    nextActionId:
                                      type: string
                                    templateActionId:
                                      type: string
                                      format: uuid
                                    actionType:
                                      type: string
                                      enum:
                                        - wait_until_next_occurrence
                                    hour:
                                      type: number
                                    minute:
                                      type: number
                                    timezone:
                                      type: string
                                      enum:
                                        - America/New_York
                                  required:
                                    - actionType
                                    - hour
                                    - minute
                                    - timezone
                                - type: object
                                  properties:
                                    currentActionId:
                                      type: string
                                    nextActionId:
                                      type: string
                                    templateActionId:
                                      type: string
                                      format: uuid
                                    actionType:
                                      type: string
                                      enum:
                                        - wait_for_duration
                                    days:
                                      type: number
                                      minimum: 0
                                      default: 0
                                    hours:
                                      type: number
                                      minimum: 0
                                      default: 0
                                    minutes:
                                      type: number
                                      minimum: 0
                                      default: 0
                                    seconds:
                                      type: number
                                      minimum: 0
                                      default: 0
                                  required:
                                    - actionType
                                - type: object
                                  properties:
                                    currentActionId:
                                      type: string
                                    nextActionId:
                                      type: string
                                    templateActionId:
                                      type: string
                                      format: uuid
                                    actionType:
                                      type: string
                                      enum:
                                        - check_segment_membership
                                    segmentIds:
                                      type: array
                                      items:
                                        type: string
                                        format: uuid
                                  required:
                                    - actionType
                                    - segmentIds
                          required:
                            - actionType
                            - actionMetadata
                      businessId:
                        type: string
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - running
                          - sending
                          - completed
                          - failed
                          - cancelled
                          - partially_cancelled
                          - archived
                    required:
                      - id
                      - name
                      - description
                      - triggerMetadata
                      - triggerType
                      - actionData
                      - businessId
                      - status
                required:
                  - success
        '400':
          description: Bad Request - Validation or request error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    default: false
                  message:
                    type: string
                    description: Error message describing what went wrong
                  errors:
                    type: array
                    items:
                      type: string
                    description: Optional array of specific validation errors
                required:
                  - message

````