🗓️ Everything *[NYC] is back. A free gathering for AI builders. Sept 9 →

Get field title property with GROQ query

24 repliesLast updated: Nov 29, 2025

Hello! I am wondering if it is possible to create a GROQ query that returns the title property of a field?
AI Update

I think there might be some confusion here about what GROQ queries can access. GROQ queries operate on your content (the actual documents in your dataset), not on your schema definitions. This means you can't use GROQ to return schema-level metadata like a field's title property from your schema definition.

Here's what I mean:

What GROQ CAN do:

Query the actual content values in your documents. For example, if you have a document with a title field:

*[_type == "post"] {
  title,
  description
}

This returns the content of those fields (like "My Blog Post"), not the schema metadata (like the field's title property you defined as "Post Title").

What GROQ CANNOT do:

Access schema definitions, field configurations, or metadata like:

Why this limitation exists:

GROQ is designed as a query language for your Content Lake - the actual documents and their values. Your schema exists separately as configuration code that defines the structure of your content, but it's not stored as queryable data in the Content Lake.

Alternative approaches:

If you need to access schema metadata in your application, you could:

The key distinction is: GROQ queries your data (document content), not your schema (field configuration). The schema defines what fields can exist and how they're structured, while GROQ retrieves what values actually exist in your documents.

Show original thread
24 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions