Introducing GROQ-powered Webhooks
NEWS · July 15th 2021

Announcing the Sanity Content Lake integration for Vercel

Now available on the Vercel Marketplace

Knut Melvær

Knut runs developer relations at

The Sanity Content Lake can be used as a real-time data backend for any application. Our new integration on the Vercel marketplace easily lets you connect your project to a new dataset to start storing, synchronizing, and querying data over our APIs. Find out later you needed a fully-fledged, yet friendly editing interface with version control and collaboration? Sure, just configure schemas and set up a Sanity Studio for your content team.

Not all projects start by defining an editing environment and elaborate content models. Sometimes you need some “JSON in the cloud”. Since offers a fully decoupled NoSQL document backend, you can use this integration to quickly get up and running and have an endpoint where you can store and retrieve content to your app. No need to set up schemas or anything else, just give your object a _type and add it to your Content Lake with an authenticated POST request to the mutation API, or by using one of Sanity's SDKs.

As your project evolves, and whenever the time is right, you can create a Studio and configure it to display the content types and fields that you want to be editable within it.

If you use Next.js deployed on Vercel, you can use API routes to handle form submissions or the like. This is what a minimal implementation can look like using the environment variables that are set up by the integration:

const sanityClient = require('@sanity/client');

const config = {
  projectId: process.env.SANITY_API_PROJECT_ID,
  dataset: process.env.SANITY_API_DATASET,
  token: process.env.SANITY_API_WRITE_TOKEN,
  useCdn: false,
  apiVersion: '2021-03-25'
 * Shape of body:
 * { 
 *   "_type": "submission", 
 *	 "_id": "form.657cf48a-e824-4c8a-b474-6b63368a330f”, 
 *   "name": "Andy Bernard",
 *   "message": "This musical rocks!"
 *  }
async function handleForm(req, res) {
  const payload = JSON.parse(req.body);
  try {
    const result = await sanityClient(config).create(payload);
    return res.status(200).send('ok');
  } catch (error) {
    return res.status(500)send('error');

export default handleForm;

We hope that our integration can be useful and improve the developer experience for projects that combine Vercel and As always, if you build with this stack, we'd love to learn all about it on and in our community on