
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! You can absolutely read and write to your Content Lake from your own application without using Sanity Studio. Here's how it works:
For reading data, you'll use the HTTP Query API to execute GROQ queries. Yes, you do need to use GROQ (not "GRAQ") to query your content, but it's actually quite intuitive once you get started.
A basic query looks like:
GET https://<projectId>.api.sanity.io/<apiVersion>/data/query/<dataset>?query=*[_type == "post"]
You can also use parameters in your GROQ queries (prefixed with $) which is safe for user input since they're JSON literals that get substituted into the query.
For writing data, you'll use the Mutation API, and here's the good news: you write simple JSON objects, not GROQ! The Mutation API accepts standard JSON documents.
You have several mutation operations available:
create - Creates a new document (fails if ID exists)createIfNotExists - Only creates if the ID doesn't existcreateOrReplace - Creates or overwrites existing documentpatch - Updates specific fields in existing documentsdelete - Removes documentsExample JSON for creating a document:
{
"mutations": [
{
"create": {
"_type": "post",
"title": "My Post",
"content": "Post content here"
}
}
]
}For drafts, prefix the ID with drafts.:
{
"create": {
"_id": "drafts.post-123",
"_type": "post",
"title": "Draft Post"
}
}You'll need to create an API token in Sanity Manage:
npx sanity@latest manage or access Manage from your StudioImportant security note: Never expose write tokens in frontend code! Use them only in server-side environments, API routes, or serverless functions.
Add the token to your requests via the Authorization header:
Authorization: Bearer <your-token>
The Mutation API supports transactions too, so you can perform multiple operations atomically. One thing to note: when using the HTTP API directly, you're responsible for your own validation - the Studio's schema validation doesn't automatically apply at the API level.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store