---
title: "Get the query schema"
method: GET
path: "/query/schema"
tags: ["Query"]
---

# Get the query schema

`GET /query/schema`

## Request

- Base URL: `https://api.cloudglue.dev/v1`
- URL: `https://api.cloudglue.dev/v1/query/schema`
- Auth: HTTP bearer

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.

## Query parameters

- `collections` string, required

## Response `200`

The queryable schema for the given collections

- QuerySchema
  - `object` 'query_schema': Object type identifier
  - `tables` QuerySchemaTable[]: The virtual tables available to SQL queries
    - `name` string: Virtual table name (files, entities, or segment_entities)
    - `description` string: What the table contains and how to join it
    - `columns` object[]: Columns of the virtual table
      - `name` string: Column name
      - `type` string: SQL column type
      - `description` string: What the column contains
  - `collections` QuerySchemaCollection[]: Per-collection extracted field summaries and extract configs
    - `collection_id` string, uuid: Collection ID
    - `fields` object[]: Flat summary of the collection's extracted fields
      - `name` string: Entity field name from the collection's extract schema
      - `type` string: Field value type from the extract schema (e.g. string, list)
      - `level` 'file' | 'segment': Where the field lives: 'file' fields appear as rows in the entities table; 'segment' fields live inside the segment_entities.entities JSON column
    - `extract_schema` object, nullable: 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` string, nullable: The collection's extraction prompt verbatim, if one was configured

## Other responses

- `400`: Invalid request parameters
- `404`: One or more collections not found
- `500`: An unexpected error occurred on the server

## Changes

- **2026-10-30** `23d3f240819f`: 3 info
  - added the optional property `code` to the response with the `400` status
  - added the optional property `code` to the response with the `404` status
  - added the optional property `code` to the response with the `500` status
- **2026-08-02** `a7a390d80571`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/cloudglue/apis/cloudglue-api/changes/query/schema/get.md)

---

[API](https://skmtc.dev/cloudglue/apis/cloudglue-api.md) - [All operations](https://skmtc.dev/cloudglue/apis/cloudglue-api/llms.txt) - [OpenAPI document](https://skmtc.dev/cloudglue/apis/cloudglue-api/revisions/23d3f240819f?raw)
