Joint session with Vercel: How to build intelligent storefronts (May 15th)

Sanity API versions not returning key except v1

35 repliesLast updated: Nov 29, 2025

every version other than v1 which doesn’t return the key at all.
AI Update

Based on the context, this statement is part of a discussion about how different Sanity API versions handle empty or unset fields in GROQ queries.

The key difference:

Why this happens:

When you write a GROQ query with a projection like *[]{_id, type->name}, you're explicitly asking for those fields. In API versions after v1, GROQ honors this request by including the key in the response even when the value doesn't exist - but it sets it to null rather than omitting it entirely.

This is particularly relevant when:

Solutions to handle this:

The original discussion thread also mentions an interesting edge case where the Vision plugin showed correct values while production API calls returned null - this was resolved by adding the specific projection to the webhook query, likely due to API version differences between the two contexts.

Show original thread
35 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