How to enable prerendering via api

How does one enable prerendering via the API?

Hi, @phishy.

tl;dr - “copy as cURL” is your best friend for these types of issues.

In almost all cases about how to do something with our API, my advice is this:

  • Make the change in our web UI with the browser developer tools open and examine the API calls there directly.

You can also consult our open API documentation but seeing a real working API call takes all of the guess work out of it (at least for me).

This is what I get with the “copy as cURL” option:

curl '{id}' \
-X PUT -H 'Content-Type: application/json' \
-H 'Authorization: Bearer THIS_IS_NOT_A_REAL_TOKEN' --data-raw '{"prerender":"netlify"}'

Technically this will work without the content-type header but I’ve included it because it isn’t sensitive and it is “more proper”. Obviously, you will need to replace the site id and auth token to use the example above. I hope it clarifies how the API call is made though.

To disable use {"prerender":null} instead.

If there are other questions or concerns, please let us know.