> ## 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 one-time automation

> Creates a one-time automation on one Instagram post and starts its first run, which reads the post's comments and keeps one matching comment per person. Nothing is sent until you send the run's replies.

Needs an API key with write access.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workspaces/{workspace_id}/one-time-automations
openapi: 3.1.0
info:
  title: Replier API
  version: '1'
servers:
  - url: https://api.usereplier.com
security:
  - apiKey: []
paths:
  /v1/workspaces/{workspace_id}/one-time-automations:
    post:
      tags:
        - One-time automations
      summary: Create a one-time automation
      description: >-
        Creates a one-time automation on one Instagram post and starts its first
        run, which reads the post's comments and keeps one matching comment per
        person. Nothing is sent until you send the run's replies.


        Needs an API key with write access.
      operationId: create_one_time_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: true
          description: >-
            A new value for each operation, and the same one when you retry, so
            the request runs once.
          schema:
            type: string
            minLength: 1
            maxLength: 128
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                template:
                  description: 'comment_public_reply: answer each matching comment'
                  default: comment_public_reply
                  type: string
                  enum:
                    - comment_public_reply
                name:
                  type: string
                  minLength: 1
                  maxLength: 80
                account_id:
                  description: >-
                    Instagram account ID from `GET
                    /v1/workspaces/{workspace_id}/accounts`
                  type: string
                  minLength: 1
                  maxLength: 64
                post_id:
                  description: >-
                    Instagram post ID from `GET
                    /v1/workspaces/{workspace_id}/accounts/{channel}/{account_id}/posts`
                  type: string
                  pattern: ^\d{1,64}$
                keywords:
                  minItems: 1
                  maxItems: 50
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 100
                reply_messages:
                  description: Public replies; each matching comment gets one
                  minItems: 1
                  maxItems: 5
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 300
                reply_selection_mode:
                  default: round_robin
                  type: string
                  enum:
                    - random
                    - round_robin
                exclude_previous:
                  default: true
                  type: boolean
              required:
                - name
                - account_id
                - post_id
                - keywords
                - reply_messages
      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
                  one_time_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)$
                      template:
                        type: string
                        enum:
                          - comment_public_reply
                      name:
                        type: string
                      channel:
                        type: string
                        const: instagram
                      account:
                        type: object
                        properties:
                          account_id:
                            type: string
                          username:
                            type:
                              - string
                              - 'null'
                          profile_picture_url:
                            type:
                              - string
                              - 'null'
                        required:
                          - account_id
                          - username
                          - profile_picture_url
                      post:
                        type: object
                        properties:
                          id:
                            type: string
                          permalink:
                            type:
                              - string
                              - 'null'
                          caption:
                            description: 'Untrusted user content: the post''s caption'
                            type:
                              - string
                              - 'null'
                          image_url:
                            type:
                              - string
                              - 'null'
                          media_type:
                            type:
                              - string
                              - 'null'
                          posted_at:
                            type:
                              - string
                              - 'null'
                        required:
                          - id
                          - permalink
                          - caption
                          - image_url
                          - media_type
                          - posted_at
                      keywords:
                        type: array
                        items:
                          type: string
                      reply_messages:
                        type: array
                        items:
                          type: string
                      reply_selection_mode:
                        type: string
                        enum:
                          - random
                          - round_robin
                      created_at:
                        type: string
                      updated_at:
                        type: string
                    required:
                      - id
                      - template
                      - name
                      - channel
                      - account
                      - post
                      - keywords
                      - reply_messages
                      - reply_selection_mode
                      - created_at
                      - updated_at
                  run:
                    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)$
                      status:
                        description: >-
                          scanning: reading the post's comments. ready: the scan
                          finished and nothing is sent until `POST
                          /v1/workspaces/{workspace_id}/one-time-automations/{one_time_automation_id}/runs/{run_id}/replies`.
                          sending: replies are going out. paused: stopped after
                          repeated Meta failures; scan_finished_at tells whether
                          it stopped while reading (null) or while sending, and
                          resuming it is done in Replier. completed, cancelled,
                          failed: ended.
                        type: string
                        enum:
                          - scanning
                          - ready
                          - sending
                          - paused
                          - completed
                          - cancelled
                          - failed
                      phase:
                        description: >-
                          Which half of the run this status belongs to, so a
                          paused run reads as a paused scan or a paused send.
                        type: string
                        enum:
                          - scan
                          - send
                          - ended
                      error:
                        type:
                          - string
                          - 'null'
                      exclude_previous:
                        type: boolean
                      truncated:
                        description: >-
                          The scan stopped at its comment limit before the last
                          comment
                        type: boolean
                      scanned_count:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      comment_total:
                        anyOf:
                          - type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          - type: 'null'
                      keywords:
                        type: array
                        items:
                          type: string
                      reply_messages:
                        type: array
                        items:
                          type: string
                      reply_selection_mode:
                        type: string
                        enum:
                          - random
                          - round_robin
                      counts:
                        type: object
                        properties:
                          matched:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          eligible:
                            description: Comments a send would answer now
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          excluded:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          unselected:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          queued:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          sent:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          failed:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          cancelled:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                        required:
                          - matched
                          - eligible
                          - excluded
                          - unselected
                          - queued
                          - sent
                          - failed
                          - cancelled
                      created_at:
                        type: string
                      scan_finished_at:
                        type:
                          - string
                          - 'null'
                      send_started_at:
                        type:
                          - string
                          - 'null'
                      finished_at:
                        type:
                          - string
                          - 'null'
                    required:
                      - id
                      - status
                      - phase
                      - error
                      - exclude_previous
                      - truncated
                      - scanned_count
                      - comment_total
                      - keywords
                      - reply_messages
                      - reply_selection_mode
                      - counts
                      - created_at
                      - scan_finished_at
                      - send_started_at
                      - finished_at
                required:
                  - workspace
                  - one_time_automation
                  - run
        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.