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

# Regenerate a single document within an existing tree

> Re-run search + synthesis for ONE spec key and upsert the file into the
existing COMPLETED tree (ENG-3219).

Before this, the only recovery for a single failed/bad doc was a full tree
regen (~40 min) or a manual content edit (which pins the file against
future regens). Runs a few minutes; poll GET /tree/{tree_id} for the
updated file. If an active CONTENT tree-edit pins the path, the pinned
content still wins (clear the edit first).



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml post /context-documents/tree/{tree_id}/regenerate-doc
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}/regenerate-doc:
    post:
      tags:
        - Context Documents
      summary: Regenerate a single document within an existing tree
      description: >-
        Re-run search + synthesis for ONE spec key and upsert the file into the

        existing COMPLETED tree (ENG-3219).


        Before this, the only recovery for a single failed/bad doc was a full
        tree

        regen (~40 min) or a manual content edit (which pins the file against

        future regens). Runs a few minutes; poll GET /tree/{tree_id} for the

        updated file. If an active CONTENT tree-edit pins the path, the pinned

        content still wins (clear the edit first).
      operationId: regenerate_tree_doc_context_documents_tree__tree_id__regenerate_doc_post
      parameters:
        - name: tree_id
          in: path
          required: true
          schema:
            type: string
            title: Tree Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegenerateDocRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegenerateDocResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKey: []
        - AsUser: []
components:
  schemas:
    RegenerateDocRequest:
      properties:
        key:
          type: string
          maxLength: 500
          minLength: 1
          title: Key
          description: >-
            Spec key of the document to regenerate, e.g.
            'company/customer-soulcycle' or 'workstreams/<slug>/<doc>'.
      type: object
      required:
        - key
      title: RegenerateDocRequest
      description: Request body for single-document regeneration within a tree.
    RegenerateDocResponse:
      properties:
        tree_id:
          type: string
          title: Tree Id
        key:
          type: string
          title: Key
        workflow_id:
          type: string
          title: Workflow Id
        status:
          type: string
          title: Status
      type: object
      required:
        - tree_id
        - key
        - workflow_id
        - status
      title: RegenerateDocResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````