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

# Admin Publish Page

> Atomically publish a page's draft tree with OCC via If-Match.

The caller MUST supply the ``If-Match`` request header containing the
``draft_version`` value it observed when reading the draft.  If the
header is absent the request is rejected with 428 Precondition Required.
If the provided version no longer matches the page (a concurrent edit
occurred) the request is rejected with 409 Conflict so the caller can
re-read the draft and retry.

On success, the page's published sections and gate index are atomically
written and ``published_revision`` is incremented (R5 revision-flip-last).

Error codes
-----------
428  ``precondition_required``    — ``If-Match`` header absent.
400  ``invalid_if_match``         — ``If-Match`` value is not an integer.
404  ``page_not_found``           — page does not exist.
409  ``stale_draft``              — ``If-Match`` version does not match.
422  ``compiler_invariant``       — a non-public node is under a NULL gate (R3).
422  ``unknown_access_rule``      — a gated node references a missing rule.



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/hubs/{hub_id}/pages/{page_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}/pages/{page_id}/publish:
    post:
      tags:
        - pages-admin
      summary: Admin Publish Page
      description: >-
        Atomically publish a page's draft tree with OCC via If-Match.


        The caller MUST supply the ``If-Match`` request header containing the

        ``draft_version`` value it observed when reading the draft.  If the

        header is absent the request is rejected with 428 Precondition Required.

        If the provided version no longer matches the page (a concurrent edit

        occurred) the request is rejected with 409 Conflict so the caller can

        re-read the draft and retry.


        On success, the page's published sections and gate index are atomically

        written and ``published_revision`` is incremented (R5
        revision-flip-last).


        Error codes

        -----------

        428  ``precondition_required``    — ``If-Match`` header absent.

        400  ``invalid_if_match``         — ``If-Match`` value is not an
        integer.

        404  ``page_not_found``           — page does not exist.

        409  ``stale_draft``              — ``If-Match`` version does not match.

        422  ``compiler_invariant``       — a non-public node is under a NULL
        gate (R3).

        422  ``unknown_access_rule``      — a gated node references a missing
        rule.
      operationId: >-
        pages_admin.post_pages_admin_post_teams_by_team_id_hubs_by_hub_id_pages_by_page_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: page_id
          required: true
          schema:
            title: Page Id
            type: string
        - in: header
          name: If-Match
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: If-Match
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/PublishResponse'
          description: Successful Response
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    PublishResponse:
      additionalProperties: false
      description: Top-level JSON:API response envelope for POST .../publish.
      properties:
        data:
          $ref: '#/components/schemas/PublishResource'
      required:
        - data
      title: PublishResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    PublishResource:
      additionalProperties: false
      description: JSON:API resource object for a page publish outcome.
      properties:
        attributes:
          $ref: '#/components/schemas/PublishAttributes'
        id:
          title: Id
          type: string
        type:
          const: page_publishes
          default: page_publishes
          title: Type
          type: string
      required:
        - id
        - attributes
      title: PublishResource
      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
    PublishAttributes:
      additionalProperties: false
      description: JSON:API attributes for a page-publish outcome resource.
      properties:
        gate_count:
          title: Gate Count
          type: integer
        page_id:
          title: Page Id
          type: string
        published_revision:
          title: Published Revision
          type: integer
        section_count:
          title: Section Count
          type: integer
      required:
        - page_id
        - published_revision
        - section_count
        - gate_count
      title: PublishAttributes
      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

````