POST /btql Endpoint – Request and Response Schema

Last updated: February 11, 2026

Applicable To

Plans: Any

Deployments: Any

Summary

The POST /btql endpoint is referenced in the Braintrust documentation (e.g., for complex queries), but its request payload and response schema are not currently included in the OpenAPI spec.

Required fields:

  • querystring | ParsedQuery - The BTQL query to execute (either as a string or pre-parsed query object)

Optional fields:

  • fmt"json" | "jsonl" | "parquet" (default: "json") - Output format

  • api_versionnumber (default: 1) - API version

  • tz_offsetnumber - Timezone offset (follows Date.prototype.getTimezoneOffset() convention)

  • disable_limitboolean - Disable default limit

  • force_push_limitboolean - Force limit to be pushed down to subquery

  • versionstring - Version to query

  • audit_logboolean - Query audit log data

  • use_match_search_indexboolean - Use match search index

  • expected_costnumber - Rough estimate of query cost (scale 1-10)

  • overflow_resultsboolean - Overflow large results to object storage

  • inference_depthnumber - Schema inference depth for objects

  • relaxed_search_modeboolean - Disable strict liveness/de-duplication guarantees

  • use_brainstoreboolean - Use Brainstore backend

  • brainstore_realtimeboolean - Use real-time data

  • brainstore_skip_backfill_checkboolean - Skip backfill check

  • brainstore_ephemeral_walboolean - Use ephemeral WAL for realtime queries

  • realtime_timeout_msnumber - Timeout for real-time data reads

  • query_timeout_secondsnumber - Query timeout (Brainstore only)

  • include_planboolean - Include query plan in response

  • custom_column_scopeobject - Scope for custom columns

  • query_sourcestring - Query source identifier for debugging

  • client_versionstring - Client commit SHA for debugging

  • scope_to_root_span_idstring - Scope query to specific root_span_id

Response Schema:

{
  rows: Record<string, unknown>[];           // Query result rows
  resultSchema: ResponseSchema;              // Schema describing the result structure
  duckdbSchema?: Record<string, unknown>;    // DuckDB schema (if applicable)
  cursor?: string;                           // Pagination cursor (base64 encoded)
  objectsByType?: Map<string, Record<string, ObjectCacheEntry>>;  // ACL info
  plan?: string;                             // Query plan (if include_plan=true)
  realtime_state?: RealtimeState;            // Realtime data state
  freshness_state?: FreshnessState;          // Data freshness info
  brainstoreDurationMs?: number;             // Brainstore query duration
}

Internal links: