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

# Publish Automation

> Publish an automation draft.

## Publish validation

* Exactly one trigger
* Reachable graph
* No cycles in v1
* Published template versions only
* Valid branches for `condition` and `wait_for_event`

## Example publish response

```json theme={null}
{
  "data": {
    "id": "aut_123",
    "status": "active",
    "current_published_version": {
      "id": "aut_ver_456",
      "version_number": 2,
      "state": "published"
    }
  }
}
```


## OpenAPI

````yaml api-reference/openapi.json POST /automations/{id}/publish
openapi: 3.0.1
info:
  title: Sendrealm API
  description: >-
    API for email, push, audience resources, domains, campaign drafts,
    templates, events, topics, and automations
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /automations/{id}/publish:
    post:
      summary: Publish an automation
      parameters:
        - $ref: '#/components/parameters/Id'
      responses:
        '200':
          description: Automation published
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationSummaryResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    AutomationSummaryResponse:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: integer
          description: HTTP response status code
        data:
          $ref: '#/components/schemas/AutomationSummary'
    AutomationSummary:
      allOf:
        - $ref: '#/components/schemas/Automation'
        - type: object
          required:
            - current_draft_version
            - current_published_version
          properties:
            current_draft_version:
              type: object
              nullable: true
              allOf:
                - $ref: '#/components/schemas/AutomationVersion'
            current_published_version:
              type: object
              nullable: true
              allOf:
                - $ref: '#/components/schemas/AutomationVersion'
    Error:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              $ref: '#/components/schemas/JsonValue'
            issues:
              type: array
              items:
                $ref: '#/components/schemas/ValidationIssue'
    Automation:
      type: object
      required:
        - id
        - name
        - description
        - status
        - current_draft_version_id
        - current_published_version_id
        - created_at
        - updated_at
        - deleted_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type: string
          nullable: true
        status:
          type: string
        current_draft_version_id:
          type: string
          format: uuid
          nullable: true
        current_published_version_id:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
    AutomationVersion:
      type: object
      required:
        - id
        - version_number
        - state
        - definition
        - editor_layout
        - published_at
        - restored_from_version_id
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        version_number:
          type: integer
        state:
          type: string
        definition:
          $ref: '#/components/schemas/JsonObject'
        editor_layout:
          $ref: '#/components/schemas/JsonObject'
        published_at:
          type: string
          format: date-time
          nullable: true
        restored_from_version_id:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    ValidationIssue:
      type: object
      required:
        - code
        - path
        - message
      properties:
        code:
          type: string
        path:
          type: string
          nullable: true
        message:
          type: string
    JsonObject:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/JsonValue'
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````