Is the Netlify API endpoint refresh_on_demand_builders available?

Hi there,

I noticed in netlify/next-runtime that there is a Netlify API endpoint refresh_on_demand_builders: https://github.com/netlify/next-runtime/blob/main/packages/runtime/src/templates/server.ts#L105

Is this something that is released and can Netlify users use it?

I tried the following fetch:

fetch(
  `https://api.netlify.com/api/v1/sites/${SITE_ID}/refresh_on_demand_builders`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${TOKEN}`,
    },
    body: JSON.stringify({
      paths: ["/"],
      domain: "...",
    }),
  }
)
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error("Error:", error);
  });

…but I received a Access Denied with my own personal access token.

Thanks

Clearing On Demand Builders on-demand is only possible through Netlify Functions right now. The required token is accessible in: context.clientContext.custom.odb_refresh_hooks.

However, this needs to be manually enabled from our end on every site that wants to use this feature, and the API is not finalized, thus subject to change.

Personally, I won’t recommend using it in its current stage as there would be little to no communication from our end if/when things would change and this would break for you.

Thanks for the clarity.

As this is merged in netlify/next-runtime, does that suggest that on demand ISR is now working in Next? You mentioned that “this needs to be manually enabled from our end on every site that wants to use this feature”, so I assume you’re testing this internally.

There’s your answer: