Sanity integration
In short
Query and edit content, and upload images. Connect it on the Integrations page; your app then calls Sanity through Sapilon without ever holding a Sanity credential.
Lets your app query content in a Sanity project with GROQ, create and update documents, and upload images.
Connecting
On the Integrations page choose Connect on Sanity and fill in:
- Project ID — sanity.io/manage → your project → Project ID.
- API token — sanity.io/manage → your project → API → Tokens → Add API token, Editor (or Viewer for read-only).
Sapilon checks the key with the provider before it saves it, and stores it encrypted; it is never shown again.
What your app can do
Only these requests are available; anything else is refused.
GET /data/query/*GET /data/doc/*/*POST /data/mutate/*POST /assets/images/*
How the agent uses it
Use integrations.request('sanity', …); paths are relative to https://<projectId>.api.sanity.io/v2025-02-19.
GET /data/query/{dataset}— GROQ. Example:{ method: 'GET', path: '/data/query/production', query: { query: '*[_type == "post" && slug.current == $slug][0]{title, body}', '$slug': '"hello"' } }(parameters are JSON, so strings keep their quotes).GET /data/doc/{dataset}/{id}.POST /data/mutate/{dataset}—body: { mutations: [{ createOrReplace: { _id: 'drafts.post-1', _type: 'post', title: 'Hi' } }, { patch: { id: 'post-2', set: { title: 'New' } } }] }. Write todrafts.ids unless the user asked to publish.POST /assets/images/{dataset}— the image bytes as the body,query: { filename }; reference the returneddocument._id.
Never send a delete mutation unless the user asked for that document to go.
More from Sanity: https://www.sanity.io/docs/http-api