
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes! You can exclude the query attribute from the HTTP API response by using the returnQuery parameter.
According to the Sanity HTTP Query API documentation, there's a query parameter called returnQuery that defaults to true. You can set it to false to omit the query from the response payload.
For GET requests:
https://{projectId}.api.sanity.io/v{apiVersion}/data/query/{dataset}?query=*[_type == 'movie']&returnQuery=falseFor POST requests:
{
"query": "*[_type == 'movie']",
"returnQuery": false
}Wait, actually looking at the documentation more carefully, I see that returnQuery is listed as a query parameter for the GET endpoint, but for POST requests you'd still pass it as a query parameter in the URL, not in the request body:
POST https://{projectId}.api.sanity.io/v{apiVersion}/data/query/{dataset}?returnQuery=falseWith request body:
{
"query": "*[_type == 'movie']"
}By setting returnQuery=false, your response payload will be smaller and more consistent. The response will only include:
ms (processing time)result (your actual query results)syncTags (for cache invalidation)This makes the response more cacheable because the payload is smaller and doesn't include the potentially large query string that was echoing back to you. This is especially helpful when you're using Next.js's caching mechanisms or the Sanity CDN endpoint (apicdn.sanity.io), as smaller, more predictable responses cache better.
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