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

# Create a Replier automation

> Creates an automation: keywords (or none, for any comment), up to 24 targets (posts, the next post, all future posts, Instagram stories and story mentions, or messages), the public replies and the DM with up to three buttons, an optional photo, gates (opening message, email request) and Instagram Follow Gate. Text you leave out of public replies, gates and Follow Gate comes from your saved message defaults. Studio workspaces can send a multi-step flow and keyword branches instead of a single DM. A post takes one automation: a post that already has one is refused with POST_HAS_AUTOMATION unless move_targets is true.

Needs an API key with write access.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workspaces/{workspace_id}/automations
openapi: 3.1.0
info:
  title: Replier API
  version: '1'
servers:
  - url: https://api.usereplier.com
security:
  - apiKey: []
paths:
  /v1/workspaces/{workspace_id}/automations:
    post:
      tags:
        - Automations
      summary: Create a Replier automation
      description: >-
        Creates an automation: keywords (or none, for any comment), up to 24
        targets (posts, the next post, all future posts, Instagram stories and
        story mentions, or messages), the public replies and the DM with up to
        three buttons, an optional photo, gates (opening message, email request)
        and Instagram Follow Gate. Text you leave out of public replies, gates
        and Follow Gate comes from your saved message defaults. Studio
        workspaces can send a multi-step flow and keyword branches instead of a
        single DM. A post takes one automation: a post that already has one is
        refused with POST_HAS_AUTOMATION unless move_targets is true.


        Needs an API key with write access.
      operationId: create_automation
      parameters:
        - name: workspace_id
          in: path
          required: true
          description: Workspace ID returned by `GET /v1/workspaces`
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Send the same key when you retry, and the request runs once. Without
            one, every request runs.
          schema:
            type: string
            minLength: 1
            maxLength: 128
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 80
                move_targets:
                  description: >-
                    true takes each post that another automation has as its
                    target off that automation in the same save, as the
                    dashboard's Move does; that automation keeps its other
                    targets and may be left with none. Only posts move; other
                    conflicts still refuse. The result's moved_from names each
                    one.
                  type: boolean
                targets:
                  description: Preferred target input for new calls
                  minItems: 1
                  maxItems: 24
                  type: array
                  items:
                    type: object
                    properties:
                      channel:
                        description: Target channel
                        type: string
                        enum:
                          - instagram
                          - facebook
                      account_id:
                        description: >-
                          Account ID returned by `GET
                          /v1/workspaces/{workspace_id}/accounts`
                        type: string
                        minLength: 1
                      target_type:
                        description: >-
                          Target scope. all_future_posts covers new comments on
                          every post of the account, earlier posts included; on
                          a post with its own automation, only keyword ones take
                          the comments it doesn't match; several automations can
                          each take all_future_posts on one account with
                          keywords that don't overlap (one any-comment at most).
                          unchosen_post keeps the automation ready on the
                          account without a post; it answers nothing, and any
                          other comment target on the same account replaces it.
                          story_mentions (Instagram) DMs whoever mentions the
                          account in their story, once per person per 24 hours
                          by default; it must be the automation's only target,
                          ignores keywords, and one automation per account can
                          have it. Omit only for compatibility: a non-null
                          post_id means post and null means all_future_posts.
                        type: string
                        enum:
                          - post
                          - next_post
                          - all_future_posts
                          - story_replies
                          - story_mentions
                          - next_story
                          - story
                          - message
                          - unchosen_post
                      post_id:
                        description: >-
                          Post or story ID for post/story targets; null for
                          other scopes
                        anyOf:
                          - type: string
                            minLength: 1
                          - type: 'null'
                      post_permalink:
                        anyOf:
                          - type: string
                            format: uri
                          - type: 'null'
                      post_label:
                        anyOf:
                          - type: string
                            maxLength: 500
                          - type: 'null'
                      post_image_url:
                        anyOf:
                          - type: string
                            format: uri
                          - type: 'null'
                      published_at:
                        description: >-
                          Publication timestamp returned by `GET
                          /v1/workspaces/{workspace_id}/accounts/instagram/{account_id}/stories`
                        anyOf:
                          - type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                          - type: 'null'
                    required:
                      - channel
                      - account_id
                      - post_id
                channel:
                  type: string
                  enum:
                    - instagram
                    - facebook
                account_id:
                  type: string
                  minLength: 1
                target_type:
                  description: >-
                    Target scope. all_future_posts covers new comments on every
                    post of the account, earlier posts included; on a post with
                    its own automation, only keyword ones take the comments it
                    doesn't match; several automations can each take
                    all_future_posts on one account with keywords that don't
                    overlap (one any-comment at most). unchosen_post keeps the
                    automation ready on the account without a post; it answers
                    nothing, and any other comment target on the same account
                    replaces it. story_mentions (Instagram) DMs whoever mentions
                    the account in their story, once per person per 24 hours by
                    default; it must be the automation's only target, ignores
                    keywords, and one automation per account can have it. Omit
                    only for compatibility: a non-null post_id means post and
                    null means all_future_posts.
                  type: string
                  enum:
                    - post
                    - next_post
                    - all_future_posts
                    - story_replies
                    - story_mentions
                    - next_story
                    - story
                    - message
                    - unchosen_post
                post_id:
                  anyOf:
                    - type: string
                      minLength: 1
                    - type: 'null'
                post_permalink:
                  anyOf:
                    - type: string
                      format: uri
                    - type: 'null'
                post_label:
                  anyOf:
                    - type: string
                      maxLength: 500
                    - type: 'null'
                post_image_url:
                  anyOf:
                    - type: string
                      format: uri
                    - type: 'null'
                published_at:
                  description: >-
                    Publication timestamp returned by `GET
                    /v1/workspaces/{workspace_id}/accounts/instagram/{account_id}/stories`
                  anyOf:
                    - type: string
                      format: date-time
                      pattern: >-
                        ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                    - type: 'null'
                keywords:
                  description: >-
                    A comment, story reply or message triggers the automation
                    when its text contains any keyword, ignoring letter case and
                    full-width versus half-width forms (+1 and ＋１ are the same
                    keyword), including inside longer words. An empty list
                    matches any of them. Before saving, add the other ways
                    people are likely to type each keyword, as the Replier
                    editor's keyword suggestions do: spacing and hyphen variants
                    (bitplay, bit play, bit-play), common typos, the whole word
                    in the other Chinese script (連結, 连结; never mixed). Only
                    spellings of the same word: no synonyms or translations.
                    Leave out a variant that contains a keyword (it already
                    matches) or that also matches comments meaning something
                    else (lik is inside like).
                  default: []
                  type: array
                  items:
                    type: string
                    minLength: 1
                public_reply_enabled:
                  default: true
                  type: boolean
                public_replies:
                  description: >-
                    Saved public reply text. Sent only for post comments when
                    public_reply_enabled is true. Leave out to use the public
                    replies you saved in this workspace, or Replier's default.
                  minItems: 1
                  maxItems: 5
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 300
                public_reply_selection:
                  description: >-
                    Defaults to the saved public replies' selection when
                    public_replies is left out, otherwise random.
                  type: string
                  enum:
                    - random
                    - round_robin
                dm_message:
                  description: >-
                    DM text sent to the commenter. Required unless flow is
                    provided or a photo is sent with dm_image_display "photo"
                    and no buttons; when flow is set, the entry ("dm") node's
                    message is used. With a card photo it is the card title
                    (1–80 characters). {{name}} becomes the recipient's name and
                    {{username}} their Instagram username; each falls back to
                    the other when Meta doesn't share it and counts as 30
                    characters toward the limit.
                  type: string
                dm_image_id:
                  description: >-
                    An existing uploaded photo ID from this workspace, sent as
                    dm_image_display says.
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                dm_image_display:
                  description: >-
                    How dm_image_id is sent. "card" (default): the photo is
                    cropped per channel (Instagram 1:1, Facebook 1.91:1; upload
                    the crops as `POST
                    /v1/workspaces/{workspace_id}/reply-images` describes) with
                    dm_message under it as a 1–80 character title and the
                    buttons on the card. "photo": an ordinary DM image at its
                    original ratio, never cropped (upload once without channel);
                    dm_message is optional, up to 640 characters, and is sent
                    after the photo carrying the buttons, so buttons need it. A
                    comment's first DM is one message, so a photo with text as
                    the first DM of an automation with post, next_post or
                    all_future_posts targets needs gates.opening or gates.email
                    (Follow Gate doesn't count), otherwise saving fails with
                    PHOTO_NEEDS_OPEN_CONVERSATION.
                  type: string
                  enum:
                    - card
                    - photo
                follow_gate_enabled:
                  description: >-
                    Verify Instagram recipients follow before sending the saved
                    DM. Requires at least one Instagram target; Facebook targets
                    send the saved DM without follow verification.
                  default: false
                  type: boolean
                follow_gate_message:
                  description: >-
                    Leave out to use the Follow Gate text you saved in this
                    workspace, or Replier's default.
                  type: string
                  minLength: 1
                follow_gate_button_text:
                  description: >-
                    Leave out to use the Follow Gate text you saved in this
                    workspace, or Replier's default.
                  type: string
                  minLength: 1
                  maxLength: 20
                follow_gate_retry_message:
                  description: >-
                    Leave out to use the Follow Gate text you saved in this
                    workspace, or Replier's default.
                  type: string
                  minLength: 1
                follow_gate_retry_button_text:
                  description: >-
                    Leave out to use the Follow Gate text you saved in this
                    workspace, or Replier's default.
                  type: string
                  minLength: 1
                  maxLength: 20
                follow_gate_profile_button_enabled:
                  description: >-
                    Show a button that opens the Instagram account's profile
                    above the follow confirmation button, in the follow prompt
                    and its reminder. Off unless set.
                  type: boolean
                follow_gate_profile_button_text:
                  description: >-
                    Write it in the follow prompt's language. Leave out to use
                    the label you saved in this workspace; turning the button on
                    needs one of the two.
                  type: string
                  minLength: 1
                  maxLength: 20
                buttons:
                  description: >-
                    Preferred button input for new calls: link buttons ({ title,
                    url }) and reply buttons ({ title, type: "postback", message
                    }).
                  maxItems: 3
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          title:
                            type: string
                            minLength: 1
                            maxLength: 20
                          type:
                            type: string
                            const: web_url
                          url:
                            type: string
                            format: uri
                        required:
                          - title
                          - url
                      - type: object
                        properties:
                          title:
                            type: string
                            minLength: 1
                            maxLength: 20
                          type:
                            description: >-
                              A reply button: tapping it sends message back as a
                              DM.
                            type: string
                            const: postback
                          message:
                            description: >-
                              Sent as a DM each time the button is tapped while
                              the automation is on. Up to 640 characters and
                              1000 bytes. {{name}} becomes the recipient's name
                              and {{username}} their Instagram username; each
                              falls back to the other when Meta doesn't share it
                              and counts as 30 characters toward the limit.
                            type: string
                            minLength: 1
                        required:
                          - title
                          - type
                          - message
                link_url:
                  type: string
                  format: uri
                link_button_title:
                  default: Open link
                  type: string
                  minLength: 1
                  maxLength: 20
                enabled:
                  default: true
                  type: boolean
                gates:
                  description: >-
                    Opening and email gates. Runs go trigger, public reply,
                    opening message, Follow Gate, email request, then the DM; a
                    run waiting on a gate is gated. Omitted text keeps the
                    gate's current text, then uses the default you saved in this
                    workspace (`GET
                    /v1/workspaces/{workspace_id}/message-defaults`); with
                    neither, provide the text. On update, a gate left out stays
                    as it is, and the update fails with
                    AUTOMATION_VERSION_CONFLICT if the automation changed since
                    it was read.
                  type: object
                  properties:
                    opening:
                      description: >-
                        Opening message: the recipient must tap button_text
                        before anything else is sent. null turns it off.
                      anyOf:
                        - type: object
                          properties:
                            message:
                              description: >-
                                {{name}} becomes the recipient's name and
                                {{username}} their Instagram username; each
                                falls back to the other when Meta doesn't share
                                it and counts as 30 characters toward the limit.
                              type: string
                              minLength: 1
                            button_text:
                              type: string
                              minLength: 1
                              maxLength: 20
                          additionalProperties: false
                        - type: 'null'
                    email:
                      description: >-
                        Email request: the recipient must reply with an email
                        address, which is saved to contacts (format checked
                        only, the mailbox is not verified). null turns it off.
                      anyOf:
                        - type: object
                          properties:
                            message:
                              description: >-
                                {{name}} becomes the recipient's name and
                                {{username}} their Instagram username; each
                                falls back to the other when Meta doesn't share
                                it and counts as 30 characters toward the limit.
                              type: string
                              minLength: 1
                            retry_message:
                              description: >-
                                Sent again when the reply is not an email
                                address. Max 640 characters.
                              type: string
                              minLength: 1
                          additionalProperties: false
                        - type: 'null'
                  additionalProperties: false
                follow_up:
                  description: >-
                    Follow-up message, sent once inside the 24 hours the opening
                    tap opens, so it needs gates.opening and is not available
                    with flow. With link buttons: not_clicked goes wait_hours
                    after the DM to whoever tapped no link button by then;
                    clicked goes delay_minutes after the first link tap, when
                    that tap came within wait_hours. Without link buttons only
                    not_clicked is used, wait_hours after the DM, for everyone
                    (links in dm_message are not tracked). Any message or tap
                    from the person, or a newer DM to them, cancels a waiting
                    follow-up. A send that would land in the window's last 5
                    minutes is skipped. Each message takes text, up to 3 link
                    buttons (not click-tracked) and a photo, as dm_message,
                    buttons and dm_image_id do; each branch keeps its content
                    while off. null turns it off.
                  anyOf:
                    - type: object
                      properties:
                        wait_hours:
                          type: integer
                          minimum: 1
                          maximum: 23
                        clicked:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            delay_minutes:
                              anyOf:
                                - type: number
                                  const: 0
                                - type: number
                                  const: 30
                                - type: number
                                  const: 60
                                - type: number
                                  const: 180
                            message:
                              description: >-
                                With a card photo it is the card title (max 80
                                characters); with image_display "photo" it is
                                optional and sent after the photo, and buttons
                                need it. {{name}} becomes the recipient's name
                                and {{username}} their Instagram username; each
                                falls back to the other when Meta doesn't share
                                it and counts as 30 characters toward the limit.
                              type: string
                              maxLength: 640
                            image_id:
                              description: Optional uploaded photo ID from this workspace.
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                - type: 'null'
                            image_display:
                              type: string
                              enum:
                                - card
                                - photo
                            buttons:
                              default: []
                              maxItems: 3
                              type: array
                              items:
                                type: object
                                properties:
                                  title:
                                    type: string
                                    minLength: 1
                                    maxLength: 20
                                  url:
                                    type: string
                                    format: uri
                                required:
                                  - title
                                  - url
                                additionalProperties: false
                          required:
                            - enabled
                            - delay_minutes
                            - message
                          additionalProperties: false
                        not_clicked:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            message:
                              description: >-
                                With a card photo it is the card title (max 80
                                characters); with image_display "photo" it is
                                optional and sent after the photo, and buttons
                                need it. {{name}} becomes the recipient's name
                                and {{username}} their Instagram username; each
                                falls back to the other when Meta doesn't share
                                it and counts as 30 characters toward the limit.
                              type: string
                              maxLength: 640
                            image_id:
                              description: Optional uploaded photo ID from this workspace.
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                - type: 'null'
                            image_display:
                              type: string
                              enum:
                                - card
                                - photo
                            buttons:
                              default: []
                              maxItems: 3
                              type: array
                              items:
                                type: object
                                properties:
                                  title:
                                    type: string
                                    minLength: 1
                                    maxLength: 20
                                  url:
                                    type: string
                                    format: uri
                                required:
                                  - title
                                  - url
                                additionalProperties: false
                          required:
                            - enabled
                            - message
                          additionalProperties: false
                      required:
                        - wait_hours
                        - clicked
                        - not_clicked
                      additionalProperties: false
                    - type: 'null'
                flow:
                  description: >-
                    Multi-step DM flow (Studio workspaces only). When provided,
                    dm_message, dm_image_id, dm_image_display, buttons, and
                    link_url are read from the "dm" entry node and MUST be
                    omitted from the top-level input. Postback buttons advance
                    to another node; web_url buttons open a link.
                  type: object
                  properties:
                    nodes:
                      description: >-
                        Flow nodes. Must include exactly one node with id "dm"
                        (the entry).
                      minItems: 1
                      maxItems: 50
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            description: >-
                              Node id. Use "dm" for the entry node and any other
                              unique id for follow-up nodes. Ids may not use
                              reserved words: trigger, follow-gate,
                              follow-retry, public-reply, gate:opening,
                              gate:email, gate:email-retry.
                            type: string
                            pattern: ^[A-Za-z0-9_-]{1,80}$
                          name:
                            description: Short label for the node shown in the editor.
                            type: string
                            minLength: 1
                            maxLength: 80
                          message:
                            description: >-
                              DM text sent when the node is reached. With a card
                              photo it is the card title (max 80 characters);
                              with image_display "photo" it is optional and sent
                              after the photo, and buttons need it. {{name}}
                              becomes the recipient's name and {{username}}
                              their Instagram username; each falls back to the
                              other when Meta doesn't share it and counts as 30
                              characters toward the limit.
                            type: string
                          image_id:
                            description: Optional uploaded photo ID from this workspace.
                            anyOf:
                              - type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              - type: 'null'
                          image_display:
                            description: >-
                              How image_id is sent: "card" (default) or "photo",
                              as dm_image_display in `POST
                              /v1/workspaces/{workspace_id}/automations`
                              describes.
                            type: string
                            enum:
                              - card
                              - photo
                          buttons:
                            description: >-
                              Up to 3 buttons. web_url opens a link; postback
                              advances the flow to target_node_id.
                            default: []
                            maxItems: 3
                            type: array
                            items:
                              oneOf:
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: web_url
                                    id:
                                      description: Unique button id within the node.
                                      type: string
                                      pattern: ^[A-Za-z0-9_-]{1,80}$
                                    title:
                                      type: string
                                      minLength: 1
                                      maxLength: 20
                                    url:
                                      type: string
                                      maxLength: 2000
                                      format: uri
                                  required:
                                    - type
                                    - id
                                    - title
                                    - url
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: postback
                                    id:
                                      type: string
                                      pattern: ^[A-Za-z0-9_-]{1,80}$
                                    title:
                                      type: string
                                      minLength: 1
                                      maxLength: 20
                                    target_node_id:
                                      description: >-
                                        ID of another node in this flow to open
                                        when the button is tapped.
                                      type: string
                                      pattern: ^[A-Za-z0-9_-]{1,80}$
                                  required:
                                    - type
                                    - id
                                    - title
                                    - target_node_id
                        required:
                          - id
                          - name
                          - message
                    keyword_routes:
                      description: >-
                        Branches: up to 9 more keyword branches after branch 1
                        (the automation's own keywords, sending the "dm" node
                        and the top-level public replies), each sending its own
                        first message and public replies. A comment, story reply
                        or message goes to the first branch with a keyword
                        standing alone in it, and only failing that to the first
                        with a keyword inside a longer word, branch 1 first,
                        then these in order. With no keywords of its own, the
                        automation answers whatever no other branch matches.
                        Gates run before whichever branch's message.
                      maxItems: 9
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            description: Unique branch id within the flow.
                            type: string
                            pattern: ^[A-Za-z0-9_-]{1,80}$
                          keywords:
                            description: >-
                              At least one keyword, matched like the
                              automation's own keywords. A keyword may be in
                              only one branch, the automation's own keywords
                              (branch 1) included, and may not hold an earlier
                              branch's keyword standing alone ("gift b" after
                              "gift").
                            minItems: 1
                            type: array
                            items:
                              type: string
                              minLength: 1
                          entry_node_id:
                            description: >-
                              ID of the flow node sent first to people this
                              branch matches.
                            type: string
                            pattern: ^[A-Za-z0-9_-]{1,80}$
                          public_reply_enabled:
                            description: >-
                              Defaults to the automation's own
                              public_reply_enabled.
                            type: boolean
                          public_replies:
                            description: >-
                              This branch's public replies, sent only for post
                              comments when public_reply_enabled is true.
                            minItems: 1
                            maxItems: 5
                            type: array
                            items:
                              type: string
                              minLength: 1
                              maxLength: 300
                          public_reply_selection:
                            default: random
                            type: string
                            enum:
                              - random
                              - round_robin
                        required:
                          - id
                          - keywords
                          - entry_node_id
                          - public_replies
                  required:
                    - nodes
              required:
                - name
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  workspace:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      name:
                        type: string
                      kind:
                        type: string
                        enum:
                          - personal
                          - agency
                      role:
                        type: string
                        enum:
                          - owner
                          - admin
                          - member
                    required:
                      - id
                      - name
                      - kind
                      - role
                  automation:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      version:
                        type: integer
                        exclusiveMinimum: 0
                        maximum: 9007199254740991
                      name:
                        type: string
                      enabled:
                        description: >-
                          The automation's own on/off switch. Whether it answers
                          now is status.
                        type: boolean
                      status:
                        description: >-
                          live: on and at least one target answers now.
                          not_live: on, but nothing answers; issues says why.
                          paused: switched off with enabled false.
                        type: string
                        enum:
                          - live
                          - not_live
                          - paused
                      issues:
                        description: >-
                          Each reason something doesn't answer now, with what it
                          means and what the user does. code is a target state
                          other than active (see targets[].state, listed in
                          target_ids), no_targets, workspace_paused or
                          workspace_payment_overdue. A live automation can list
                          issues for some of its targets.
                        type: array
                        items:
                          type: object
                          properties:
                            code:
                              type: string
                            target_ids:
                              type: array
                              items:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            since:
                              description: >-
                                For no_targets: when its last target was
                                removed.
                              type: string
                              format: date-time
                              pattern: >-
                                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                          required:
                            - code
                      paused:
                        description: >-
                          Only when status is paused: what turned it off, and
                          when.
                        type: object
                        properties:
                          by:
                            description: >-
                              person: someone in the workspace turned it off, or
                              removed its last target. channel_disconnect:
                              disconnecting its account's channel turned it off,
                              and reconnecting turns it back on unless someone
                              saved it since. unrecorded: Replier has no record
                              of what turned it off.
                            type: string
                            enum:
                              - person
                              - channel_disconnect
                              - unrecorded
                          at:
                            anyOf:
                              - type: string
                                format: date-time
                                pattern: >-
                                  ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                              - type: 'null'
                          by_name:
                            description: Who turned it off, when by is person.
                            type:
                              - string
                              - 'null'
                        required:
                          - by
                          - at
                          - by_name
                      keywords:
                        type: array
                        items:
                          type: string
                      public_reply_enabled:
                        type: boolean
                      public_replies:
                        type: array
                        items:
                          type: string
                      public_reply_selection:
                        type: string
                        enum:
                          - random
                          - round_robin
                      dm_message:
                        type: string
                      dm_image:
                        anyOf:
                          - type: object
                            properties:
                              id:
                                type: string
                              url:
                                type: string
                              display:
                                description: >-
                                  card: cropped per channel with the message as
                                  its title and the buttons on it. photo: sent
                                  at its original ratio, then the message (if
                                  any) with the buttons.
                                default: card
                                type: string
                                enum:
                                  - card
                                  - photo
                            required:
                              - id
                              - url
                              - display
                          - type: 'null'
                      follow_gate_enabled:
                        type: boolean
                      follow_gate_message:
                        type: string
                      follow_gate_button_text:
                        type: string
                      follow_gate_retry_message:
                        type: string
                      follow_gate_retry_button_text:
                        type: string
                      follow_gate_profile_button_enabled:
                        description: >-
                          Whether the Follow Gate prompt and its reminder show a
                          button that opens the Instagram account's profile.
                        type: boolean
                      follow_gate_profile_button_text:
                        description: >-
                          Null until the automation has its own label; turning
                          the button on then needs one.
                        type:
                          - string
                          - 'null'
                      gates:
                        description: >-
                          Opening and email gates, in addition to Follow Gate.
                          Set them with gates in `POST
                          /v1/workspaces/{workspace_id}/automations` or `PATCH
                          /v1/workspaces/{workspace_id}/automations/{automation_id}`.
                          Runs waiting on any gate appear as gated.
                        type: object
                        properties:
                          opening:
                            description: >-
                              The recipient must tap this button before the main
                              DM is sent.
                            anyOf:
                              - type: object
                                properties:
                                  message:
                                    type: string
                                  button_text:
                                    type: string
                                required:
                                  - message
                                  - button_text
                              - type: 'null'
                          email:
                            description: >-
                              The recipient must reply with an email address
                              before the main DM is sent.
                            anyOf:
                              - type: object
                                properties:
                                  message:
                                    type: string
                                  retry_message:
                                    type: string
                                required:
                                  - message
                                  - retry_message
                              - type: 'null'
                        required:
                          - opening
                          - email
                      follow_up:
                        description: >-
                          Follow-up message after the DM, or null. Set it with
                          follow_up in `POST
                          /v1/workspaces/{workspace_id}/automations` or `PATCH
                          /v1/workspaces/{workspace_id}/automations/{automation_id}`,
                          which describes when each branch is sent.
                        anyOf:
                          - type: object
                            properties:
                              wait_hours:
                                type: number
                              clicked:
                                type: object
                                properties:
                                  message:
                                    type: string
                                  image:
                                    anyOf:
                                      - type: object
                                        properties:
                                          id:
                                            type: string
                                          url:
                                            type: string
                                          display:
                                            type: string
                                        required:
                                          - id
                                          - url
                                          - display
                                      - type: 'null'
                                  buttons:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        title:
                                          type: string
                                        url:
                                          type: string
                                      required:
                                        - title
                                        - url
                                  enabled:
                                    type: boolean
                                  delay_minutes:
                                    type: number
                                required:
                                  - message
                                  - image
                                  - buttons
                                  - enabled
                                  - delay_minutes
                              not_clicked:
                                type: object
                                properties:
                                  message:
                                    type: string
                                  image:
                                    anyOf:
                                      - type: object
                                        properties:
                                          id:
                                            type: string
                                          url:
                                            type: string
                                          display:
                                            type: string
                                        required:
                                          - id
                                          - url
                                          - display
                                      - type: 'null'
                                  buttons:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        title:
                                          type: string
                                        url:
                                          type: string
                                      required:
                                        - title
                                        - url
                                  enabled:
                                    type: boolean
                                required:
                                  - message
                                  - image
                                  - buttons
                                  - enabled
                            required:
                              - wait_hours
                              - clicked
                              - not_clicked
                          - type: 'null'
                      buttons:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                id:
                                  type: string
                                title:
                                  type: string
                                url:
                                  type: string
                              required:
                                - id
                                - title
                                - url
                            - type: object
                              properties:
                                id:
                                  type: string
                                title:
                                  type: string
                                type:
                                  type: string
                                  const: postback
                                message:
                                  description: Sent as a DM when the button is tapped.
                                  type: string
                              required:
                                - id
                                - title
                                - type
                                - message
                      flow:
                        anyOf:
                          - type: object
                            properties:
                              nodes:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                    name:
                                      type: string
                                    message:
                                      type: string
                                    image:
                                      anyOf:
                                        - type: object
                                          properties:
                                            id:
                                              type: string
                                            url:
                                              type: string
                                            display:
                                              description: >-
                                                card: cropped per channel with the
                                                message as its title and the buttons on
                                                it. photo: sent at its original ratio,
                                                then the message (if any) with the
                                                buttons.
                                              default: card
                                              type: string
                                              enum:
                                                - card
                                                - photo
                                          required:
                                            - id
                                            - url
                                            - display
                                        - type: 'null'
                                    buttons:
                                      type: array
                                      items:
                                        oneOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: web_url
                                              id:
                                                type: string
                                              title:
                                                type: string
                                              url:
                                                type: string
                                            required:
                                              - type
                                              - id
                                              - title
                                              - url
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: postback
                                              id:
                                                type: string
                                              title:
                                                type: string
                                              target_node_id:
                                                type: string
                                            required:
                                              - type
                                              - id
                                              - title
                                              - target_node_id
                                  required:
                                    - id
                                    - name
                                    - message
                                    - image
                                    - buttons
                              keyword_routes:
                                description: >-
                                  Branches after the automation's own keywords
                                  (branch 1), tried in order: the first branch
                                  with a keyword standing alone in a comment,
                                  story reply or message (else the first with a
                                  keyword inside a longer word) sends its entry
                                  node and public replies.
                                type: array
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                    keywords:
                                      type: array
                                      items:
                                        type: string
                                    entry_node_id:
                                      type: string
                                    public_reply_enabled:
                                      type: boolean
                                    public_replies:
                                      type: array
                                      items:
                                        type: string
                                    public_reply_selection:
                                      type: string
                                      enum:
                                        - random
                                        - round_robin
                                  required:
                                    - id
                                    - keywords
                                    - entry_node_id
                                    - public_reply_enabled
                                    - public_replies
                                    - public_reply_selection
                            required:
                              - nodes
                          - type: 'null'
                      targets:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            channel:
                              type: string
                              enum:
                                - instagram
                                - facebook
                            account_id:
                              type: string
                            account_name:
                              description: >-
                                The Instagram username or Facebook Page name.
                                Null when the account is no longer connected to
                                this workspace.
                              type:
                                - string
                                - 'null'
                            target_type:
                              description: >-
                                scheduled_post waits for a post Replier will
                                publish and becomes post when it does.
                                unchosen_post answers nothing until a post is
                                chosen: any other comment target on the same
                                account replaces it when saved, so send the new
                                target without the unchosen_post.
                              type: string
                              enum:
                                - post
                                - next_post
                                - all_future_posts
                                - story_replies
                                - story_mentions
                                - next_story
                                - story
                                - message
                                - scheduled_post
                                - unchosen_post
                            post_id:
                              type:
                                - string
                                - 'null'
                            scheduled_post_id:
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                - type: 'null'
                            post_permalink:
                              type:
                                - string
                                - 'null'
                            post_label:
                              type:
                                - string
                                - 'null'
                            post_image_url:
                              type:
                                - string
                                - 'null'
                            activated_at:
                              anyOf:
                                - type: string
                                  format: date-time
                                  pattern: >-
                                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                                - type: 'null'
                            resolved_at:
                              description: >-
                                When a next_post, next_story or scheduled_post
                                target took this post or story and became a post
                                or story target. Null for a target chosen
                                directly.
                              anyOf:
                                - type: string
                                  format: date-time
                                  pattern: >-
                                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                                - type: 'null'
                            expires_at:
                              anyOf:
                                - type: string
                                  format: date-time
                                  pattern: >-
                                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                                - type: 'null'
                            resolution_source:
                              anyOf:
                                - type: string
                                  enum:
                                    - comment_webhook
                                    - story_reply_webhook
                                    - dashboard_refresh
                                    - scheduled_reconcile
                                    - publish
                                - type: 'null'
                            queue_position:
                              description: >-
                                For next_post, active or paused: which upcoming
                                post it will use (1 = the next post). Null
                                otherwise.
                              anyOf:
                                - type: integer
                                  exclusiveMinimum: 0
                                  maximum: 9007199254740991
                                - type: 'null'
                            state:
                              description: >-
                                Whether this target answers now. active: it
                                does. waiting_for_next_post,
                                waiting_for_next_story: it takes the account's
                                next post or story. waiting_for_publish: it
                                takes a post when Replier publishes it.
                                waiting_for_post_choice: no post chosen yet, so
                                it answers nothing. expired: the story or post
                                is gone. account_not_subscribed: the account
                                receives no comment or message events; the user
                                retries auto-reply setup in Replier.
                                account_needs_reconnect: Meta rejected the
                                account's token; the user reconnects it in
                                Replier. account_disconnected: the account is no
                                longer connected to this workspace.
                              type: string
                              enum:
                                - active
                                - waiting_for_next_post
                                - waiting_for_next_story
                                - waiting_for_publish
                                - waiting_for_post_choice
                                - expired
                                - account_not_subscribed
                                - account_needs_reconnect
                                - account_disconnected
                          required:
                            - id
                            - channel
                            - account_id
                            - target_type
                            - post_id
                            - post_permalink
                            - post_label
                            - post_image_url
                            - activated_at
                            - resolved_at
                            - expires_at
                            - resolution_source
                    required:
                      - id
                      - version
                      - name
                      - enabled
                      - keywords
                      - public_reply_enabled
                      - public_replies
                      - public_reply_selection
                      - dm_message
                      - dm_image
                      - follow_gate_enabled
                      - follow_gate_message
                      - follow_gate_button_text
                      - follow_gate_retry_message
                      - follow_gate_retry_button_text
                      - gates
                      - buttons
                      - flow
                      - targets
                  moved_from:
                    description: >-
                      Each post move_targets took off another automation, and
                      which one.
                    type: array
                    items:
                      type: object
                      properties:
                        automation_id:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        channel:
                          type: string
                          enum:
                            - instagram
                            - facebook
                        account_id:
                          type: string
                        post_id:
                          type:
                            - string
                            - 'null'
                      required:
                        - automation_id
                        - channel
                        - account_id
                        - post_id
                required:
                  - workspace
                  - automation
        default:
          $ref: '#/components/responses/Error'
components:
  responses:
    Error:
      description: Refused
      content:
        application/json:
          schema:
            type: object
            required:
              - error
            properties:
              error:
                type: object
                required:
                  - code
                  - message
                properties:
                  code:
                    type: string
                    description: >-
                      Why the request was refused, such as AUTOMATION_NOT_FOUND
                      or VERSION_CONFLICT. Other fields beside it give details.
                  message:
                    type: string
                    description: The same reason, in English.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: A Replier API key (rpl_...).

````

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