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

# Create workflow

> Cria uma automação. Via API key fica sempre pausada: o usuário revisa e ativa no módulo de Automações. Formato completo, gatilhos, ações e variáveis {{...}} em GET /workflow/catalog.



## OpenAPI

````yaml https://api.juridiq.com.br/api-docs/client/openapi.json post /workflow/
openapi: 3.1.0
info:
  title: Juridiq API — Documentação para Integradores
  description: >-
    API REST para integradores autenticados com chave (`x-juridiq-api-key`).


    ## Rate limit


    A API aberta limita **120 requisições a cada 60s por chave**.

    Ao exceder, a resposta é `429 Too Many Requests` com os headers
    `x-ratelimit-limit`, `x-ratelimit-remaining`, `x-ratelimit-reset` e
    `retry-after`.

    Respeite o `retry-after` antes de tentar de novo. Sincronizações em lote
    devem paginar e tratar 429 com backoff.
  version: 1.0.0
servers:
  - url: https://api.juridiq.com.br
    description: Production server
security:
  - apiKeyAuth: []
tags: []
paths:
  /workflow/:
    post:
      tags:
        - Workflows
      summary: Create workflow
      description: >-
        Cria uma automação. Via API key fica sempre pausada: o usuário revisa e
        ativa no módulo de Automações. Formato completo, gatilhos, ações e
        variáveis {{...}} em GET /workflow/catalog.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  description: Nome da automação
                description:
                  type: string
                  maxLength: 1000
                  nullable: true
                  description: Descrição livre
                isActive:
                  type: boolean
                  description: >-
                    Ignorado para API key/IA: a automação sempre fica pausada
                    até o usuário ativar na tela
                variant:
                  type: string
                  enum:
                    - FULL
                    - TASK_FLOW
                    - RECURRING
                    - AUDIENCE_REMINDER
                    - BIRTHDAY
                    - EVENT_REMINDER
                    - PUBLICATION
                    - MOVEMENT
                  description: >-
                    Tela que edita o fluxo. Use FULL (editor completo) para
                    automações novas
                trigger:
                  type: string
                  enum:
                    - MANUAL_START
                    - ON_SCHEDULE
                    - ON_PUBLICATION_CREATED
                    - ON_CRM_CREATED
                    - ON_TASK_CREATED
                    - ON_EVENT_CREATED
                    - ON_AUDIENCE_CREATED
                    - ON_FINANCIAL_CREATED
                    - ON_MOVEMENT_CREATED
                    - ON_SIGNATURE_SIGNED
                    - ON_DOCUMENT_CREATED
                    - ON_LAWSUIT_CREATED
                    - ON_PERSON_CREATED
                    - ON_TASK_COLUMN_ENTERED
                    - ON_CRM_COLUMN_ENTERED
                  description: Gatilho; o mesmo do passo type "trigger" em content
                triggerData:
                  type: object
                  properties:
                    keywords:
                      type: array
                      items:
                        type: string
                        minLength: 1
                    funnelId:
                      type: string
                    columnId:
                      type: string
                    requireAllKeywords:
                      type: boolean
                    athenaAnalysis:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                        prompt:
                          type: string
                      required:
                        - enabled
                        - prompt
                      additionalProperties: false
                    schedule:
                      type: object
                      properties:
                        frequency:
                          type: string
                          enum:
                            - DAILY
                            - WEEKLY
                            - MONTHLY
                            - EVERY_N_DAYS
                            - EVERY_N_HOURS
                        time:
                          type: string
                          pattern: ^\d{2}:\d{2}$
                        weekday:
                          type: integer
                          minimum: 0
                          maximum: 6
                        monthDay:
                          type: integer
                          minimum: 1
                          maximum: 31
                        interval:
                          type: integer
                          minimum: 1
                          maximum: 365
                        timezone:
                          type: string
                          minLength: 1
                        ignoreWeekdays:
                          type: array
                          items:
                            type: integer
                            minimum: 0
                            maximum: 6
                        ignoreHours:
                          type: array
                          items:
                            type: integer
                            minimum: 0
                            maximum: 23
                        minute:
                          anyOf:
                            - type: number
                              enum:
                                - 0
                            - type: number
                              enum:
                                - 15
                            - type: number
                              enum:
                                - 30
                            - type: number
                              enum:
                                - 45
                        periodInterval:
                          type: integer
                          minimum: 1
                          maximum: 365
                        startDate:
                          type: string
                          pattern: ^\d{4}-\d{2}-\d{2}$
                        endDate:
                          type: string
                          pattern: ^\d{4}-\d{2}-\d{2}$
                      required:
                        - frequency
                      additionalProperties: false
                    startLinks:
                      type: object
                      properties:
                        lawSuit:
                          type: string
                          enum:
                            - NONE
                            - OPTIONAL
                            - REQUIRED
                        person:
                          type: string
                          enum:
                            - NONE
                            - OPTIONAL
                            - REQUIRED
                            - LAWSUIT
                      additionalProperties: false
                    startItems:
                      type: array
                      items:
                        type: object
                        properties:
                          module:
                            type: string
                            enum:
                              - LAWSUIT
                              - PERSON
                              - TASK
                              - CONSULTING
                              - TRANSACTION
                              - EVENT
                              - AUDIENCE
                          required:
                            type: boolean
                            default: false
                          includeParties:
                            type: boolean
                        required:
                          - module
                        additionalProperties: false
                    createLawsuitIfMissing:
                      type: boolean
                  additionalProperties: false
                  description: >-
                    Dados do gatilho. Formato completo, gatilhos, ações e
                    variáveis {{...}} em GET /workflow/catalog.
                content:
                  type: object
                  properties:
                    steps:
                      type: array
                      items:
                        anyOf:
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                              nextStepId:
                                type: string
                                nullable: true
                              nextStepIds:
                                type: array
                                items:
                                  type: string
                              position:
                                type: object
                                properties:
                                  x:
                                    type: number
                                  'y':
                                    type: number
                                required:
                                  - x
                                  - 'y'
                                additionalProperties: false
                              requiresPreviousComplete:
                                type: boolean
                              dependsOnStepId:
                                type: string
                                nullable: true
                              delay:
                                type: object
                                properties:
                                  amount:
                                    type: integer
                                    minimum: 1
                                    maximum: 8760
                                  unit:
                                    type: string
                                    enum:
                                      - MINUTES
                                      - HOURS
                                      - DAYS
                                required:
                                  - amount
                                  - unit
                                additionalProperties: false
                                nullable: true
                              type:
                                type: string
                                enum:
                                  - trigger
                              trigger:
                                type: string
                                enum:
                                  - MANUAL_START
                                  - ON_SCHEDULE
                                  - ON_PUBLICATION_CREATED
                                  - ON_CRM_CREATED
                                  - ON_TASK_CREATED
                                  - ON_EVENT_CREATED
                                  - ON_AUDIENCE_CREATED
                                  - ON_FINANCIAL_CREATED
                                  - ON_MOVEMENT_CREATED
                                  - ON_SIGNATURE_SIGNED
                                  - ON_DOCUMENT_CREATED
                                  - ON_LAWSUIT_CREATED
                                  - ON_PERSON_CREATED
                                  - ON_TASK_COLUMN_ENTERED
                                  - ON_CRM_COLUMN_ENTERED
                              triggerData:
                                type: object
                                properties:
                                  keywords:
                                    type: array
                                    items:
                                      type: string
                                      minLength: 1
                                  funnelId:
                                    type: string
                                  columnId:
                                    type: string
                                  requireAllKeywords:
                                    type: boolean
                                  athenaAnalysis:
                                    type: object
                                    properties:
                                      enabled:
                                        type: boolean
                                      prompt:
                                        type: string
                                    required:
                                      - enabled
                                      - prompt
                                    additionalProperties: false
                                  schedule:
                                    type: object
                                    properties:
                                      frequency:
                                        type: string
                                        enum:
                                          - DAILY
                                          - WEEKLY
                                          - MONTHLY
                                          - EVERY_N_DAYS
                                          - EVERY_N_HOURS
                                      time:
                                        type: string
                                        pattern: ^\d{2}:\d{2}$
                                      weekday:
                                        type: integer
                                        minimum: 0
                                        maximum: 6
                                      monthDay:
                                        type: integer
                                        minimum: 1
                                        maximum: 31
                                      interval:
                                        type: integer
                                        minimum: 1
                                        maximum: 365
                                      timezone:
                                        type: string
                                        minLength: 1
                                      ignoreWeekdays:
                                        type: array
                                        items:
                                          type: integer
                                          minimum: 0
                                          maximum: 6
                                      ignoreHours:
                                        type: array
                                        items:
                                          type: integer
                                          minimum: 0
                                          maximum: 23
                                      minute:
                                        anyOf:
                                          - type: number
                                            enum:
                                              - 0
                                          - type: number
                                            enum:
                                              - 15
                                          - type: number
                                            enum:
                                              - 30
                                          - type: number
                                            enum:
                                              - 45
                                      periodInterval:
                                        type: integer
                                        minimum: 1
                                        maximum: 365
                                      startDate:
                                        type: string
                                        pattern: ^\d{4}-\d{2}-\d{2}$
                                      endDate:
                                        type: string
                                        pattern: ^\d{4}-\d{2}-\d{2}$
                                    required:
                                      - frequency
                                    additionalProperties: false
                                  startLinks:
                                    type: object
                                    properties:
                                      lawSuit:
                                        type: string
                                        enum:
                                          - NONE
                                          - OPTIONAL
                                          - REQUIRED
                                      person:
                                        type: string
                                        enum:
                                          - NONE
                                          - OPTIONAL
                                          - REQUIRED
                                          - LAWSUIT
                                    additionalProperties: false
                                  startItems:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        module:
                                          type: string
                                          enum:
                                            - LAWSUIT
                                            - PERSON
                                            - TASK
                                            - CONSULTING
                                            - TRANSACTION
                                            - EVENT
                                            - AUDIENCE
                                        required:
                                          type: boolean
                                          default: false
                                        includeParties:
                                          type: boolean
                                      required:
                                        - module
                                      additionalProperties: false
                                  createLawsuitIfMissing:
                                    type: boolean
                                additionalProperties: false
                            required:
                              - id
                              - type
                              - trigger
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                              nextStepId:
                                type: string
                                nullable: true
                              nextStepIds:
                                type: array
                                items:
                                  type: string
                              position:
                                type: object
                                properties:
                                  x:
                                    type: number
                                  'y':
                                    type: number
                                required:
                                  - x
                                  - 'y'
                                additionalProperties: false
                              requiresPreviousComplete:
                                type: boolean
                              dependsOnStepId:
                                type: string
                                nullable: true
                              delay:
                                type: object
                                properties:
                                  amount:
                                    type: integer
                                    minimum: 1
                                    maximum: 8760
                                  unit:
                                    type: string
                                    enum:
                                      - MINUTES
                                      - HOURS
                                      - DAYS
                                required:
                                  - amount
                                  - unit
                                additionalProperties: false
                                nullable: true
                              type:
                                type: string
                                enum:
                                  - action
                              action:
                                type: string
                                enum:
                                  - CREATE
                                  - APPROVE
                                  - ALERT
                                  - MANAGE
                                  - WEBHOOK
                                  - JURICHAT_MESSAGE
                                  - CREATE_TASK
                                  - CREATE_EVENT
                                  - CREATE_AUDIENCE
                                  - CREATE_CONSULTING
                                  - CREATE_TRANSACTION
                                  - UPDATE_CONSULTING_COLUMN
                                  - CREATE_SIGNATURE
                                  - CREATE_DOCUMENT
                                  - CREATE_ALERT
                              targetModule:
                                type: string
                                enum:
                                  - TASK
                                  - EVENT
                                  - AUDIENCE
                                  - CONSULTING
                                  - TRANSACTION
                                  - SIGNATURE
                                  - DOCUMENT
                                  - LAWSUIT
                              itemCode:
                                type: string
                                minLength: 1
                              targetItemCode:
                                type: string
                                minLength: 1
                              completeOnCreate:
                                type: boolean
                                default: false
                              config:
                                type: object
                                additionalProperties: {}
                                default: {}
                            required:
                              - id
                              - type
                              - action
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                              nextStepId:
                                type: string
                                nullable: true
                              nextStepIds:
                                type: array
                                items:
                                  type: string
                              position:
                                type: object
                                properties:
                                  x:
                                    type: number
                                  'y':
                                    type: number
                                required:
                                  - x
                                  - 'y'
                                additionalProperties: false
                              requiresPreviousComplete:
                                type: boolean
                              dependsOnStepId:
                                type: string
                                nullable: true
                              delay:
                                type: object
                                properties:
                                  amount:
                                    type: integer
                                    minimum: 1
                                    maximum: 8760
                                  unit:
                                    type: string
                                    enum:
                                      - MINUTES
                                      - HOURS
                                      - DAYS
                                required:
                                  - amount
                                  - unit
                                additionalProperties: false
                                nullable: true
                              type:
                                type: string
                                enum:
                                  - condition
                              condition:
                                type: string
                                enum:
                                  - IF_KEYWORD_IN_CONTENT
                                  - IF_STEP_OVERDUE
                                  - IF_HAS_LAWSUIT
                                  - IF_HAS_PERSON
                                  - WAIT_FOR_STATE
                              conditionData:
                                type: object
                                additionalProperties: {}
                              options:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    text:
                                      type: string
                                    title:
                                      type: string
                                    value:
                                      type: string
                                    nextStepId:
                                      type: string
                                      nullable: true
                                    kind:
                                      type: string
                                      enum:
                                        - KEYWORD
                                        - ATHENA
                                    instruction:
                                      type: string
                                      maxLength: 2000
                                    keywords:
                                      type: array
                                      items:
                                        type: string
                                        maxLength: 200
                                      maxItems: 50
                                  required:
                                    - text
                                    - title
                                    - value
                                    - nextStepId
                                  additionalProperties: false
                            required:
                              - id
                              - type
                              - condition
                              - options
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                              nextStepId:
                                type: string
                                nullable: true
                              nextStepIds:
                                type: array
                                items:
                                  type: string
                              position:
                                type: object
                                properties:
                                  x:
                                    type: number
                                  'y':
                                    type: number
                                required:
                                  - x
                                  - 'y'
                                additionalProperties: false
                              requiresPreviousComplete:
                                type: boolean
                              dependsOnStepId:
                                type: string
                                nullable: true
                              delay:
                                type: object
                                properties:
                                  amount:
                                    type: integer
                                    minimum: 1
                                    maximum: 8760
                                  unit:
                                    type: string
                                    enum:
                                      - MINUTES
                                      - HOURS
                                      - DAYS
                                required:
                                  - amount
                                  - unit
                                additionalProperties: false
                                nullable: true
                              type:
                                type: string
                                enum:
                                  - gate
                              waitForStepId:
                                type: string
                                minLength: 1
                            required:
                              - id
                              - type
                              - waitForStepId
                            additionalProperties: false
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                              nextStepId:
                                enum:
                                  - 'null'
                                nullable: true
                              nextStepIds:
                                type: array
                                items:
                                  type: string
                              position:
                                type: object
                                properties:
                                  x:
                                    type: number
                                  'y':
                                    type: number
                                required:
                                  - x
                                  - 'y'
                                additionalProperties: false
                              requiresPreviousComplete:
                                type: boolean
                              dependsOnStepId:
                                type: string
                                nullable: true
                              delay:
                                type: object
                                properties:
                                  amount:
                                    type: integer
                                    minimum: 1
                                    maximum: 8760
                                  unit:
                                    type: string
                                    enum:
                                      - MINUTES
                                      - HOURS
                                      - DAYS
                                required:
                                  - amount
                                  - unit
                                additionalProperties: false
                                nullable: true
                              type:
                                type: string
                                enum:
                                  - end
                            required:
                              - id
                              - type
                            additionalProperties: false
                    initialStepId:
                      type: string
                      nullable: true
                  required:
                    - steps
                  additionalProperties: false
                  description: >-
                    Grafo de passos: { initialStepId, steps: [...] }. Formato
                    completo, gatilhos, ações e variáveis {{...}} em GET
                    /workflow/catalog.
                tagIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 50
                  description: Etiquetas (ids)
              required:
                - name
                - trigger
                - content
              additionalProperties: false
        required: true
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  workflow: {}
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  statusCode:
                    type: number
                  translateMessage:
                    type: string
                required:
                  - message
                  - statusCode
                  - translateMessage
                additionalProperties: false
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-juridiq-api-key
      description: >-
        Chave de API do escritório (criada no painel). Envie o valor no header
        x-juridiq-api-key. A API aberta aplica rate limit por chave (veja a
        documentação de integradores).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.