GitHub Actions: Copying Sanity datasets fails, missing "manage datasets" permission
Based on my research, I can see the issue you're running into. The dataset copy feature you're trying to use is actually an Enterprise/Business plan feature, and the "manage datasets" permission isn't something you'll find as a checkbox in the token creation UI.
The Token Permission Issue
When you create a token in the Sanity management console under the "API" tab, you'll only see these standard roles:
- Viewer (read-only access)
- Editor (read and write content)
- Deploy Studio (for deploying Studio)
- Administrator (full project access)
The dataset copy endpoint requires administrative permissions that go beyond standard Editor or Viewer roles. According to the documentation, copying datasets is a feature available to Business and Enterprise customers.
What You Need to Do
1. Use an Administrator token: Create a token with the Administrator role (not Editor or Viewer). This role has the necessary permissions to manage datasets, including copying them. The guide's reference to "manage datasets" permission means you need a token with Administrator-level access—it's not a separate checkbox option.
2. Verify your plan: The dataset copy feature is part of Advanced Dataset Management, which is only available on Business and Enterprise plans. If you're on a Free or Growth plan, this endpoint won't work even with the correct token—it will appear to succeed but won't actually copy the data.
3. Check your workflow: Your GitHub Action code looks correct, but make sure:
- The
SANITY_TOKENsecret contains an Administrator token - Your project is on a Business or Enterprise plan
- The staging dataset either doesn't exist yet, or you're okay with it being overwritten
Alternative Approaches
If you're on a Free or Growth plan or don't have access to the copy endpoint, you could:
Use the CLI: The Sanity CLI's export/import commands work on all plans:
sanity dataset export production backup.tar.gz sanity dataset import backup.tar.gz stagingSanity Functions: Consider using Sanity Functions to automate dataset operations—they're serverless compute within Sanity and can handle content synchronization tasks without needing external hosting.
Upgrade your plan: If dataset copying is critical to your multi-environment workflow, consider upgrading to a Business or Enterprise plan.
The bottom line: The "manage datasets" permission mentioned in the guide refers to Administrator-level access, and the dataset copy API endpoint itself is a paid feature. You need both the right token role AND the right plan tier for this to work.
Show original thread19 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.