
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes! The most likely reason you're getting different results is due to API versioning and perspective differences between your two query methods.
1. API Version Default
Your curl request is hitting the API directly without specifying an apiVersion, which means it defaults to v1 of the API. However, your @sanity/client code also doesn't specify an apiVersion, which similarly defaults to v1 - but there's a catch with how the client behaves.
2. Perspective Default (Most Likely Culprit)
The bigger issue is likely the perspective. As of API version 2025-02-19, the default perspective changed from raw to published. However, when you use an authenticated token with @sanity/client, the behavior can differ:
published documents by default@sanity/client with token: May return different results depending on token permissions and configurationMake your @sanity/client configuration explicit to ensure consistent behavior:
const sanity = require('@sanity/client')
const sanityClient = sanity({
projectId: 'xuaf19yr',
dataset: 'production',
useCdn: false,
apiVersion: '2025-02-19', // Always specify this!
perspective: 'published', // Explicitly set perspective
})
await sanityClient.fetch(`
*[_type == "articlePage"] {
...
}
`)Without specifying apiVersion and perspective:
raw perspective)The perspective setting controls which document versions you see:
published - Only published documents (recommended for production)previewDrafts - Drafts if they exist, otherwise publishedraw - Everything including both drafts and publishedAlways explicitly set both apiVersion and perspective in your client configuration to avoid surprises!
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