Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

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.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.