> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Netlify webhooks

> Netlify incoming webhooks in Corsair: the event paths to subscribe to, the payload each event carries, and the response data.

The Netlify plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](https://docs.corsair.dev/plugins/netlify/overview.md) for setup context and the exact URL shape).

> [!NOTE]
>
> **New to Corsair?** See [webhooks](https://docs.corsair.dev/concepts/webhooks.md) and [hooks](https://docs.corsair.dev/concepts/hooks.md).

## Webhook map

* `deploy` (`deploy`)
* `devServer` (`devServer`)
* `splitTest` (`splitTest`)
* `submission` (`submission`)

## HTTP handler setup

```ts app/api/webhook/route.ts theme={null}
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";

export async function POST(request: Request) {
    const headers = Object.fromEntries(request.headers);
    // With multiTenancy, give each tenant its own URL (/api/webhook?tenantId=acme):
    // the query says whose account, secret and hooks handle the delivery.
    const query = Object.fromEntries(new URL(request.url).searchParams);
    // The raw text, not request.json(): signatures are checked over the exact bytes sent.
    const body = await request.text();
    const result = await processWebhook(corsair, headers, body, query);
    if (!result.plugin) {
        return Response.json({ success: false }, { status: 404 });
    }
    // A refusal (bad signature) carries no status and answers 400; a handler
    // that threw comes back with 500, so the sender retries it.
    const status =
        result.response?.success === false ? (result.response.statusCode ?? 400) : 200;
    return Response.json(result.response ?? { success: true }, {
        status,
        headers: result.responseHeaders,
    });
}
```

## Events

## Deploy

### Deploy

`deploy`

A deploy was created, started building, failed, was locked, unlocked, restored or deleted, failed after succeeding or succeeded after failing, or a deploy request was pending, accepted or rejected (X-Netlify-Event deploy\_created, deploy\_building, deploy\_failed, deploy\_locked, deploy\_unlocked, deploy\_restored, deploy\_deleted, deploy\_failed\_after\_succeeding, deploy\_succeeded\_after\_failing, deploy\_request\_pending, deploy\_request\_accepted, deploy\_request\_rejected)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `site_id` | `string \| null` | No | — |
| `user_id` | `string \| null` | No | — |
| `build_id` | `string \| null` | No | — |
| `state` | `string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `url` | `string \| null` | No | — |
| `ssl_url` | `string \| null` | No | — |
| `admin_url` | `string \| null` | No | — |
| `deploy_url` | `string \| null` | No | — |
| `deploy_ssl_url` | `string \| null` | No | — |
| `screenshot_url` | `string \| null` | No | — |
| `review_id` | `number \| null` | No | — |
| `draft` | `boolean \| null` | No | — |
| `required` | `string[] \| null` | No | — |
| `required_functions` | `string[] \| null` | No | — |
| `required_edge_functions` | `string[] \| null` | No | An array of code\_shas for the edge-function bundles that need to be uploaded to complete the deploy. |
| `required_server` | `string[] \| null` | No | The SHA256 digest of the deploy's Netlify Server bundle, when it still needs to be uploaded to complete the deploy. A deploy has at most one server, so this holds either nothing or a single digest. |
| `error_message` | `string \| null` | No | — |
| `branch` | `string \| null` | No | — |
| `commit_ref` | `string \| null` | No | — |
| `commit_url` | `string \| null` | No | — |
| `skipped` | `boolean \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `published_at` | `string \| null` | No | — |
| `title` | `string \| null` | No | — |
| `context` | `string \| null` | No | — |
| `locked` | `boolean \| null` | No | — |
| `review_url` | `string \| null` | No | — |
| `framework` | `string \| null` | No | — |
| `skew_protection_token` | `string \| null` | No | — |
| `function_schedules` | `object[] \| null` | No | — |
| `functions_region` | `string \| null` | No | The functions region for this deploy as an airport code. |
| `functions_region_overrides` | `object[] \| null` | No | Functions in the deploy that explicitly specify their own region (airport code). |

> [accordion] function\_schedules full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   cron?: string | null
> }[] | null
> ```

> [accordion] functions\_region\_overrides full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   region?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   site_id?: string | null,
>   user_id?: string | null,
>   build_id?: string | null,
>   state?: string | null,
>   name?: string | null,
>   url?: string | null,
>   ssl_url?: string | null,
>   admin_url?: string | null,
>   deploy_url?: string | null,
>   deploy_ssl_url?: string | null,
>   screenshot_url?: string | null,
>   review_id?: number | null,
>   draft?: boolean | null,
>   required?: string[] | null,
>   required_functions?: string[] | null,
>   required_edge_functions?: string[] | null,
>   required_server?: string[] | null,
>   error_message?: string | null,
>   branch?: string | null,
>   commit_ref?: string | null,
>   commit_url?: string | null,
>   skipped?: boolean | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   published_at?: string | null,
>   title?: string | null,
>   context?: string | null,
>   locked?: boolean | null,
>   review_url?: string | null,
>   framework?: string | null,
>   skew_protection_token?: string | null,
>   function_schedules?: {
>     name?: string | null,
>     cron?: string | null
>   }[] | null,
>   functions_region?: string | null,
>   functions_region_overrides?: {
>     name?: string | null,
>     region?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
netlify({
    webhookHooks: {
        deploy: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Dev Server

### Dev Server

`devServer`

A dev server was created, went live, stopped or failed (X-Netlify-Event dev\_server\_created, dev\_server\_live, dev\_server\_stopped, dev\_server\_failed)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `site_id` | `string \| null` | No | — |
| `branch` | `string \| null` | No | — |
| `url` | `string \| null` | No | — |
| `state` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `starting_at` | `string \| null` | No | — |
| `error_at` | `string \| null` | No | — |
| `live_at` | `string \| null` | No | — |
| `done_at` | `string \| null` | No | — |
| `title` | `string \| null` | No | — |

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   site_id?: string | null,
>   branch?: string | null,
>   url?: string | null,
>   state?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   starting_at?: string | null,
>   error_at?: string | null,
>   live_at?: string | null,
>   done_at?: string | null,
>   title?: string | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
netlify({
    webhookHooks: {
        devServer: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Split Test

### Split Test

`splitTest`

A split test was activated, deactivated or changed (X-Netlify-Event split\_test\_activated, split\_test\_deactivated, split\_test\_modified)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `site_id` | `string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `path` | `string \| null` | No | — |
| `branches` | `object[] \| null` | No | — |
| `active` | `boolean \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `unpublished_at` | `string \| null` | No | — |

> [accordion] branches full type
>
> ```ts theme={null}
> {
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   site_id?: string | null,
>   name?: string | null,
>   path?: string | null,
>   branches?: {
>   }[] | null,
>   active?: boolean | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   unpublished_at?: string | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
netlify({
    webhookHooks: {
        splitTest: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Submission

### Submission

`submission`

A form on the site received a submission (X-Netlify-Event submission\_created)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `number` | `number \| null` | No | — |
| `email` | `string \| null` | No | — |
| `name` | `string \| null` | No | — |
| `first_name` | `string \| null` | No | — |
| `last_name` | `string \| null` | No | — |
| `company` | `string \| null` | No | — |
| `summary` | `string \| null` | No | — |
| `body` | `string \| null` | No | — |
| `data` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | — |
| `site_url` | `string \| null` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   number?: number | null,
>   email?: string | null,
>   name?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   company?: string | null,
>   summary?: string | null,
>   body?: string | null,
>   data?: {
>   } | null,
>   created_at?: string | null,
>   site_url?: string | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
netlify({
    webhookHooks: {
        submission: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.