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

# Get automation

> Get an automation.



## OpenAPI

````yaml /en/automations-api/api-reference/openapi-automations.json get /v1/automations/{automationId}
openapi: 3.0.3
info:
  title: 'Notifique API v1: Automations and events'
  version: 1.0.0
  description: >-
    Definition of **events** (name + optional `payload` schema), **automations**
    as a graph (trigger by event or **inbound message** on a channel, delays,
    conditions, including **`source: "message"`** on inbound, **`endFlow`** to
    end a branch, multi-channel sends, contact updates, etc.) and **trigger**
    via `POST /v1/events/send`. Auth: `Authorization: Bearer sk_live_...` or
    `x-api-key` header. All bodies use **camelCase**.


    **Scopes:** `events:read` | `events:write` | `automations:read` |
    `automations:write`. Send steps (`sendTemplate`, direct emails, etc.) still
    require the matching channel send keys.


    **Pagination:** query `page` (≥1, default 1) and `limit` (1 to 100, default
    20), as strings or coherent numbers.


    **Blocked workspace** returns **402** with `Payment Required`.


    **Onboarding:** on any `/v1` route, if onboarding is incomplete, middleware
    returns **403** with `code: ONBOARDING_REQUIRED` (body similar to other
    403s).
servers:
  - url: https://api.notifique.dev
    description: Production
security:
  - ntfAutoBearerAuth: []
  - ntfAutoApiKeyHeader: []
tags:
  - name: Eventos
    description: CRUD de definições de evento + disparo `POST /v1/events/send`.
  - name: Automações
    description: CRUD de automações, stop e listagem de runs.
  - name: Runs
    description: Histórico e detalhe de execuções (`AutomationRun` + passos).
paths:
  /v1/automations/{automationId}:
    get:
      tags:
        - Automações
      summary: Get automation
      description: Get an automation.
      operationId: ntfAuto_getAutomation
      parameters:
        - $ref: '#/components/parameters/NtfAuto_automationId'
      responses:
        '200':
          $ref: '#/components/responses/NtfAuto_AutomationGet200'
        '401':
          $ref: '#/components/responses/NtfAuto_401'
        '402':
          $ref: '#/components/responses/NtfAuto_402'
        '403':
          $ref: '#/components/responses/NtfAuto_403AutomationsRead'
        '404':
          $ref: '#/components/responses/NtfAuto_AutomationNotFound'
components:
  parameters:
    NtfAuto_automationId:
      name: automationId
      in: path
      required: true
      schema:
        type: string
      description: Cuid da automação.
  responses:
    NtfAuto_AutomationGet200:
      description: Registro completo incluindo `graphJson`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfAuto_AutomationFullResponse'
    NtfAuto_401:
      description: >-
        Chave ausente ou inválida. No middleware global de `/v1` também ocorre
        quando não há API Key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfAuto_ErrorEnvelope401'
          examples:
            route:
              value:
                success: false
                error: Unauthorized
                message: Invalid or missing API Key
                code: UNAUTHORIZED
            middleware:
              value:
                success: false
                error: Unauthorized
                message: >-
                  API Key is required. Provide Authorization: Bearer <key> or
                  x-api-key header.
                code: UNAUTHORIZED
    NtfAuto_402:
      description: Plano expirado ou workspace suspenso.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfAuto_ErrorPaymentRequired'
          example:
            success: false
            error: Payment Required
            message: Plan expired or suspended
            code: WORKSPACE_BLOCKED
    NtfAuto_403AutomationsRead:
      description: Sem escopo `automations:read`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfAuto_ErrorForbiddenScope'
          example:
            success: false
            error: Forbidden
            message: 'Missing scope: automations:read'
            code: FORBIDDEN
    NtfAuto_AutomationNotFound:
      description: Automação inexistente ou excluída.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfAuto_ErrorNotFound'
          example:
            success: false
            error: Not Found
            message: Automation not found
            code: NOT_FOUND
  schemas:
    NtfAuto_AutomationFullResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/NtfAuto_AutomationRowFull'
    NtfAuto_ErrorEnvelope401:
      type: object
      required:
        - success
        - error
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
          example: Unauthorized
        message:
          type: string
    NtfAuto_ErrorPaymentRequired:
      type: object
      required:
        - success
        - error
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
          enum:
            - Payment Required
        message:
          type: string
          example: Plan expired or suspended
    NtfAuto_ErrorForbiddenScope:
      type: object
      required:
        - success
        - error
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
          enum:
            - Forbidden
        message:
          type: string
    NtfAuto_ErrorNotFound:
      type: object
      required:
        - success
        - error
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
          enum:
            - Not Found
        message:
          type: string
    NtfAuto_AutomationRowFull:
      type: object
      required:
        - id
        - workspaceId
        - name
        - status
        - triggerEventName
        - graphJson
        - graphVersion
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
        workspaceId:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - ENABLED
            - DISABLED
        triggerEventName:
          type: string
        graphJson:
          $ref: '#/components/schemas/NtfAuto_AutomationGraph'
        graphVersion:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        deletedAt:
          nullable: true
          type: string
          format: date-time
    NtfAuto_AutomationGraph:
      type: object
      required:
        - steps
        - connections
      properties:
        steps:
          type: array
          minItems: 2
          items:
            $ref: '#/components/schemas/NtfAuto_GraphStep'
        connections:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/NtfAuto_GraphConnection'
        nodeLayout:
          type: object
          additionalProperties:
            type: object
            required:
              - x
              - 'y'
            properties:
              x:
                type: number
              'y':
                type: number
          description: 'Opcional: posições do editor visual (`stepKey` → coordenadas).'
      description: >-
        Grafo acíclico (DAG) com exatamente um `trigger`. Arestas a partir de
        `condition` exigem `branch`: `true` | `false`.
    NtfAuto_GraphStep:
      oneOf:
        - $ref: '#/components/schemas/NtfAuto_StepTrigger'
        - $ref: '#/components/schemas/NtfAuto_StepDelay'
        - $ref: '#/components/schemas/NtfAuto_StepCondition'
        - $ref: '#/components/schemas/NtfAuto_StepSendTemplate'
        - $ref: '#/components/schemas/NtfAuto_StepSendEmail'
        - $ref: '#/components/schemas/NtfAuto_StepSendWhatsapp'
        - $ref: '#/components/schemas/NtfAuto_StepSendSms'
        - $ref: '#/components/schemas/NtfAuto_StepSendTelegram'
        - $ref: '#/components/schemas/NtfAuto_StepSendPush'
        - $ref: '#/components/schemas/NtfAuto_StepSendRcs'
        - $ref: '#/components/schemas/NtfAuto_StepUpdateContact'
        - $ref: '#/components/schemas/NtfAuto_StepDeleteContact'
        - $ref: '#/components/schemas/NtfAuto_StepCreateContact'
        - $ref: '#/components/schemas/NtfAuto_StepEndFlow'
      discriminator:
        propertyName: stepType
        mapping:
          trigger:
            $ref: '#/components/schemas/NtfAuto_StepTrigger'
          delay:
            $ref: '#/components/schemas/NtfAuto_StepDelay'
          condition:
            $ref: '#/components/schemas/NtfAuto_StepCondition'
          sendTemplate:
            $ref: '#/components/schemas/NtfAuto_StepSendTemplate'
          sendEmail:
            $ref: '#/components/schemas/NtfAuto_StepSendEmail'
          sendWhatsapp:
            $ref: '#/components/schemas/NtfAuto_StepSendWhatsapp'
          sendSms:
            $ref: '#/components/schemas/NtfAuto_StepSendSms'
          sendTelegram:
            $ref: '#/components/schemas/NtfAuto_StepSendTelegram'
          sendPush:
            $ref: '#/components/schemas/NtfAuto_StepSendPush'
          sendRcs:
            $ref: '#/components/schemas/NtfAuto_StepSendRcs'
          updateContact:
            $ref: '#/components/schemas/NtfAuto_StepUpdateContact'
          deleteContact:
            $ref: '#/components/schemas/NtfAuto_StepDeleteContact'
          createContact:
            $ref: '#/components/schemas/NtfAuto_StepCreateContact'
          endFlow:
            $ref: '#/components/schemas/NtfAuto_StepEndFlow'
    NtfAuto_GraphConnection:
      type: object
      required:
        - from
        - to
      properties:
        from:
          type: string
          minLength: 1
          maxLength: 128
        to:
          type: string
          minLength: 1
          maxLength: 128
        branch:
          type: string
          enum:
            - 'true'
            - 'false'
          description: Obrigatório apenas saindo de `condition`.
    NtfAuto_StepTrigger:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
          minLength: 1
          maxLength: 128
        stepType:
          type: string
          enum:
            - trigger
        config:
          type: object
          required:
            - eventName
          properties:
            eventName:
              type: string
              minLength: 1
              maxLength: 256
              description: Não pode começar com `notifique:` (case-insensitive).
    NtfAuto_StepDelay:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
          minLength: 1
          maxLength: 128
        stepType:
          type: string
          enum:
            - delay
        config:
          type: object
          required:
            - durationMs
          properties:
            durationMs:
              type: integer
              minimum: 0
              maximum: 2592000000
              description: >-
                Máximo 30 dias em ms. Para persistir: `durationMs` > 0 e não
                usar só `editorDraft`.
            editorPlaceholder:
              type: boolean
            editorDraft:
              type: boolean
    NtfAuto_StepCondition:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
          minLength: 1
          maxLength: 128
        stepType:
          type: string
          enum:
            - condition
        config:
          type: object
          required:
            - source
            - operator
          properties:
            source:
              type: string
              enum:
                - event
                - contact
                - message
              description: >-
                `event` ou `contact` quando o gatilho é evento da API. `message`
                é **obrigatório** quando o gatilho é mensagem recebida em canal
                (compara texto inbound: body → bodyPreview → preview).
            propertyKey:
              type: string
              maxLength: 256
              nullable: true
              description: >-
                Obrigatório para `source` `event` ou `contact`: path no payload
                (pontos permitidos) ou campo do contato. Omitir para `message`.
            operator:
              type: string
              enum:
                - equals
                - notEquals
                - exists
                - isEmpty
                - contains
                - startsWith
                - endsWith
                - gt
                - lt
                - gte
                - lte
            compareValue:
              type: string
              nullable: true
              description: >-
                Obrigatório (não vazio) para operadores exceto `exists` e
                `isEmpty`. Para `gt`, `lt`, `gte` e `lte`, o valor da esquerda e
                o `compareValue` são interpretados como números (string numérica
                ou número JSON); se algum não for número finito, a condição é
                falsa.
    NtfAuto_StepSendTemplate:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendTemplate
        config:
          type: object
          required:
            - templateId
            - channels
          properties:
            templateId:
              type: string
            channels:
              type: array
              minItems: 1
              items:
                type: string
                enum:
                  - whatsapp
                  - sms
                  - email
                  - telegram
            fromEmail:
              type: string
              nullable: true
            instanceId:
              type: string
              nullable: true
            telegramInstanceId:
              type: string
              nullable: true
            variables:
              type: object
              additionalProperties:
                type: string
    NtfAuto_StepSendEmail:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendEmail
        config:
          type: object
          required:
            - subject
            - htmlBody
          properties:
            subject:
              type: string
              maxLength: 512
            htmlBody:
              type: string
              maxLength: 100000
            fromEmail:
              type: string
              nullable: true
    NtfAuto_StepSendWhatsapp:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendWhatsapp
        config:
          type: object
          required:
            - instanceId
            - body
          properties:
            instanceId:
              type: string
            body:
              type: string
              maxLength: 8192
    NtfAuto_StepSendSms:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendSms
        config:
          type: object
          required:
            - body
          properties:
            body:
              type: string
              maxLength: 2000
    NtfAuto_StepSendTelegram:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendTelegram
        config:
          type: object
          required:
            - instanceId
            - body
          properties:
            instanceId:
              type: string
            body:
              type: string
              maxLength: 8192
    NtfAuto_StepSendPush:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendPush
        config:
          type: object
          required:
            - pushAppId
            - title
            - body
          properties:
            pushAppId:
              type: string
            title:
              type: string
              maxLength: 256
            body:
              type: string
              maxLength: 4096
            url:
              type: string
              nullable: true
    NtfAuto_StepSendRcs:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - sendRcs
        config:
          type: object
          required:
            - body
          properties:
            body:
              type: string
              maxLength: 4096
    NtfAuto_StepUpdateContact:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - updateContact
        config:
          type: object
          properties:
            name:
              type: string
              nullable: true
            email:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
            url:
              type: string
              nullable: true
            custom:
              type: object
              additionalProperties:
                type: string
            actions:
              type: array
              maxItems: 50
              items:
                $ref: '#/components/schemas/NtfAuto_UpdateContactAction'
              description: >-
                Lista preferida. Se presente e não vazia, validação extra
                aplica-se (não misturar `clear` com `custom:`).
          description: 'Legado: campos planos + `custom`. Novo fluxo: `actions`.'
    NtfAuto_StepDeleteContact:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - deleteContact
        config:
          type: object
          additionalProperties: false
    NtfAuto_StepCreateContact:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
        stepType:
          type: string
          enum:
            - createContact
        config:
          type: object
          properties:
            name:
              type: string
              nullable: true
            email:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
          description: Pelo menos um de `email` ou `phone` não vazio após trim.
    NtfAuto_StepEndFlow:
      type: object
      required:
        - stepKey
        - stepType
        - config
      properties:
        stepKey:
          type: string
          minLength: 1
          maxLength: 128
        stepType:
          type: string
          enum:
            - endFlow
        config:
          type: object
          description: >-
            Terminator: no outgoing connections; engine completes with no side
            effects.
          additionalProperties: false
    NtfAuto_UpdateContactAction:
      type: object
      required:
        - fieldKey
        - intent
      properties:
        fieldKey:
          type: string
          minLength: 1
          maxLength: 128
          description: >-
            `name` | `email` | `phone` | `url` | `custom:chave`. Com `intent:
            clear`, não use `custom:`.
        intent:
          type: string
          enum:
            - clear
            - set
        literal:
          type: string
          nullable: true
          description: Valor fixo ou placeholders; usado com `set`.
        eventPath:
          type: string
          nullable: true
          description: Chave no payload do evento (com `set`).
  securitySchemes:
    ntfAutoBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '`Authorization: Bearer sk_live_...`'
    ntfAutoApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: Mesmo valor da chave, sem prefixo Bearer.

````