
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYour query is almost working correctly! The syntax asset->url does work with the latest API versions - that's the standard way to get image URLs in GROQ. Based on your query and the official documentation on presenting images, here's what you need:
*[_type == 'teamMember' && !(_id in path('drafts.**'))] {
'headshot': {
'url': headshot.image.asset->url,
'alt': headshot.alt,
'width': headshot.image.asset->metadata.dimensions.width,
'height': headshot.image.asset->metadata.dimensions.height
}
}The key is accessing the dimensions through asset->metadata.dimensions - this metadata is automatically extracted when images are uploaded and includes width, height, and aspect ratio.
Important notes about your original query:
asset->url syntax does work in current API versions - it's the standard approach shown in Sanity's documentationmetadata.dimensions fields (width, height, aspectRatio) are always included automatically and can't be disabled'format': headshot.image.asset->extensionHere's a complete example with format included:
*[_type == 'teamMember' && !(_id in path('drafts.**'))] {
'headshot': {
'url': headshot.image.asset->url,
'alt': headshot.alt,
'width': headshot.image.asset->metadata.dimensions.width,
'height': headshot.image.asset->metadata.dimensions.height,
'aspectRatio': headshot.image.asset->metadata.dimensions.aspectRatio,
'format': headshot.image.asset->extension
}
}This approach from the community answer I found shows exactly this pattern working. The image asset documents contain all this metadata by default, so you can query it directly without any special configuration.
If your original V1 query stopped working, it might be due to a different issue (like a schema change or dataset configuration), but the asset->url syntax itself is definitely supported in current API versions!
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store