SR
Click to open github profile

Js Craft CMS Query API

The core package for all SDKs. Use this as a foundation to build a query builder for Craft CMS with your preferred JavaScript framework.

Features

  • Support for Main Element Types: Query addresses, assets, entries and users.
  • Helper for Preview Mode: Easily add preview mode to your headless setup.
  • Typesafe: Built with typescript in mind.
  • Easy Adaptable: You can easily build your own custom wrapper with that core logic.

Examples

Want to see how it works?

app.ts
import { buildCraftQueryUrl } from '@query-api/js';

// Build URL for fetching a single address
const url = buildCraftQueryUrl('entries')
  .id(1)
  .status('active')
  .siteId(1)
  .buildBaseUrl('one');
// Result: /v1/api/queryApi/customQuery?elementType=addresses&id=1&status=active&siteId=1&one=1

It is as simple as that. 🚀

Further Resources

  • Craft Query API: A Craft CMS Plugin, that powers this stuff.
  • Vue SDK: A package to use the query builder in Vue.
  • Nuxt SDK: A package to use the query builder in Nuxt.

Copyright © 2025 Samuel Reichör