API versioning in the JavaScript client

In order to promote incremental changes, the Sanity API is versioned based on ISO dates (YYYY-MM-DD) in the UTC time zone.

Gotcha

Unless you know of a specific API version you want to use, you'll want to set it to today's UTC date. By doing this, you'll get all the latest bug fixes and features, while preventing any timezone confusion and locking the API to prevent breaking changes.

What does the apiVersion date mean?

Note: While it's tempting to use a date that's been set dynamically as an API version, this can be a risky idea. Using a static (that is, hard coded) date, you pin your project to a specific version of the API, which prevents any sudden changes that can break your implementation. If you hard code your API to v2026-07-28, and it works, you can be assured it will continue to work even as new API versions are released.

Protip

Gotcha

Example usage

import {createClient} from '@sanity/client'

const client = createClient({
  projectId: '',
  dataset: 'production',
  apiVersion: '2026-07-28', // use a UTC date string
  token: 'sanity-auth-token', // or leave blank for unauthenticated usage
  useCdn: true, // `false` if you want to ensure fresh data
})

Was this page helpful?

sanity.ioAll Systems Operational© Sanity 2026
Change site theme