Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Agent Actions
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • Next.js
    • Astro
    • APIs and SDKs
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
  1. Changelog
  2. Integrations & Libraries
  3. GROQ

Custom GROQ functions

Published: May 23, 2025

v2021-03-25

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

Loading...
Sanity logosanity.io
© Sanity 2026
Change Site Theme
Filter by product

Filter by product

Apps & Platform
  • 1
  • 18
  • 4
  • 15
  • 6
  • 8
  • 6
  • 19
  • 1
  • 5
  • 323
  • 4
Integrations & Libraries
  • 6
  • 2
  • 4
  • 2
  • 2
  • 9
  • 18
  • 1
  • 1
  • 7
  • 10
  • 2
  • 1
  • 2
  • 3
Studio Plugins
  • 7
  • 1
  • 1
Subscribe to the changelog
  • RSS (Latest)
  • RSS (Full)
  • JSON Feed (Latest)
  • JSON Feed (Full)
// Query
fn ex::info($person) = $person{name, age}; 
*[_type == "person"] { "info": ex::info(@) }

Related documentation

  • GROQ Functions Reference

All Systems Operational

Previous Changelog

Change status field name on previews and projections.

May 23, 2025

Sanity React App SDK

Next Changelog

Saved queries for Vision, better warnings for HTTP/1, and other improvements

May 27, 2025

Sanity Studio