Content Lake (Datastore)

The Vision plugin

Quickly test your GROQ queries using this studio plugin.

Vision is a plugin that lets you quickly test your GROQ queries in Sanity Studio. It appears as a tool in the navigation bar when installed, and the default configuration for new studios includes it.

Use the Vision plugin to test your GROQ queries

Install the plugin

New projects have the plugin installed already. For existing projects, or if it isn't part of your studio configuration, install @sanity/vision as a dependency of your project:

npm install @sanity/vision

Install the same version as your sanity package. If your studio isn't on the latest release, run npm install @sanity/vision@SANITY_VERSION instead, replacing SANITY_VERSION with the sanity version in your package.json.

After you install the plugin, add it to your Sanity configuration (sanity.config.js or sanity.config.ts):

import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {visionTool} from '@sanity/vision'

export default defineConfig({
  // ...
  plugins: [structureTool(), visionTool()],
})

To include the plugin only in development mode, import the isDev boolean and add the plugin conditionally:

import {defineConfig, isDev} from 'sanity'
import {structureTool} from 'sanity/structure'
import {visionTool} from '@sanity/vision'

export default defineConfig({
  // ...
  plugins: isDev
    ? [structureTool(), visionTool()]
    : [structureTool()],
})

Configure the plugin

To configure the plugin, pass it an object of options:

import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {visionTool} from '@sanity/vision'

export default defineConfig({
  // ...
  plugins: [
    structureTool(),
    visionTool({
      defaultApiVersion: 'v2025-02-19',
      defaultDataset: 'development',
    }),
  ],
})

Currently supported properties are:

  • defaultApiVersion: The default API version for queries, unless the user specifically selects a different version. See API versioning for the list of available values. Defaults to the current date.
  • defaultDataset: The default dataset to use unless a specific one has been chosen in the user interface. Defaults to the dataset in your studio configuration.
  • datasets: Limits the datasets shown in Vision's dataset selector. Pass an array of dataset names, or a function that receives the project's datasets and returns the ones to show:
export default defineConfig({
  // ...
  plugins: [
    visionTool({
      datasets: ["production", "development"]
    })
  ]
})

To customize how the tool appears in the navigation bar, use these base properties:

  • name: Name used to identify the tool in URLs. Defaults to vision.
  • title: Title that appears in the navigation bar. Defaults to Vision.
  • icon: React icon that appears in the navigation bar. Defaults to an eye icon (EyeOpenIcon from @sanity/icons).

Use the Vision plugin

Vision interface overview

The Vision plugin lets you quickly test a GROQ query against any of the datasets in your Content Lake. At the top of the tool, you'll find dropdowns to select your dataset, API version, and perspective.

When you run a query, a Query URL field appears at the top of the tool. This URL contains the API call to the Content Lake that's querying for your data.

If your dataset is public, you can open that URL in a browser, cURL, or an app like Postman or Insomnia. The JSON you see in Vision is the result property of the response. Unauthenticated requests never return drafts or release versions, even from a public dataset. If your selected perspective includes them, the response differs from what Vision shows. If your dataset is private, the request must be authenticated to return data. The decision on dataset visibility is up to you, and can be changed if necessary.

Vision has two input panes, Query and Params. Enter any valid GROQ query in the Query pane, then click Fetch or press Control+Enter to run it. To start a listener for the query instead, click Listen.

Query parameters work the same way as with Sanity client libraries. Given an object {minSeats: 2} in the Params field, you may use the keys in the object as parameters in the query: *[_type == "bike" && seats >= $minSeats] {name, seats}. Note that every param key is prefixed with $ in the query, but does not have a prefix in the parameters object.

Gotcha

To learn more about how to write queries, read how GROQ queries work.

Was this page helpful?

Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme