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

# Post v1lucillequery



## OpenAPI

````yaml /openapi.json post /v1/lucille/query
openapi: 3.1.0
info:
  title: Lighthouse API
  description: Lighthouse funeral home management API
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.lighthousefh.com
    description: Production
security:
  - bearer_auth: []
tags:
  - name: Health
    description: Health check endpoints
  - name: Cases
    description: Case management
  - name: Calls
    description: Call recordings and transcriptions
  - name: Dorso
    description: Dorso worker protocol
  - name: Clips
    description: Short audio clips and transcripts
  - name: Users
    description: User management
  - name: Organizations
    description: Organization management
  - name: Locations
    description: Location management
  - name: Case Data
    description: Custom case data values
  - name: Case Data Fields
    description: Custom case data field definitions
  - name: Generations
    description: User-sourced generation overrides
  - name: Generation Templates
    description: AI generation templates
  - name: Generation Feedback
    description: End-user feedback on generations
  - name: Generation Labels
    description: Generation quality labels
  - name: Generation Quality Test
    description: Generation quality testing
  - name: Generation Template Dependencies
    description: Template dependency management
  - name: Score Instructions
    description: Score instructions for generation templates
  - name: Tasks
    description: Case tasks
  - name: Insights
    description: Org insights dashboard and agent analysis reads
  - name: Coaching Goals
    description: Manager coaching goals for Insights metrics
  - name: Skills
    description: Practice skills catalog and insight links
  - name: Lucille Query
    description: Lucille JSON query language
  - name: Conversations
    description: Assistant chat conversations
  - name: User Preferences
    description: User preference settings
  - name: User Managers
    description: User-manager relationships
  - name: User Permissions
    description: User permission management
  - name: Roleplay Categories
    description: Roleplay category (skill) catalog
  - name: Roleplay Complications
    description: Roleplay complications catalog
  - name: Roleplay Personas
    description: Roleplay persona catalog
  - name: Roleplay Phases
    description: Roleplay phase catalog
  - name: Roleplay Runs
    description: Completed roleplay runs
  - name: Roleplay Scenarios
    description: Roleplay scenarios
  - name: Roleplay Voices
    description: Roleplay voice catalog
  - name: Scenario Score Templates
    description: Scenario scoring template attachments
  - name: Zoom
    description: Zoom account connection and user mapping
  - name: External Sessions
    description: Inbound sessions originated outside Lighthouse
paths:
  /v1/lucille/query:
    post:
      tags:
        - Lucille Query
      operationId: lucille_query_handler
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LucilleQueryRequest'
        required: true
      responses:
        '200':
          description: Query result envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_LucilleQueryResponse'
        '400':
          description: Invalid query
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorWithDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Forbidden — agent authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - bearer_auth: []
components:
  schemas:
    LucilleQueryRequest:
      type: object
      required:
        - query
      properties:
        query:
          $ref: '#/components/schemas/LucilleQuery'
    ApiResponse_LucilleQueryResponse:
      type: object
      required:
        - status
        - timestamp
      properties:
        data:
          type: object
          required:
            - data
            - schema
            - meta
          properties:
            data: {}
            meta:
              $ref: '#/components/schemas/QueryResponseMeta'
            schema:
              $ref: '#/components/schemas/QueryResultSchema'
        message:
          type:
            - string
            - 'null'
        request_id:
          type:
            - string
            - 'null'
        status:
          type: string
        timestamp:
          type: string
          format: date-time
    ApiErrorWithDetails:
      type: object
      required:
        - status
        - error
        - message
        - status_code
        - timestamp
        - errors
      properties:
        error:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiErrorDetail'
        message:
          type: string
        request_id:
          type:
            - string
            - 'null'
        status:
          type: string
        status_code:
          type: integer
          format: int32
          minimum: 0
        timestamp:
          type: string
          format: date-time
    ApiError:
      type: object
      required:
        - status
        - error
        - message
        - status_code
        - timestamp
      properties:
        error:
          type: string
        message:
          type: string
        request_id:
          type:
            - string
            - 'null'
        status:
          type: string
        status_code:
          type: integer
          format: int32
          minimum: 0
        timestamp:
          type: string
          format: date-time
    LucilleQuery:
      oneOf:
        - type: object
          required:
            - from
            - select
            - mode
          properties:
            from:
              $ref: '#/components/schemas/QueryEntity'
            include:
              type:
                - object
                - 'null'
            mode:
              type: string
              enum:
                - rows
            select:
              type: array
              items:
                type: string
            where:
              type:
                - object
                - 'null'
        - type: object
          required:
            - from
            - measures
            - mode
          properties:
            from:
              $ref: '#/components/schemas/QueryEntity'
            group_by:
              type:
                - array
                - 'null'
              items:
                $ref: '#/components/schemas/GroupByExpr'
            measures:
              type: array
              items:
                $ref: '#/components/schemas/AggregateMeasure'
            mode:
              type: string
              enum:
                - aggregate
            where:
              type:
                - object
                - 'null'
    QueryResponseMeta:
      type: object
      required:
        - mode
      properties:
        mode:
          $ref: '#/components/schemas/QueryMode'
        row_count:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
    QueryResultSchema:
      type: object
      required:
        - definition
      properties:
        definition:
          type: object
    ApiErrorDetail:
      type: object
      required:
        - message
      properties:
        code:
          type:
            - string
            - 'null'
        message:
          type: string
        path:
          type:
            - string
            - 'null'
    QueryEntity:
      type: string
      enum:
        - cases
        - generation_templates
        - generations
        - tasks
        - users
        - locations
        - coaching_goals
        - skills
        - skill_assignments
    GroupByExpr:
      type: object
      required:
        - field
      properties:
        bucket:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TimeBucket'
        field:
          type: string
    AggregateMeasure:
      type: object
      required:
        - op
      properties:
        alias:
          type:
            - string
            - 'null'
        field:
          type:
            - string
            - 'null'
        op:
          $ref: '#/components/schemas/AggregateOp'
    QueryMode:
      type: string
      enum:
        - rows
        - aggregate
    TimeBucket:
      type: string
      enum:
        - day
        - week
        - month
        - quarter
        - year
    AggregateOp:
      type: string
      enum:
        - count
        - count_distinct
        - min
        - max
        - sum
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````