Sanity Studio v4 is live! Learn more about the Node.js 20+ requirement, and upgrade today.

Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Content Lake
    • Compute and AI
    • APIs and SDKs
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
Back to Changelog
  1. Changelog
  2. GROQ

Custom GROQ functions

Published: May 23, 2025

v2021-03-25
GROQ

All GROQ APIs above v1 now support custom defined GROQ functions.

// Query
fn ex::info($person) = $person{name, age}; 
*[_type == "person"] { "info": ex::info(@) }

This allows you to create modular, reusable parts of queries.

  • Get started with custom functions.
  • View the reference documentation.
  • See the updated GROQ language spec.

Related documentation

  • GROQ Functions Reference

Sanity logosanity.ioAll Systems Operational© Sanity 2025
Change Site Theme