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

# Generate structured session knowledge

> Synthesises typed, structured knowledge from a session — decisions,
action items, tensions, and atomic claims — each backed by the message
IDs it was drawn from. When the session has grounding enabled,
pre-extracted verbatim quotes are resolved to their source messages and
woven in as provenance.

The session must already have a summary (call `POST /sessions/{id}/summary`
first). The generated knowledge is persisted on the session and returned.
Requires **editor** access.

Pro feature. This exposes the structured-knowledge **data layer** — there
is no results-page UI for it yet.




## OpenAPI

````yaml /api-reference/openapi.yaml post /sessions/{id}/knowledge
openapi: 3.1.0
info:
  title: Harmonica API
  version: 1.0.0
  description: >
    REST API for the Harmonica structured deliberation platform.

    Provides access to sessions and their data, including creating, updating,
    and querying sessions, plus response submission for active sessions.
  contact:
    name: Harmonica
    url: https://harmonica.chat
servers:
  - url: https://app.harmonica.chat/api/v1
    description: Production
  - url: http://localhost:3000/api/v1
    description: Local development
security:
  - apiKey: []
paths:
  /sessions/{id}/knowledge:
    post:
      tags:
        - Sessions
      summary: Generate structured session knowledge
      description: >
        Synthesises typed, structured knowledge from a session — decisions,

        action items, tensions, and atomic claims — each backed by the message

        IDs it was drawn from. When the session has grounding enabled,

        pre-extracted verbatim quotes are resolved to their source messages and

        woven in as provenance.


        The session must already have a summary (call `POST
        /sessions/{id}/summary`

        first). The generated knowledge is persisted on the session and
        returned.

        Requires **editor** access.


        Pro feature. This exposes the structured-knowledge **data layer** —
        there

        is no results-page UI for it yet.
      operationId: generateSessionKnowledge
      parameters:
        - $ref: '#/components/parameters/sessionId'
      responses:
        '200':
          description: Generated (or skipped) session knowledge
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - generated
                      - skipped
                    description: >-
                      `generated` when knowledge was produced; `skipped` on a
                      no-op.
                  knowledge:
                    description: The generated knowledge, or null when skipped.
                    oneOf:
                      - $ref: '#/components/schemas/SessionKnowledge'
                      - type: 'null'
                  reason:
                    type: string
                    description: Present when `status` is `skipped`.
                required:
                  - status
                  - knowledge
        '400':
          description: Session has no summary yet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: validation_error
                  message: Session has no summary yet — generate summary first
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    sessionId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Session ID
  schemas:
    SessionKnowledge:
      type: object
      description: |
        Structured, typed knowledge synthesised from a session — decisions,
        action items, tensions, and atomic claims — each carrying message-ID
        provenance. Generated after the session summary. Pro feature.
      properties:
        decisions:
          type: array
          items:
            type: object
            properties:
              label:
                type: string
              summary:
                type: string
              evidence:
                type: array
                description: Source message IDs backing this decision.
                items:
                  type: string
              phase:
                type: string
            required:
              - label
              - summary
              - evidence
        actions:
          type: array
          items:
            type: object
            properties:
              description:
                type: string
              owner:
                type: string
              due:
                type: string
              evidence:
                type: array
                items:
                  type: string
            required:
              - description
              - evidence
        tensions:
          type: array
          items:
            type: object
            properties:
              summary:
                type: string
              sides:
                type: array
                minItems: 2
                items:
                  type: string
              evidence:
                type: array
                items:
                  type: string
            required:
              - summary
              - sides
              - evidence
        claims:
          type: array
          items:
            type: object
            properties:
              category:
                type: string
                enum:
                  - decision
                  - tension
                  - action
                  - open-question
                  - observation
                  - quote
                  - minority-view
              text:
                type: string
              evidence:
                type: array
                items:
                  type: string
              phase:
                type: string
              strength:
                type: number
                minimum: 0
                maximum: 1
            required:
              - category
              - text
              - evidence
        gaps:
          type: array
          description: Areas the session left unresolved (optional).
          items:
            type: string
        metadata:
          type: object
          properties:
            generatedAt:
              type: integer
              description: Unix epoch timestamp when the knowledge was generated.
            model:
              type: string
            version:
              type: integer
              enum:
                - 1
          required:
            - generatedAt
            - model
            - version
      required:
        - decisions
        - actions
        - tensions
        - claims
        - metadata
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - unauthorized
                - forbidden
                - not_found
                - validation_error
                - rate_limited
                - internal_error
                - unprocessable
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Invalid or missing API key
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: forbidden
              message: You don't have access to this session
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Session not found
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: |
        API key authentication. Pass your key as a Bearer token.
        Keys use the format `hm_live_<32 hex chars>`.
        Generate keys from your Harmonica dashboard settings.

````