
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is actually expected behavior! When you query images in Sanity, they come back as references by default because images in Sanity are stored as separate asset documents in the Content Lake, and your document just holds a reference to that asset.
The structure typically looks like this:
{
"image": {
"asset": {
"_ref": "image-abc123...",
"_type": "reference"
}
}
}To get the actual image data (URL, dimensions, metadata, etc.), you need to dereference the asset in your GROQ query. Here's how:
Basic dereferencing:
*[_type == "yourDocType"] {
image {
asset->
}
}The -> operator follows the reference and returns the full asset document.
Getting specific image fields:
*[_type == "yourDocType"] {
image {
asset->{
url,
metadata {
dimensions
}
}
}
}Including custom fields and metadata: If you've added custom fields to your image type (like alt text), you can include those too:
*[_type == "yourDocType"] {
image {
asset->{
url,
metadata
},
alt,
hotspot,
crop
}
}This architecture of storing images as separate asset documents with references is actually a powerful feature - it allows Sanity to:
You can read more about how the Image Type works in Sanity's documentation, including how to configure metadata, hotspot, and custom fields. The docs also have a great guide on displaying images that covers querying and rendering them on the frontend.
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