Deploy Hooks: Triggering Cloudflare Pages Builds From Anywhere
Cloudflare Pages already makes it easy to ship a Jamstack application: connect a GitHub repository, and every git push results in a fresh deployment. But that workflow assumes a developer is making changes. For sites where content is updated by non-technical editors—typically through a headless CMS—the requirement to commit code just to publish a new blog post becomes a bottleneck.
Deploy Hooks are designed to close that gap. They allow any service that can send an HTTP POST request to trigger a new Pages build, without going through git. This means content updates from a headless CMS, a database change, a scheduled task, or even a manual command-line call can all kick off a deployment.
Understanding Headless CMS Integrations
Headless CMS platforms like Contentful, Ghost, and Sanity.io separate content management from presentation. Editors write content in the CMS interface, and the content is delivered via an API. This decoupled model is well-suited to static sites, but it requires a mechanism to transform new or updated content into a fresh site build.
Without a deploy hook, the only automatic way to do that would be to generate a commit and push it to the repository—an awkward workaround. Deploy Hooks provide a cleaner integration point: the CMS fires a webhook, and Pages starts a build. If an editor updates content three or four times a day, each change can be reflected on the live site in near real-time, with no manual intervention.
How Deploy Hooks Work
When a Deploy Hook is created, Pages returns a unique URL. Sending a POST request to that URL triggers a new deployment for the specified branch, pulling in the latest data from the connected source.

Creating a Deploy Hook
To set one up, go to the Deploy Hooks section in your Pages project's settings. Two parameters are required:
- Deploy Hook Name: A label like "Contentful" or "My Blog" to identify the source. Unique names help you distinguish between multiple hooks on the same project.
- Branch to Build: The branch that will be built and deployed when the hook is requested. This is useful for routing updates to a staging environment first, rather than directly to production.

Wiring Up a Headless CMS or Custom Pipeline
The URL generated in the dashboard can be pasted into just about any service that supports webhooks. In a headless CMS, you create a webhook and, depending on the platform, choose the specific events that should trigger a deployment. Once the URL is configured, all content updates flow straight to Pages.
Deploy Hooks aren't limited to CMS webhooks, though. Pages also provides an HTTP POST request snippet for each hook:
curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/ 66c5dd3a-989f-4ba7-a6e2-6d2695524d7”
Executing that snippet from a terminal forces a deployment at any time. Beyond manual invocation, the snippet fits into more sophisticated CI/CD setups—for example triggering a build only when changes are detected in certain directories and after an extensive test suite passes. The same HTTP call can be scheduled via a CRON trigger to deploy on a fixed cadence. Full setup details are available in the Pages deploy hooks documentation.
To see the integration in practice, the tutorial on building a blog with Nuxt.js and Sanity.io demonstrates the complete workflow.



