Support Forums

Promote Deploy Preview to Production

Hi -

I was wondering if it was possible to promote (Publish?) a deploy preview to production via the api? The use case would be to create a deploy preview, test it, and only promote it when it passes the tests.


Hi @jkool,

The UI makes a POST request to the following URL: https://api.netlify.com/api/v1/deploys/<deploy-id>/restore. It should carry your Personal Access Token as the Authorization header. Since the UI does just that, I’d assume that’s what it takes to make this change.

Would you try that and let us know if it works fine for you?

Is that the same as calling https://open-api.netlify.com/#operation/restoreSiteDeploy?

Yes, it appears so. The only difference is that the Open API call asks for a site ID, while the UI makes one without it. But yes, it’s better to go with the documented one as the UI API calls could change in future without warning.

1 Like

Thanks, will give this a try and report back

Seems to be working, thanks!

1 Like