Skip to content
On this page


Returns raw KQL query data. Uses an internal server route to proxy requests.

Query responses are cached by default.


function $kql<T extends KirbyQueryResponse = KirbyQueryResponse>(
  query: KirbyQueryRequest,
  opts: KqlOptions = {},
): Promise<T>

interface KqlOptions {
   * Cache result with same query for hydration
   * @default true
  cache?: boolean
   * Language code to fetch data for in multilang Kirby setups
  language?: string
   * Custom headers to send with the request
  headers?: HeadersInit


<script setup lang="ts">
const data = await $kql({
  query: 'site',
  select: {
    title: true,
    children: true,

    <h1>{{ data?.result?.title }}</h1>

Released under the MIT License.