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

# Publish a COMPLETED tree (require_review flow)

> Promote a COMPLETED tree to PUBLISHED.

Only meaningful when the app has `require_review=True`. Apps without
require_review serve COMPLETED to the daemon directly and never need
to publish. Calling this on an app with require_review=False is still
allowed — the row gets stamped published_at/published_by — but it
has no functional effect on what the daemon serves.

Status guard: only COMPLETED can be published. PROCESSING means the
workflow is still writing; FAILED has nothing to ship; PUBLISHED is
a no-op (idempotent).



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml post /context-documents/tree/{tree_id}/publish
openapi: 3.1.0
info:
  title: Hyperspell API
  summary: >-
    Hyperspell is the memory layer for AI apps and agents. Through the API, you
    can add memories, connect data sources to index them in real-time, and
    search memories with our natural language query engine.
  termsOfService: https://hyperspell.com/blog/tos
  contact:
    name: Hyperspell
    url: https://hyperspell.com/
    email: hello@hyperspell.com
  version: 0.32.1
servers:
  - url: https://api.hyperspell.com
    description: Production
security:
  - APIKey: []
    AsUser: []
paths:
  /context-documents/tree/{tree_id}/publish:
    post:
      tags:
        - Context Documents
      summary: Publish a COMPLETED tree (require_review flow)
      description: |-
        Promote a COMPLETED tree to PUBLISHED.

        Only meaningful when the app has `require_review=True`. Apps without
        require_review serve COMPLETED to the daemon directly and never need
        to publish. Calling this on an app with require_review=False is still
        allowed — the row gets stamped published_at/published_by — but it
        has no functional effect on what the daemon serves.

        Status guard: only COMPLETED can be published. PROCESSING means the
        workflow is still writing; FAILED has nothing to ship; PUBLISHED is
        a no-op (idempotent).
      operationId: publish_tree_context_documents_tree__tree_id__publish_post
      parameters:
        - name: tree_id
          in: path
          required: true
          schema:
            type: string
            title: Tree Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TreeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKey: []
        - AsUser: []
components:
  schemas:
    TreeResponse:
      properties:
        tree_id:
          type: string
          title: Tree Id
        status:
          type: string
          title: Status
        version:
          type: integer
          title: Version
        files:
          anyOf:
            - items:
                $ref: '#/components/schemas/TreeFile'
              type: array
            - type: 'null'
          title: Files
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        created_at:
          type: string
          format: date-time
          title: Created At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        meta:
          additionalProperties: true
          type: object
          title: Meta
      type: object
      required:
        - tree_id
        - status
        - version
        - files
        - error
        - created_at
        - completed_at
        - meta
      title: TreeResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TreeFile:
      properties:
        path:
          type: string
          title: Path
        content:
          type: string
          title: Content
        tier:
          type: string
          title: Tier
        team:
          anyOf:
            - type: string
            - type: 'null'
          title: Team
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - path
        - content
        - tier
        - team
        - updated_at
      title: TreeFile
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKey:
      type: http
      description: >-
        API Key or JWT User Token. If using an API Key, set the X-As-User header
        to act as a specific user. A JWT User Token is always scoped to a
        specific user.
      scheme: bearer
      bearerFormat: Bearer <token>
    AsUser:
      type: apiKey
      description: >-
        Optionally set this header to act as a specific user when using an API
        Key, equivalent to first exchanging the API Key for a User Token
      in: header
      name: X-As-User

````