# Receive events

GlobalyMint tells your server when something changes by sending a signed HTTPS request to an endpoint you register.

## Add an endpoint

Add an endpoint in the dashboard under Developers › Webhooks, or over the API:

```bash title="terminal"
curl -X POST https://globalymint.com/api/v1/webhook-endpoints \
  -H "Authorization: Bearer $MINT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.acme.dev/hooks/mint",
    "events": ["invoice.paid", "subscription.canceled"]
  }'
```

- The URL must be `https` on a public host. `localhost`, private addresses and `.internal` hosts are refused, so use a tunnel during development. The host is checked again each time we connect: a name that resolves to a private address is not sent to.
- `events` lists the types you want, each one from the [event catalogue](/docs/webhooks/events). A type we do not send is refused with `422`. Leave it out, or send an empty list, to receive every event.
- The reply contains the signing secret, which starts with `whsec_`. It is shown once. Store it now.
- An endpoint belongs to the mode of the key or dashboard that created it. A test endpoint receives test events only.

Managing endpoints needs the `webhooks:write` scope, and the owner, admin or developer role in the dashboard.

## What we send

Each event is one `POST` with a JSON body:

```json title="request body"
{
  "id": "6f1d2c3b-4a59-4e68-9f70-8a1b2c3d4e5f",
  "type": "invoice.paid",
  "created": "2026-11-21T03:14:15.926Z",
  "api_version": "2026-07-01",
  "mode": "live",
  "data": {
    "invoice_id": "9f8e7d6c-5b4a-4c3d-a2b1-0c9d8e7f6a5b",
    "customer_id": "0b8f6c1e-3d2a-4a57-9c41-7e5d2f8a1b90",
    "customer_external_id": "ws_123"
  }
}
```

| Header | Value |
| --- | --- |
| `content-type` | `application/json` |
| `x-mint-signature` | `t=<unix seconds>,v1=<hex signature>` |
| `x-mint-timestamp` | The same Unix seconds as `t` |

| Field | Meaning |
| --- | --- |
| `id` | The event's id. The same on every retry and replay. |
| `type` | The event type. |
| `created` | When the event happened (ISO-8601, UTC), not when this try was sent. |
| `api_version` | The API version the body follows, such as `2026-07-01`. |
| `mode` | `test` or `live`. |
| `test` | `true` only on a [test event](/docs/webhooks/retries#send-a-test-event). Absent otherwise. |
| `data` | The event's payload. |

Every event names the customer it is about, as `data.customer_id` (our id) and `data.customer_external_id` (the id you gave us). Either can be null when the event has no customer.

The [event catalogue](/docs/webhooks/events) lists every type with an example body.

## Respond

Answer with any `2xx` status within 10 seconds. Anything else, including a redirect, or no answer in that time, counts as a failure and the event is sent again on the [retry schedule](/docs/webhooks/retries).

Do the slow work after you answer. Verify the signature, store the event, return 200, then process it.

## Handle duplicates and order

Delivery is at least once. The same event can arrive more than once, and events can arrive out of order.

- Store `id` and skip any id you have already processed.
- Do not rely on order. `entitlements.updated` carries a `version` that only increases, so you can ignore an older snapshot.
- An endpoint that receives every event may be sent a type that is not in the catalogue. Answer 200 and ignore types you do not handle.

## See what was sent

The dashboard shows each endpoint's deliveries: the event type, the try number, the status code your server returned, the response time, any error and the next retry. The same list is at `GET /api/v1/webhook-endpoints/{id}/deliveries`, and `?status=delivered`, `failed` or `retrying` filters it.

To send a delivery again, replay it from that list or call `POST /api/v1/webhook-endpoints/deliveries/{id}/replay`. It goes to that endpoint only, with the same event `id`. See [Retries and replay](/docs/webhooks/retries).

## Pause or remove an endpoint

Set an endpoint's `status` to `disabled` to stop deliveries and to `active` to start them again. An endpoint you disable receives nothing while it is off. Removing an endpoint also removes its delivery history.

If an endpoint fails every delivery for 3 days, we disable it ourselves and keep its events for you to replay. See [When an endpoint keeps failing](/docs/webhooks/retries#when-an-endpoint-keeps-failing).
