Power your site with APIs and Build Hooks
Tags: netlify, webhooks, api
Published: 2021-12-22 19:22:04

---
title: Power your site with APIs and Build Hooks
published: true
description: Combine tools and services with your Netlify site using webhooks
tags: Netlify, Webhooks, APIs
cover_image: https://www.netlify.com/img/blog/og-build-hooks.png
canonical_url: https://www.netlify.com/blog/2021/12/22/power-your-site-with-apis-and-build-hooks/
series: Netlify - a feature a day 2021
---

> Throughout December we'll be [highlighting a different Netlify feature each day](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=devto&utm_medium=blog&utm_content=buildhooks). It might just be the thing you need to unlock those creative juices, and [dust off that domain](https://www.netlify.com/blog/2021/12/01/dusty-domains-your-forgotten-domains-raise-money-for-charity/?utm_campaign=featdaily21&utm_source=devto&utm_medium=blog&utm_content=buildhooks) you registered but never deployed! Keep an eye [on the blog](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=devto&utm_medium=blog&utm_content=buildhooks) and on [Twitter](https://twitter.com/netlify) for each feature!

Webhooks are a wonderful tool. They allow you to communicate between different services using HTTP POST requests. URLs for the win!

Imagine that you have a CMS application where you have your blog content. When you publish a new post in your CMS, you'd like to tell your site on Netlify that you've published a new post so it can rebuild and include the new content.

Build hooks allow us to do just that.

At Netlify, we use build hooks to enable those communications between your site and any other external tools and services.


## Setting up a build hook

You can create as many build hooks as you like, allowing new builds to be triggered by a wide rang of tools and services. And you can give each build hook a meaningful name, so that you can tell be looking at your deploy logs what is triggering your builds.
 
For example, let's tell Netlify to rebuild a site whenever there's a new content from a CMS like [Sanity](https://sanity.io). 

In your Netlify site UI, navigate to *Site settings > Build & deploy > Continuous deployment > Build hooks*.

![https://res.cloudinary.com/netlify/image/upload/v1639933983/blog/add-build-hook.png](https://res.cloudinary.com/netlify/image/upload/v1639933983/blog/add-build-hook.png)

Click on `Add hook` and fill the form to set the hook name and select which Git branch the hook should take effect on:

![https://res.cloudinary.com/netlify/image/upload/v1639933978/blog/build-hook-form.png](https://res.cloudinary.com/netlify/image/upload/v1639933978/blog/build-hook-form.png)

When that is done, you can now copy the provided hook URL and use it in whatever service you'd like to integrate into your Netlify site. For example, you could [add this URL as a webhook](https://www.sanity.io/docs/webhooks_LEGACY#abPj1ygk) requested each time your content changes in Sanity

![https://res.cloudinary.com/netlify/image/upload/v1639933978/blog/build-hook-url.png](https://res.cloudinary.com/netlify/image/upload/v1639933978/blog/build-hook-url.png)

Now, whenever new content is published in your CMS, it will send a POST request to the build hook URL and Netlify will rebuild your site as a result.

You can also test the hook URLs yourself via curl or using tools like Postman. Now if you want to programmatically rebuild your site on Netlify, you know what to do!

## More information

- [Docs: Build hooks](https://docs.netlify.com/configure-builds/build-hooks/?utm_campaign=featdaily21&utm_source=devto&utm_medium=blog&utm_content=buildhooks)
- [Docs: Integrations](https://docs.netlify.com/site-deploys/create-deploys/?utm_campaign=featdaily21&utm_source=devto&utm_medium=blog&utm_content=buildhooks#build-hooks)