Howdy @yashu, welcome to the forum!
You can do this using a recently added model setting called public readable
. You can go over to Builder.io: Visual Development Platform and choose your model and hit show more options
under model settings
and then find the public readable
option and turn that off and save your model, e.g. perhaps make a new private-page
model of page
type with this setting switched off
Note that this model option is currently only live on beta.builder.io but will be in the production builder.io settings UI soon.
Then, go over to your organization settings at Builder.io: Visual Development Platform and add create a new private key
.
Then you can use our content API to request private content using your private key, e.g.
let apiUrl = 'https://cdn.builder.io/api/v2/content'
let modelName = 'private-page'
let content = await request(`${apiUrl}/${modelName}?apiKey=${yourPublicKey}&limit=1&userAttributes.urlPath=/some-page`, {
headers: { Authorization: `Bearer ${yourPrivateKey}` },
})
Then you can pass that json to render as needed, e.g. with React
let page = content.results[0];
if (page) {
return <BuilderComponent model="private-page" content={page} />
}
Hope this helps and let me know if I can further explain anything here!