Can a deployed Sanity Studio switch between datasets via URL parameter?
Yes! When you have multiple workspaces configured in your Sanity Studio, you can switch between them using the URL basePath parameter. Here's how it works:
Switching Between Workspaces via URL
If you've configured multiple workspaces in your Studio, each workspace must have a unique basePath defined in your sanity.config.ts file. You can then navigate directly to different workspaces by appending the basePath to your Studio URL.
For example, if you have workspaces configured like this:
export default defineConfig([
{
name: 'production-workspace',
basePath: '/production',
dataset: 'production',
// ... other config
},
{
name: 'staging-workspace',
basePath: '/staging',
dataset: 'staging',
// ... other config
}
])You would access them at:
https://the-jump-student-portal.sanity.studio/productionhttps://the-jump-student-portal.sanity.studio/staging
Switching Within the Studio
When you have multiple workspaces configured, Sanity Studio automatically displays a dropdown menu in the top left corner that lets you switch between workspaces without changing the URL manually.
Important Notes
- Each workspace configuration requires its own
name,basePath,projectId, anddatasetproperties - The
basePathacts as a URL parameter that routes to the specific workspace - All workspaces share the same codebase but can have different datasets, schemas, tools, and plugins
- If you only have a single workspace, you don't need to specify
nameorbasePath
This workspace feature is particularly useful for managing multiple environments (development, staging, production) or separating content for different brands, regions, or teams within the same Studio instance.
Show original thread3 replies
Sanity β Build the way you think, not the way your CMS thinks
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.