What You Can Do
Live content access
Read documents, schemas, and assets across your Sanity datasets so Gradial always works with real content rather than static exports.
Content authoring
Create and update documents. Publish and unpublish content. Run bulk update workflows with validation.
Asset management
Upload and manage images and file assets alongside content work.
In-context previews
Preview content before publishing when preview settings are configured under Settings → Integrations.
Prerequisites
Before connecting Sanity to Gradial, make sure you have:- Access to the Sanity management console (sanity.io/manage) with permission to create API tokens
- Your Sanity Project ID (visible in the project overview)
- The dataset name Gradial should use (commonly
production) - A Gradial organization Administrator role to complete setup
How to Connect
1
Create a Project API token in Sanity
- Sign in to sanity.io/manage and open your project.
- Go to Settings → API → Tokens and click Add new token. You need the Developer or Administrator role, or an equivalent custom role, in the project.
- Give the token a descriptive name (e.g.,
Gradial Integration). - Set the Permissions to Editor — this grants read and write access to all datasets, with limited access to project settings. Sanity lists the Editor role for Growth and Enterprise plans. If your plan doesn’t offer it, choose a role that can write to the dataset Gradial uses.
- Optionally set an expiration date. Save, then copy the token immediately — it is only shown once.
2
Locate your Project ID and dataset name
Your Project ID appears on the project overview page in sanity.io/manage. The default dataset is typically named
production — confirm the dataset name under Datasets in the same project.3
Add the integration in Gradial
- In Gradial, go to Settings → Integrations.
- Find Sanity and click + Add.
- Fill in the connection details:
- Click Save. Gradial validates the connection and uses the specified dataset in all downstream workflows.
4
Assign to an Environment
- Go to Settings → Environments and select the Gradial Environment where Sanity should be available.
- Add the Sanity integration to that Environment.
- Repeat for any additional Environments.
Using Sanity with Grady
Documents in the Task
When Grady writes a document, it can appear in the Task’s Artifacts with a badge. A new document shows Created. A replaced, patched, or published document shows Edited. A later read of the same document keeps that badge. A read that names a published or release perspective can appear as its own entry, so the same document can show up more than once. A few writes are not recorded as artifacts: dry runs, deletes, unpublishes, release versions, and asset uploads. A write that returns no document, or whose read-back fails, may not be recorded either.Required fields
Sanity’s write API does not run your Studio validation, so Gradial checks required fields itself. Grady reads your deployed Studio schema and looks at the top-level fields it marks as required.- Drafts: the draft saves, and Grady reports the missing fields as a warning. Studio also lets you save an incomplete draft.
- Published documents: a write that would create or replace a published document, or publish a draft, with a required field missing is refused. Nothing is sent to Sanity. The message names the document type and the missing fields.
Large uploads
Grady can upload a file from the Task’s files by file path, up to 100 MiB. This works for video, PDFs, and large images. Small files can still be sent inline.Studio schema
Grady can read your deployed Studio schema before it drafts content. Grady uses the schema as guidance to ask you for required fields and to stay within character limits. This needs a schema deployed to your dataset. Gradial itself enforces only the required-field check described above.Preview URLs
Previews use the Preview base URL, Page document types and Preview URL patterns you set under Settings → Integrations. A pattern with a fullhttps:// URL works on its own. Without a matching pattern, a page document can fall back to the base URL.
Enter one pattern per line, as documentType = URL. For example:
- List each document type once.
- Use only
{document._id},{document._type}, or{document.<field>}placeholders, such as{document.slug.current}.
/articles/{document.slug.current}, needs a Preview base URL.
Troubleshooting
Token rejected at save Confirm the token was copied in full with no trailing spaces, and that it was created with Editor permissions. Dataset not found Verify the dataset name matches exactly what appears under Datasets in your Sanity project. Dataset names are case-sensitive. Invalid preview URL pattern Check the line the message names. Each line needs a document type, an equals sign, and a URL, and each document type can appear only once. Only{document._id}, {document._type}, and {document.<field>} placeholders are supported.
Preview is blank
A blank preview has several possible causes. If the pattern points at Sanity Studio, the frame may need a Sanity login. Open the preview in Sanity, or set a page pattern on your website for draft previews. Also check that the page can render drafts and that the pattern resolves to the page you expect.
Preview failed to load
The preview did not finish loading within 15 seconds. Check that your preview base URL and patterns point to a site that is reachable and allowed for this integration. Then try again.
A document write was refused for a missing required field
Add the fields the message names, or save the document as a draft.
Integration not available in a Workspace
Assign the integration to the correct Gradial Environment under Settings → Environments.