Next.js Conf 2024: Your app should be Live by Default – Watch Keynote

Is there a Way to Limit the Response in the API?

3 replies
Last updated: Sep 14, 2020
Also another question not related with the above one. Is there a way to limit the response in the API? i mean, if i want to hide "unpublished" documents in the API response? (havent tested, is a question my colleagues made me)
Sep 14, 2020, 5:46 PM
The drafts only show up using authenticated requests, but you can filter them with GROQ. See this article https://www.sanity.io/docs/drafts
Sep 14, 2020, 5:57 PM
Thank you
user B
, but if using authenticated requests, all the data of my document Studio will be available, right?
Sep 14, 2020, 5:58 PM
Yes, that's correct. Drafts don't show in the unauthenticated API by default though, only published documents.
Sep 14, 2020, 6:00 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?