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

# Update an existing automation

> Updates editable fields on an Automation owned by the caller. Schedule, timerLogic, conditions, and actions are replaced wholesale when provided; omit fields to leave them unchanged.



## OpenAPI

````yaml /api-reference/openapi.yaml put /api/automations/{id}
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/automations/{id}:
    put:
      tags:
        - Automations
      summary: Update an existing automation
      description: >-
        Updates editable fields on an Automation owned by the caller. Schedule,
        timerLogic, conditions, and actions are replaced wholesale when
        provided; omit fields to leave them unchanged.
      operationId: put_automations_by_id
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationUpdateRequest'
      responses:
        '200':
          description: Automation updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationMutationResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationsErrorResponse'
        '404':
          description: Automation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationsErrorResponse'
        '500':
          description: Error updating automation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationsErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    AutomationUpdateRequest:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        event:
          type: string
        actions:
          type: object
          additionalProperties: true
        sourceStatuses:
          type: array
          items:
            type: string
        maxTransitions:
          type: number
        enabled:
          type: boolean
          description: >-
            Updates the calling user's per-automation preference
            (`User.automations[id]`). Same semantics as on Create — does NOT
            toggle a global flag on the Automation. Use PATCH /{id}/preference
            if you only want to flip the preference without touching the rest of
            the automation.
        triggerType:
          type: string
        conditions:
          type: array
          items:
            type: object
            additionalProperties: true
        triggerLogicType:
          type: string
          description: Either "event" or "timer"
        timerLogic:
          type: object
          properties:
            enabled:
              type: boolean
              description: Master switch for the timer-logic block.
            delay:
              type: number
              minimum: 1
            unit:
              type: string
          additionalProperties: true
          nullable: true
        schedule:
          type: object
          properties:
            start:
              type: string
              description: HH:MM format (24-hour, UTC)
            end:
              type: string
              description: HH:MM format (24-hour, UTC)
          additionalProperties: true
          nullable: true
        maxFollowUpCount:
          type: number
          minimum: 1
          nullable: true
      additionalProperties: true
      example:
        description: Updated copy and slightly longer delay.
        timerLogic:
          enabled: true
          delay: 36
          unit: hours
        maxFollowUpCount: 4
    AutomationMutationResponse:
      type: object
      description: >-
        Returned by `POST /api/automations` and `PUT /api/automations/{id}` —
        wraps the created/updated `AutomationDocument` plus a status message.
      properties:
        success:
          type: boolean
          enum:
            - true
        message:
          type: string
        data:
          $ref: '#/components/schemas/AutomationDocument'
      required:
        - success
        - message
        - data
      additionalProperties: true
      example:
        success: true
        message: Automation created successfully
        data:
          _id: 64d2f9c5e8a1d4e001a0b1c2
          name: Follow-up after 24h
          description: Send a follow-up SMS if the lead has not replied in 24h.
          triggerLogicType: timer
          enabled: false
    AutomationsErrorResponse:
      type: object
      description: Standard error envelope for Automations endpoints.
      properties:
        success:
          type: boolean
          enum:
            - false
        message:
          type: string
      required:
        - success
      additionalProperties: true
      example:
        success: false
        message: Automation not found
    AutomationDocument:
      type: object
      description: >-
        An `Automation` document with two derived per-user fields: `enabled`
        (from `User.automations[id]`) and `userSmsNotification` (per-user SMS
        settings).
      properties:
        _id:
          type: string
        name:
          type: string
        description:
          type: string
        organizationId:
          type: string
        userId:
          type: string
        event:
          type: string
        actions:
          type: object
          additionalProperties: true
        sourceStatuses:
          type: array
          items:
            type: string
        maxTransitions:
          type: number
        triggerType:
          type: string
        conditions:
          type: array
          items:
            type: object
            additionalProperties: true
        triggerLogicType:
          type: string
          description: Either "event" or "timer".
        timerLogic:
          type: object
          additionalProperties: true
          nullable: true
        schedule:
          type: object
          additionalProperties: true
          nullable: true
        maxFollowUpCount:
          type: number
          nullable: true
        enabled:
          type: boolean
          description: >-
            Derived from the calling user's preference, not stored on the
            automation itself.
        userSmsNotification:
          description: >-
            Present only when the calling user has configured SMS notifications
            for this automation.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/AutomationUserSmsNotification'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      additionalProperties: true
      example:
        _id: 64d2f9c5e8a1d4e001a0b1c2
        name: Follow-up after 24h
        description: Send a follow-up SMS if the lead has not replied in 24h.
        organizationId: 64a1b2c3d4e5f60012345678
        userId: 64a1b2c3d4e5f60012345679
        event: message.received
        actions:
          sendMessage:
            - template: follow-up-24h
              channel: sms
        sourceStatuses:
          - New lead
        maxTransitions: 3
        triggerType: status_change
        conditions:
          - field: lastInboundDirection
            op: eq
            value: inbound
        triggerLogicType: timer
        timerLogic:
          enabled: true
          delay: 24
          unit: hours
        schedule:
          start: '09:00'
          end: '18:00'
        maxFollowUpCount: 3
        enabled: true
        userSmsNotification:
          enabled: true
          phoneNumbers:
            - '+14155551234'
          message: New lead pending follow-up.
        createdAt: '2026-04-12T14:22:10.000Z'
        updatedAt: '2026-04-22T10:14:00.000Z'
    AutomationUserSmsNotification:
      type: object
      description: >-
        User-specific SMS notification settings, merged from the calling user's
        `User.automations[automationId]` preference.
      properties:
        enabled:
          type: boolean
        phoneNumbers:
          type: array
          items:
            type: string
        message:
          type: string
        templateId:
          type: string
      additionalProperties: true
      example:
        enabled: true
        phoneNumbers:
          - '+14155551234'
        message: New lead just signed up — please follow up.
        templateId: new-lead-alert
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````