✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

How to find API tokens and create a preview secret in Sanity.io.

3 replies
Last updated: Mar 15, 2024
Hello, i have sanity .env questions. - where can we find below details
Mar 15, 2024, 11:22 AM
On your project dashboard. If you go to sanity.io and log in you'll find your projects there and on the page for that project you'll find those tokens.
Mar 15, 2024, 11:32 AM
Hello
user G
Thanks for your response. It is really helpful
I created API token as "Website preview" from here for SANITY_API_TOKEN - now how can do for the SANITY_PREVIEW_SECRET
Mar 15, 2024, 12:04 PM
The
SANITY_PREVIEW_SECRET
can be anything - it's just there to hash things with (I think). You need to create (ideally) 2 tokens: 1 with read access and 1 with read and write access. You do that in the API panel in the
tokens
section at the bottom.
Mar 15, 2024, 2:49 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?