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

# Publish Automation

> Validate and snapshot the current draft as an immutable version.

Runs full graph validation (cycles, unreachable nodes, condition
trees, etc.) before inserting the version.  Returns 422 with
structured JSON:API pointers on validation failure.

Returns the new ``AutomationVersion`` resource on success (201).



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/hubs/{hub_id}/automations/{automation_id}/publish
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/teams/{team_id}/hubs/{hub_id}/automations/{automation_id}/publish:
    post:
      tags:
        - automations
      summary: Publish Automation
      description: |-
        Validate and snapshot the current draft as an immutable version.

        Runs full graph validation (cycles, unreachable nodes, condition
        trees, etc.) before inserting the version.  Returns 422 with
        structured JSON:API pointers on validation failure.

        Returns the new ``AutomationVersion`` resource on success (201).
      operationId: >-
        automations.post_automations_post_teams_by_team_id_hubs_by_hub_id_automations_by_automation_id_publish
      parameters:
        - in: path
          name: team_id
          required: true
          schema:
            title: Team Id
            type: string
        - in: path
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
        - in: path
          name: automation_id
          required: true
          schema:
            title: Automation Id
            type: string
      responses:
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/AutomationVersionResponse'
          description: Successful Response
        '400':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Bad request
        '401':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Not authenticated
        '403':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Forbidden
        '404':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Not found
        '409':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Status conflict
        '415':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Unsupported media type (requires application/vnd.api+json)
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Graph validation error
      security:
        - HTTPBearer: []
components:
  schemas:
    AutomationVersionResponse:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/AutomationVersionResource'
      required:
        - data
      title: AutomationVersionResponse
      type: object
    JsonApiErrorResponse:
      description: Error JSON:API response.
      properties:
        errors:
          items:
            $ref: '#/components/schemas/JsonApiError'
          title: Errors
          type: array
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - errors
      title: JsonApiErrorResponse
      type: object
    AutomationVersionResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/AutomationVersionAttributes'
        id:
          title: Id
          type: string
        type:
          const: automation_versions
          default: automation_versions
          title: Type
          type: string
      required:
        - id
        - attributes
      title: AutomationVersionResource
      type: object
    JsonApiError:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        source:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Source
        status:
          title: Status
          type: string
        title:
          title: Title
          type: string
      required:
        - status
        - title
      title: JsonApiError
      type: object
    AutomationVersionAttributes:
      additionalProperties: false
      properties:
        automation_id:
          title: Automation Id
          type: string
        definition:
          additionalProperties: true
          title: Definition
          type: object
        published_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Published At
        published_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Published By
        version_int:
          title: Version Int
          type: integer
      required:
        - automation_id
        - version_int
        - definition
        - published_at
        - published_by
      title: AutomationVersionAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````