Skip to content

Frontend vs Backend Proxying for Sanity API Requests

2repliesLast updated: Nov 13, 2026

Hello, my team is evaluating Sanity as a possible headless CMS API provider. We have a several FE applications (one where an adminstrator would configure content, one where the end user would see the content, and then a backend API service. My question is - is it recommended that FE requests for content be proxied through our backend service to Sanity or just query the Sanity API directly from the FE?
AI Update

For published, public content, query Sanity directly from the frontend through the API CDN. That's the normal pattern and it doesn't need a proxy. Put your backend in front of Sanity only when a request needs a token, meaning private datasets, drafts or writes, or when you need to filter or combine data or cache it yourself.

Reading published content directly

import {createClient} from '@sanity/client'

const client = createClient({
  projectId: 'your-project-id',
  dataset: 'production',
  apiVersion: '2025-01-01', // pin an explicit API version
  useCdn: true,
})

const posts = await client.fetch('*[_type == "post"]{title, slug}')

When to go through your backend

Applied to your three apps

Images and other asset files aren't private, even in a private dataset, so don't rely on dataset visibility to protect them.

Show original thread
2 replies

Was this answer helpful?

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.

Related contributions