
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can see why you're confused! When you set useCdn: true but still see api.sanity.io in your network requests, there are a few common reasons this happens.
1. Check Your Client Version
The behavior around tokens and CDN usage changed significantly in @sanity/client v3.0.0. If you're on an older version, the client would bypass the CDN when using tokens. However, in v3.0.0 and later, the client properly supports using tokens with the CDN - authenticated requests are cached and segmented by token.
Check your version:
npm list @sanity/clientIf you're below v3.0.0, upgrade to the latest:
npm install @sanity/client@latest2. Real-time Features Bypass CDN
If you're using .listen() or other real-time subscription features, these always use the direct API endpoint (api.sanity.io) because they require live connections. This is expected behavior and not related to your useCdn setting.
3. Write Operations Use Direct API
Any mutations (create, update, delete operations) always go through api.sanity.io, not the CDN. The Live CDN is only for read operations.
Here's how to properly configure your client to use the CDN:
import { createClient } from '@sanity/client'
const client = createClient({
projectId: 'your-project-id',
dataset: 'production',
useCdn: true,
apiVersion: '2024-01-01'
// token is optional - works fine with CDN in v3.0.0+
})Check your browser's Network tab when making query operations. When the CDN is active, you should see requests to:
apicdn.sanity.io (this is the correct CDN URL format)Important note: The CDN URL is apicdn.sanity.io, NOT cdnapi.sanity.io as you mentioned. If you're looking for cdnapi.sanity.io, that's why you're not finding it - the correct URL has "apicdn" not "cdnapi".
If you're still seeing api.sanity.io for read queries after checking these points:
useCdn: true is set in your client configurationThe Live CDN provides automatic cache invalidation with approximately 10-minute cache times using a stale-while-revalidate strategy. This gives you a great balance of performance and freshness - the CDN serves cached content while fetching fresh updates in the background.
If you've verified all of the above and are still experiencing issues, double-check that you're looking at the right URL (apicdn.sanity.io) and share your client configuration code (without tokens!) for further troubleshooting!
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