---
title: Webhooks
description: Learn how to configure webhooks on the Headless Platform
url: https://developers.wpengine.com/docs/headless-platform/platform-guides/webhooks/
image: https://developers.wpengine.com/og/docs/headless-platform/platform-guides/webhooks.png
---

# Webhooks

This guide describes how to configure webhooks to trigger actions on the Headless Platform.

## Enable Webhooks Setting

To generate a webhook, first visit your `Environment Details` page & click the left-hand submenu `Settings` item:

![Settings page](https://developers.wpengine.com/_astro/open-settings-from-submenu.BYRxbTtV_24cM4z.webp)

Click the `+ Create a webhook` button:

![Generate webhook](https://developers.wpengine.com/_astro/webhook-button.CeNhRC_3_Z1mYpQY.webp)

## Types of Webhooks

This creates one webhook with 3 options: `Rebuild`, `Clean Rebuild` and `Purge Cache`. The `Clean Rebuild` will clear all assets cached by your framework, but is otherwise identical to `Rebuild`. The `Purge Cache` will clear the CDN cache for your domain. Copy one of the webhook URLs to use in your custom workflows:

![Webhook URL](https://developers.wpengine.com/_astro/webhook.DqdMydms_Z1soDKF.webp)

Once generated, you can use this URL to configure a WordPress plugin that can trigger your webhook based on certain WordPress actions, like adding a new post or page. Examples of such plugins are [JAMstack deployments](https://wordpress.org/plugins/wp-jamstack-deployments/) and [WPGatsby](https://wordpress.org/plugins/wp-gatsby/). Alternatively, you can configure a POST request to be sent from the service you want to integrate with the Headless Platform or trigger such request yourself:

```
curl -X POST 'https://js.wpengineapi.com/wh/v1/accounts/{your-account}/apps/{your-app}/environments/{your-env-id}/webhooks/webhook:{action}?token={your-token}'
```

## Using Cron with Webhooks

Some users prefer time-based rebuild patterns, which can be enabled via a scheduled cron job.

In your PHP application schedule a cron to run at scheduled intervals utilizing the [WP Engine Alternate Cron](https://wpengine.com/support/wp-cron-wordpress-scheduling/) which is currently enabled on your account.

You can add a curl to call a POST request of the Rebuild Webhook outlined above.

Example: `curl -X POST https://js.wpengineapi.com/wh/v1/accounts/{your-account}/apps/{your-app}/environments/{your-env-id}/webhooks/webhook:{action}?token={your-token}`

## Regenerate Webhooks

If for any reason you want to regenerate the webhook URLs so that old URL will no longer trigger rebuilds, click the `Regenerate all` button and confirm your action:

![Regenerate webhook](https://developers.wpengine.com/_astro/regenerate.FPCbt4Nx_ZS623N.webp)

## Delete Webhooks

To delete your webhook, click the `Delete all` button. If you do so, the URLs you previously used will no longer work when attempting to trigger a rebuild.

![Delete webhook](https://developers.wpengine.com/_astro/delete.BPJ_OsKi_Z2sBku.webp)

> **Caution**
>
> Since the authentication token to perform operations on your app is embedded in these webhook URLs, you should treat them like you would any other secure token or secret. We do not recommend exposing these URLs in client-side applications or checking them into source control. If they are exposed, you should regenerate them immediately.

## Was this helpful?

Thanks for the feedback!

```json
{"@context":"https://schema.org","@graph":[{"@type":"WebSite","@id":"https://developers.wpengine.com/#website","name":"WP Engine Product Documentation","url":"https://developers.wpengine.com/","description":"Resources for developing, deploying, and scaling on WP Engine.","inLanguage":"en-US","keywords":["API documentation","product documentation","headless WordPress","managed WordPress hosting"],"publisher":{"@id":"https://wpengine.com/#organization"}}]}
```
