> ## 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.

# Create Hub Publish

> Publish all: the listed pages' drafts, the hub fields, the media and
playlist items, the pending-ops queue replace and the publish record — in
ONE transaction. Any failure changes nothing.

Pages whose draft equals their published tree, or that have no draft, are
skipped (``skipped_page_ids``), never republished. ``If-Match`` is the
pending-ops version; the response's ``ETag`` is the new one.

Errors: 428 ``precondition_required``; 400 ``invalid_if_match`` /
``invalid_hub_etag``; 409 ``stale_pending_ops`` / ``stale_draft`` /
``stale_hub`` / ``version_space_exhausted``; 422 ``page_not_found`` /
``media_target_not_found`` / ``input_bound_exceeded`` / ``duplicate_item`` /
``nothing_to_publish`` / ``hub_etag_required`` / ``settings_key_not_clearable`` /
``clear_key_conflict`` / ``navigation_target_unpublished`` /
``navigation_page_invalid`` / ``compiler_invariant`` / ``unknown_access_rule``;
503 ``media_module_disabled`` / ``publish_timed_out``. Item errors carry
``source.pointer`` (request order) and ``meta.item``.



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/hubs/{hub_id}/publishes
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}/publishes:
    post:
      tags:
        - hubs-admin
      summary: Create Hub Publish
      description: >-
        Publish all: the listed pages' drafts, the hub fields, the media and

        playlist items, the pending-ops queue replace and the publish record —
        in

        ONE transaction. Any failure changes nothing.


        Pages whose draft equals their published tree, or that have no draft,
        are

        skipped (``skipped_page_ids``), never republished. ``If-Match`` is the

        pending-ops version; the response's ``ETag`` is the new one.


        Errors: 428 ``precondition_required``; 400 ``invalid_if_match`` /

        ``invalid_hub_etag``; 409 ``stale_pending_ops`` / ``stale_draft`` /

        ``stale_hub`` / ``version_space_exhausted``; 422 ``page_not_found`` /

        ``media_target_not_found`` / ``input_bound_exceeded`` /
        ``duplicate_item`` /

        ``nothing_to_publish`` / ``hub_etag_required`` /
        ``settings_key_not_clearable`` /

        ``clear_key_conflict`` / ``navigation_target_unpublished`` /

        ``navigation_page_invalid`` / ``compiler_invariant`` /
        ``unknown_access_rule``;

        503 ``media_module_disabled`` / ``publish_timed_out``. Item errors carry

        ``source.pointer`` (request order) and ``meta.item``.
      operationId: >-
        hubs_admin.post_hubs_admin_post_teams_by_team_id_hubs_by_hub_id_publishes
      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: header
          name: If-Match
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: If-Match
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/HubPublishCreateEnvelope'
        required: true
      responses:
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HubPublishResponse'
          description: Successful Response
          headers:
            ETag:
              description: >-
                New pending-ops queue version (quoted). Send as If-Match on the
                next queue write.
              schema:
                type: string
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    HubPublishCreateEnvelope:
      additionalProperties: false
      description: >-
        Body of ``POST …/hubs/{hub_id}/publishes``. The pending-ops queue
        version

        travels in the ``If-Match`` header, not here.
      properties:
        data:
          $ref: '#/components/schemas/HubPublishCreateResource'
      required:
        - data
      title: HubPublishCreateEnvelope
      type: object
    HubPublishResponse:
      properties:
        data:
          $ref: '#/components/schemas/HubPublishResource'
      required:
        - data
      title: HubPublishResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    HubPublishCreateResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/HubPublishCreateAttributes'
        type:
          const: hub_publishes
          title: Type
          type: string
      required:
        - type
        - attributes
      title: HubPublishCreateResource
      type: object
    HubPublishResource:
      properties:
        attributes:
          $ref: '#/components/schemas/HubPublishAttributes'
        id:
          title: Id
          type: string
        type:
          const: hub_publishes
          default: hub_publishes
          title: Type
          type: string
      required:
        - id
        - attributes
      title: HubPublishResource
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    HubPublishCreateAttributes:
      additionalProperties: false
      properties:
        hub:
          anyOf:
            - $ref: '#/components/schemas/HubPublishHubChanges'
            - type: 'null'
        media:
          items:
            $ref: '#/components/schemas/HubPublishMediaItem'
          title: Media
          type: array
        pages:
          items:
            $ref: '#/components/schemas/HubPublishPageItem'
          title: Pages
          type: array
        pending_ops_remaining:
          items: {}
          title: Pending Ops Remaining
          type: array
        playlists:
          items:
            $ref: '#/components/schemas/HubPublishPlaylistItem'
          title: Playlists
          type: array
      title: HubPublishCreateAttributes
      type: object
    HubPublishAttributes:
      properties:
        actor_id:
          title: Actor Id
          type: string
        actor_type:
          enum:
            - user
            - contact
          title: Actor Type
          type: string
        cleared_settings_keys:
          items:
            type: string
          title: Cleared Settings Keys
          type: array
        hub_etag:
          description: The hub's entity tag after the publish (quoted).
          title: Hub Etag
          type: string
        hub_fields_changed:
          items:
            type: string
          title: Hub Fields Changed
          type: array
        hub_id:
          title: Hub Id
          type: string
        media:
          items:
            $ref: '#/components/schemas/HubPublishMediaResult'
          title: Media
          type: array
        pages:
          items:
            $ref: '#/components/schemas/HubPublishPageResult'
          title: Pages
          type: array
        pending_ops_version:
          title: Pending Ops Version
          type: integer
        pending_ops_version_consumed:
          title: Pending Ops Version Consumed
          type: integer
        playlists:
          items:
            $ref: '#/components/schemas/HubPublishPlaylistResult'
          title: Playlists
          type: array
        published_at:
          format: date-time
          title: Published At
          type: string
        skipped_page_ids:
          items:
            type: string
          title: Skipped Page Ids
          type: array
        skipped_playlist_ids:
          items:
            type: string
          title: Skipped Playlist Ids
          type: array
      required:
        - hub_id
        - published_at
        - actor_type
        - actor_id
        - pages
        - skipped_page_ids
        - hub_fields_changed
        - cleared_settings_keys
        - media
        - playlists
        - skipped_playlist_ids
        - hub_etag
        - pending_ops_version_consumed
        - pending_ops_version
      title: HubPublishAttributes
      type: object
    HubPublishHubChanges:
      additionalProperties: false
      properties:
        branding:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Branding
        clear_settings_keys:
          items:
            type: string
          title: Clear Settings Keys
          type: array
        expected_etag:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Etag
        navigation:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Navigation
        settings:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Settings
      title: HubPublishHubChanges
      type: object
    HubPublishMediaItem:
      additionalProperties: false
      description: >-
        A media-library file to publish into the hub (the editor's
        ``media.activate``).


        ``published_at`` is REQUIRED — a datetime or an explicit ``null`` — so
        the

        client can never take a scheduled file live by forgetting the field. It
        is

        written verbatim, with the media module's own meaning: ``null`` = draft

        (not live), future = scheduled, ``<= now`` = live.
      properties:
        file_id:
          maxLength: 64
          minLength: 1
          title: File Id
          type: string
        published_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Published At
        visibility:
          enum:
            - members
            - private
            - public
          title: Visibility
          type: string
      required:
        - file_id
        - visibility
        - published_at
      title: HubPublishMediaItem
      type: object
    HubPublishPageItem:
      additionalProperties: false
      description: One page to publish / discard, with the draft version the client saw.
      properties:
        expected_draft_version:
          maximum: 2147483646
          minimum: 0
          title: Expected Draft Version
          type: integer
        page_id:
          maxLength: 64
          minLength: 1
          title: Page Id
          type: string
      required:
        - page_id
        - expected_draft_version
      title: HubPublishPageItem
      type: object
    HubPublishPlaylistItem:
      additionalProperties: false
      description: |-
        A playlist publish/unpublish. ``visibility`` is required for ``publish``
        and forbidden for ``unpublish``.
      properties:
        action:
          enum:
            - publish
            - unpublish
          title: Action
          type: string
        playlist_id:
          maxLength: 64
          minLength: 1
          title: Playlist Id
          type: string
        visibility:
          anyOf:
            - enum:
                - members
                - private
                - public
              type: string
            - type: 'null'
          title: Visibility
      required:
        - playlist_id
        - action
      title: HubPublishPlaylistItem
      type: object
    HubPublishMediaResult:
      properties:
        file_id:
          title: File Id
          type: string
        published_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Published At
        visibility:
          enum:
            - members
            - private
            - public
          title: Visibility
          type: string
      required:
        - file_id
        - visibility
        - published_at
      title: HubPublishMediaResult
      type: object
    HubPublishPageResult:
      properties:
        gate_count:
          title: Gate Count
          type: integer
        page_id:
          title: Page Id
          type: string
        previous_revision:
          title: Previous Revision
          type: integer
        published_revision:
          title: Published Revision
          type: integer
        section_count:
          title: Section Count
          type: integer
        was_new:
          title: Was New
          type: boolean
      required:
        - page_id
        - previous_revision
        - published_revision
        - was_new
        - section_count
        - gate_count
      title: HubPublishPageResult
      type: object
    HubPublishPlaylistResult:
      properties:
        action:
          enum:
            - publish
            - unpublish
          title: Action
          type: string
        playlist_id:
          title: Playlist Id
          type: string
        published_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Published At
        visibility:
          anyOf:
            - enum:
                - members
                - private
                - public
              type: string
            - type: 'null'
          title: Visibility
      required:
        - playlist_id
        - action
      title: HubPublishPlaylistResult
      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

````

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