Sanity Pioneers: Get early access to betas, extra AI credits, and a direct line to the engineering team. Apply now

Does anyone know if its possible to have PDFs within an app that be delivered through Sanity that can be secured in this way?

5 repliesLast updated: Nov 29, 2025

Hello all,
I am aiming to use Sanity for some web apps that I am building. Part of the requirements of the apps will be to include PDF files within the apps. However these PDFs will contain confidential content that means that the PDFs cannot be accessible through publicly accessible urls.

Does anyone know if its possible to have PDFs within an app that be delivered through Sanity that can be secured in this way?

Thanks as always!
AI Update

Good news and important information here! By default, assets in Sanity (including PDFs) are publicly accessible via their URLs, even in private datasets. This is true regardless of your dataset's access control settings - while your document data can be secured, the asset files themselves are served through Sanity's CDN with publicly accessible URLs.

However, you have a few options to secure your PDFs:

The most secure approach is to not expose the asset URLs directly to your frontend. Instead:

This way, the actual Sanity asset URLs remain hidden in your backend code, and you control who can access them.

2. Store Files in External Secure Storage

For highly sensitive content, you might want to:

This gives you complete control over access but adds infrastructure complexity.

3. Security Through Obscurity (Limited Protection)

Sanity asset URLs are auto-generated and difficult to guess, providing some "security through obscurity." However, this is not true security - anyone with the URL can access the file, and URLs can be shared or leaked.

Important Considerations

The Sanity documentation explicitly states: "Usually the autogenerated URL of the asset provides enough security through obscurity – but the file itself is publicly accessible, even in private datasets."

For truly confidential content, you'll need to implement additional security layers beyond Sanity's built-in asset storage. The Sanity Functions approach gives you the best balance of convenience and security while keeping your content workflow in Sanity.

Show original thread
5 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