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

# Get Query Schema

> Introspect the virtual tables and per-collection extracted fields available to SQL queries over the given collections. Use this to discover column names, entity field names, types, and levels, plus each collection's verbatim extract schema and prompt, before writing a query.

Fields with level 'file' appear as rows in the entities table; fields with level 'segment' live inside the segment_entities.entities JSON column.



## OpenAPI

````yaml GET /query/schema
openapi: 3.0.0
info:
  title: Cloudglue API
  description: API for Cloudglue
  license:
    name: Apache License 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.7.15
servers:
  - url: https://api.cloudglue.dev/v1
security:
  - bearerAuth: []
paths:
  /query/schema:
    get:
      tags:
        - Query
      summary: Get the query schema
      description: >-
        Introspect the virtual tables and per-collection extracted fields
        available to SQL queries over the given collections. Use this to
        discover column names, entity field names, types, and levels, plus each
        collection's verbatim extract schema and prompt, before writing a query.


        Fields with level 'file' appear as rows in the entities table; fields
        with level 'segment' live inside the segment_entities.entities JSON
        column.
      operationId: getQuerySchema
      parameters:
        - name: collections
          in: query
          description: Comma-separated list of collection IDs (1-20) to introspect
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The queryable schema for the given collections
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuerySchema'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: One or more collections not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: An unexpected error occurred on the server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    QuerySchema:
      type: object
      properties:
        object:
          type: string
          enum:
            - query_schema
          description: Object type identifier
        tables:
          type: array
          items:
            $ref: '#/components/schemas/QuerySchemaTable'
          description: The virtual tables available to SQL queries
        collections:
          type: array
          items:
            $ref: '#/components/schemas/QuerySchemaCollection'
          description: Per-collection extracted field summaries and extract configs
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    QuerySchemaTable:
      type: object
      properties:
        name:
          type: string
          description: Virtual table name (files, entities, or segment_entities)
        description:
          type: string
          description: What the table contains and how to join it
        columns:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: Column name
              type:
                type: string
                description: SQL column type
              description:
                type: string
                description: What the column contains
          description: Columns of the virtual table
    QuerySchemaCollection:
      type: object
      properties:
        collection_id:
          type: string
          format: uuid
          description: Collection ID
        fields:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: Entity field name from the collection's extract schema
              type:
                type: string
                description: Field value type from the extract schema (e.g. string, list)
              level:
                type: string
                enum:
                  - file
                  - segment
                description: >-
                  Where the field lives: 'file' fields appear as rows in the
                  entities table; 'segment' fields live inside the
                  segment_entities.entities JSON column
          description: Flat summary of the collection's extracted fields
        extract_schema:
          type: object
          nullable: true
          additionalProperties: true
          description: >-
            The collection's extract schema verbatim, showing nested value
            shapes. Null for collections without one (e.g. metadata collections,
            which are queried via the files table's metadata and source_metadata
            JSON columns).
        prompt:
          type: string
          nullable: true
          description: The collection's extraction prompt verbatim, if one was configured
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````