Sure, there we can contact a webhook for deploy-failed
, per these docs: Deploy notifications | Netlify Docs
While you can certainly trigger a deploy programatically with the cache cleared, I think you’d benefit from debugging why your build hangs with cache instead, since build minutes - even for failed builds - cost you, and in case you had a code problem and you’d implemented automatic retries, you’d just keep building over and over forever, and owe us a lot of money. But that’s up to you.
This is the API call to re-attempt a deploy with cache cleared:
POST to https://api.netlify.com/api/v1/deploys/FAILED-DEPLOY-ID-HERE/retry?clear_cache=true
You can see more details about how to understand what our UI does and reverse engineer our API calls which you can use too: [Support Guide] Understanding and using Netlify's API