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

# Create an ordinary Automation

> Saves an ordinary Automation through native authoring and admission. The returned revision identifies the saved configuration, not completion of a scheduled run.



## OpenAPI

````yaml /openapi.json post /v1/automations
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/automations:
    post:
      tags:
        - Automations
      summary: Create an ordinary Automation
      description: >-
        Saves an ordinary Automation through native authoring and admission. The
        returned revision identifies the saved configuration, not completion of
        a scheduled run.
      operationId: create_automation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                org_id:
                  type: string
                  minLength: 1
                  description: >-
                    Git-provider organization ID. Required for workspace keys;
                    omit for organization keys. This differs from the CodeRabbit
                    organization ID in scope.id.
                message_platform_provider:
                  enum:
                    - slack
                    - discord
                    - microsoft_teams
                  type: string
                  default: slack
                definition:
                  type: object
                  properties:
                    title:
                      type: string
                      minLength: 1
                      maxLength: 1000
                    summary:
                      type: string
                      minLength: 1
                      maxLength: 4000
                    taskPrompt:
                      type: string
                      minLength: 1
                      maxLength: 20000
                    messagePlatformPostingPrompt:
                      anyOf:
                        - type: string
                          minLength: 1
                          maxLength: 4000
                        - type: string
                          nullable: true
                          enum:
                            - null
                    status:
                      enum:
                        - active
                        - paused
                      type: string
                      default: active
                    trigger:
                      anyOf:
                        - type: object
                          properties:
                            kind:
                              enum:
                                - recurring
                            schedule:
                              type: object
                              properties:
                                frequency:
                                  enum:
                                    - minutely
                                    - hourly
                                    - daily
                                    - weekly
                                    - monthly
                                  type: string
                                interval:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                  exclusiveMinimum: true
                                  default: 1
                                timezone:
                                  type: string
                                  minLength: 1
                                  default: UTC
                                hour:
                                  type: integer
                                  minimum: 0
                                  maximum: 23
                                minute:
                                  type: integer
                                  minimum: 0
                                  maximum: 59
                                dayOfMonth:
                                  type: integer
                                  minimum: 1
                                  maximum: 31
                                weekdays:
                                  type: array
                                  items:
                                    enum:
                                      - monday
                                      - tuesday
                                      - wednesday
                                      - thursday
                                      - friday
                                      - saturday
                                      - sunday
                                    type: string
                              required:
                                - frequency
                          required:
                            - kind
                            - schedule
                        - type: object
                          properties:
                            kind:
                              enum:
                                - one_time
                            runAt:
                              type: string
                              format: date-time
                            timezone:
                              type: string
                              minLength: 1
                          required:
                            - kind
                            - runAt
                            - timezone
                        - type: object
                          properties:
                            kind:
                              enum:
                                - new_channel_message
                            author:
                              type: object
                              properties:
                                mode:
                                  enum:
                                    - bots
                              required:
                                - mode
                              additionalProperties: false
                            channelId:
                              type: string
                              minLength: 1
                              maxLength: 255
                            channelName:
                              type: string
                              minLength: 1
                              maxLength: 255
                            messagePlatformProvider:
                              enum:
                                - slack
                                - discord
                                - microsoft_teams
                              type: string
                              default: slack
                            textIncludes:
                              type: array
                              maxItems: 25
                              items:
                                type: string
                                minLength: 1
                                maxLength: 200
                              default: []
                          required:
                            - kind
                            - channelId
                        - type: object
                          properties:
                            kind:
                              enum:
                                - external_webhook
                            provider:
                              enum:
                                - custom
                                - datadog
                                - gcp
                                - github
                                - gitlab
                                - intercom
                                - jira
                                - linear
                                - pagerduty
                                - pylon
                                - sentry
                                - zendesk
                              type: string
                            connectionId:
                              type: string
                              minLength: 1
                            connectionName:
                              type: string
                              minLength: 1
                              maxLength: 255
                            githubWebhook:
                              type: object
                              properties:
                                repositoryId:
                                  type: string
                                  minLength: 1
                                  maxLength: 255
                              required:
                                - repositoryId
                            authorizationConnectionId:
                              type: string
                              minLength: 1
                            teamScope:
                              anyOf:
                                - type: object
                                  properties:
                                    mode:
                                      enum:
                                        - all_public
                                  required:
                                    - mode
                                - type: object
                                  properties:
                                    mode:
                                      enum:
                                        - selected
                                    teamIds:
                                      type: array
                                      minItems: 1
                                      maxItems: 50
                                      items:
                                        type: string
                                        minLength: 1
                                        maxLength: 255
                                  required:
                                    - mode
                                    - teamIds
                            projectScope:
                              anyOf:
                                - type: object
                                  properties:
                                    mode:
                                      enum:
                                        - all
                                  required:
                                    - mode
                                - type: object
                                  properties:
                                    mode:
                                      enum:
                                        - selected
                                    projectIds:
                                      type: array
                                      minItems: 1
                                      maxItems: 50
                                      items:
                                        type: string
                                        pattern: ^[1-9]\d*$
                                  required:
                                    - mode
                                    - projectIds
                            eventTypes:
                              type: array
                              items:
                                type: string
                                minLength: 1
                                maxLength: 200
                              default: []
                            rules:
                              type: array
                              maxItems: 25
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    minLength: 1
                                    maxLength: 120
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  enabled:
                                    type: boolean
                                  eventTypes:
                                    type: array
                                    maxItems: 50
                                    items:
                                      type: string
                                      minLength: 1
                                      maxLength: 160
                                    default: []
                                  conditions:
                                    type: array
                                    maxItems: 20
                                    items:
                                      type: object
                                      properties:
                                        field:
                                          type: string
                                          minLength: 1
                                          maxLength: 255
                                        operator:
                                          enum:
                                            - equals
                                            - contains
                                            - starts_with
                                            - exists
                                            - regex
                                          type: string
                                        value:
                                          type: string
                                          maxLength: 2000
                                      required:
                                        - field
                                        - operator
                                    default: []
                                  outcome:
                                    enum:
                                      - drop
                                      - run_action
                                    type: string
                                required:
                                  - id
                                  - name
                                  - enabled
                                  - outcome
                            defaultOutcome:
                              enum:
                                - drop
                                - run_action
                              type: string
                            conditionsAuthored:
                              enum:
                                - true
                            conditions:
                              type: array
                              maxItems: 20
                              items:
                                type: object
                                properties:
                                  field:
                                    type: string
                                    minLength: 1
                                    maxLength: 255
                                  operator:
                                    enum:
                                      - equals
                                      - contains
                                      - starts_with
                                      - exists
                                      - regex
                                    type: string
                                  value:
                                    type: string
                                    maxLength: 2000
                                required:
                                  - field
                                  - operator
                              default: []
                            rootMessagePrompt:
                              type: string
                              minLength: 1
                              maxLength: 4000
                          required:
                            - kind
                            - provider
                    destinations:
                      type: array
                      minItems: 1
                      maxItems: 10
                      items:
                        anyOf:
                          - type: object
                            properties:
                              kind:
                                enum:
                                  - message_platform
                              provider:
                                enum:
                                  - slack
                                  - discord
                                  - microsoft_teams
                                type: string
                              channelId:
                                type: string
                                minLength: 1
                                maxLength: 255
                              channelName:
                                type: string
                                minLength: 1
                                maxLength: 255
                            required:
                              - kind
                              - provider
                              - channelId
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                enum:
                                  - connection
                              connectionRef:
                                type: object
                                properties:
                                  kind:
                                    enum:
                                      - workspace_connection
                                  id:
                                    type: string
                                    minLength: 1
                                    maxLength: 255
                                required:
                                  - kind
                                  - id
                                additionalProperties: false
                              instruction:
                                type: string
                                minLength: 1
                                maxLength: 4000
                            required:
                              - kind
                              - connectionRef
                              - instruction
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                enum:
                                  - github_repository
                              repositoryId:
                                type: string
                                minLength: 1
                                maxLength: 255
                              repositoryName:
                                type: string
                                minLength: 1
                                maxLength: 255
                                pattern: ^[^/]+\/[^/]+$
                              instruction:
                                type: string
                                minLength: 1
                                maxLength: 4000
                            required:
                              - kind
                              - repositoryId
                              - repositoryName
                              - instruction
                            additionalProperties: false
                    deliveryMode:
                      enum:
                        - same_thread
                        - fresh_thread
                      type: string
                      default: fresh_thread
                    messagePlatformTargetEnabled:
                      type: boolean
                      default: true
                    subscribeToThreadUpdates:
                      type: boolean
                    executionLocation:
                      enum:
                        - conversation
                        - code_channel
                      type: string
                    homePresentation:
                      type: object
                      properties:
                        liveStatus:
                          enum:
                            - show
                            - hide
                          type: string
                        finalReply:
                          enum:
                            - show
                            - hide
                          type: string
                      additionalProperties: false
                    messagePlatformProvider:
                      enum:
                        - slack
                        - discord
                        - microsoft_teams
                      type: string
                    channelId:
                      type: string
                      minLength: 1
                      maxLength: 255
                    channelName:
                      type: string
                      minLength: 1
                      maxLength: 255
                    slackDmPolicy:
                      anyOf:
                        - type: object
                          properties:
                            mode:
                              enum:
                                - creator
                            allowFiles:
                              type: boolean
                          required:
                            - mode
                            - allowFiles
                        - type: object
                          properties:
                            mode:
                              enum:
                                - fixed
                            userIds:
                              type: array
                              minItems: 1
                              maxItems: 10
                              items:
                                type: string
                                pattern: ^[UW][A-Z0-9]+$
                            allowFiles:
                              type: boolean
                          required:
                            - mode
                            - userIds
                            - allowFiles
                        - type: object
                          properties:
                            mode:
                              enum:
                                - task_selected
                            allowFiles:
                              type: boolean
                          required:
                            - mode
                            - allowFiles
                    botChannelSecondaryDestination:
                      anyOf:
                        - type: object
                          properties:
                            provider:
                              enum:
                                - slack
                                - discord
                                - microsoft_teams
                              type: string
                            channelId:
                              type: string
                              minLength: 1
                              maxLength: 255
                            channelName:
                              type: string
                              minLength: 1
                              maxLength: 255
                          required:
                            - provider
                            - channelId
                        - type: string
                          nullable: true
                          enum:
                            - null
                    actions:
                      type: array
                      maxItems: 25
                      items:
                        type: object
                        properties:
                          type:
                            enum:
                              - prompt_run
                          actionId:
                            type: string
                            minLength: 1
                            maxLength: 255
                          label:
                            type: string
                            minLength: 1
                            maxLength: 255
                          prompt:
                            type: string
                            minLength: 1
                            maxLength: 20000
                          style:
                            enum:
                              - primary
                              - danger
                            type: string
                        required:
                          - type
                          - actionId
                          - label
                          - prompt
                        additionalProperties: false
                    finalReplyActionPropagation:
                      enum:
                        - initial_reply
                        - every_reply
                      type: string
                      default: every_reply
                    execution:
                      anyOf:
                        - type: object
                          properties:
                            kind:
                              enum:
                                - single_prompt
                          required:
                            - kind
                          additionalProperties: false
                        - type: object
                          properties:
                            kind:
                              enum:
                                - prompt_chain
                            phases:
                              type: array
                              minItems: 2
                              maxItems: 10
                              items:
                                type: object
                                properties:
                                  phaseId:
                                    type: string
                                    minLength: 1
                                    maxLength: 120
                                  prompt:
                                    type: string
                                    minLength: 1
                                    maxLength: 20000
                                  delayMs:
                                    type: integer
                                    minimum: 0
                                    maximum: 604800000
                                  executionMode:
                                    enum:
                                      - slack_only
                                      - codex_workspace
                                    type: string
                                  startStatusCard:
                                    type: object
                                    additionalProperties: {}
                                  metadata:
                                    type: object
                                    additionalProperties: {}
                                required:
                                  - phaseId
                                  - prompt
                                additionalProperties: false
                          required:
                            - kind
                            - phases
                          additionalProperties: false
                  required:
                    - title
                    - taskPrompt
                    - trigger
                  description: >-
                    Ordinary Automation definition. Uses the native trigger and
                    destination field names. Factory assignments and UI
                    experience settings are not accepted.
              required:
                - definition
              additionalProperties: false
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  automation_id:
                    type: string
                  revision:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                    exclusiveMinimum: true
                required:
                  - automation_id
                  - revision
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - invalid_request
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - unauthenticated
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '403':
          description: '403'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - forbidden
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '404':
          description: '404'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - not_found
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '409':
          description: '409'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - head_changed
                          - conflict
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '412':
          description: '412'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - precondition_failed
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '413':
          description: '413'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - payload_too_large
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '429':
          description: '429'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - rate_limit_exceeded
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '500':
          description: '500'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - internal_error
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '503':
          description: '503'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - unavailable
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-coderabbitai-api-key
      description: >-
        API key for authentication. You can create an API key from the
        CodeRabbit dashboard.

````

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