---
title: "Create a webhook endpoint"
method: POST
path: "/webhooks"
tags: ["Webhooks"]
---

# Create a webhook endpoint

`POST /webhooks`

## Request

- Base URL: `https://api.groundmail.dev`
- URL: `https://api.groundmail.dev/webhooks`
- Auth: HTTP bearer

## Request body

- CreateWebhookRequest
  - `url` string, uri, required
  - `events` WebhookEventType[]: Defaults to all supported events if omitted
  - `tenants` string[], nullable: Only email events of these tenants (`external_id` or `id`). Such an endpoint gets no `email.received`, `contact.*` or `automation.*` events. `[]` or `null` removes the filter (every event).

## Response `200`

Webhook created (signing secret shown once)

- CreateWebhookResponse
  - `webhook` WebhookEndpoint, required
    - `id` string, required
    - `url` string, uri, required
    - `events` WebhookEventType[], required
    - `enabled` boolean, required
    - `tenants` string[]: The tenants (`external_id`) whose email events this endpoint receives. Present only on endpoints with a tenant filter.
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
  - `secret` string, required: Signing secret (`whsec_…`), shown once at creation

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid API key
- `403`: `tenants` set on an account without tenants (`tenants_not_enabled`)
- `404`: A tenant in `tenants` does not exist

---

[API](https://skmtc.dev/groundmail/apis/groundmail-api.md) · [All operations](https://skmtc.dev/groundmail/apis/groundmail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/groundmail/apis/groundmail-api/revisions/479821c9fecf?raw)
