By default, @nuxtjs/sanity will look for a sanity.json file in your project root directory, and it will read your projectId and dataset from there.

{  "api": {    "projectId": "sample-project-id",    "dataset": "production"  }}

If you need to provide additional configuration, you can pass in an object in your Nuxt config with key details:

export default defineNuxtConfig({  modules: ['@nuxtjs/sanity'],  sanity: {    projectId: 'myProject',    apiVersion: '2021-10-18'  },})

Runtime configuration

It is also possible to pass options to this module through runtime configuration, via a sanity key. If you do so they will be merged with (and override) any other options passed in.

For example:

export default defineNuxtConfig({  modules: ['@nuxtjs/sanity'],  runtimeConfig: {    sanity: {      token: process.env.NUXT_SANITY_TOKEN,    },  },  sanity: {    projectId: 'myProject',  },})



  • Type: boolean
  • Default: false

Whether to provide a global $sanity helper that you can use throughout your project. (It's recommended not to do this but to use the useSanity and useSanityQuery composables.)


  • Required
  • Type: string

Your Sanity Project ID, which you can find in your Sanity dashboard.

Sanity dashboard


  • Type: string
  • Default: 'production'


  • Type: string
  • Default: '1'

You can specify the Sanity API version to use. More info here.


  • Type: string

You can provide a token or leave blank to be an anonymous user. (You can also set a token programmatically in a Nuxt plugin.)


  • Type: boolean
  • Default: false

Include credentials in requests made to Sanity. Useful if you want to take advantage of an existing authorisation to the Sanity CMS.


  • Type: boolean
  • Default: true in production or false if a token has been passed in


  • Type: boolean
  • Default: false

Use an ultra-minimal Sanity client for making requests (a fork of picosanity with SSR-specific changes). It only supports fetch requests, but will significantly decrease your bundle size.

If you don't have @sanity/client installed, then @nuxtjs/sanity will use the minimal client by default.


  • Type: boolean
  • Default: false

By default, if Preview Mode has been switched on, useCdn will be disabled. If this behaviour isn't desirable, you can disable it by setting { disableSmartCdn: false }.


  • Type: Object
  • Default: {}

You can create additional clients. Each client's name will be the key of the object provided, and the options provided will be merged with the options of the default client.

The options that can be provided are:

  • projectId
  • dataset
  • token
  • withCredentials
  • useCdn

So, for example:

export default defineNuxtConfig({  modules: ['@nuxtjs/sanity'],  sanity: {    additionalClients: {      another: {        projectId: 'anotherproject',      },    },  },})