Skip to Content
MetaKit Docs

Webhooks

Register webhook endpoints (Settings → Webhooks, or via the API). MetaKit sends a JSON POST event to every registered URL. See the Webhook Events section for the full catalog of events and example payloads. The same event is sent to each webhook independently.

  • Failed deliveries (non-2xx, connection error, or no answer within 10 seconds) are retried for about 3 days: after 5s, 30s, 2m, 10m, 30m, 1h, 3h, 6h, 12h, 24h and 24h. Events are stored before sending, so retries survive restarts on our side.
  • Every delivery carries X-MetaKit-Delivery, the same on every retry, with a byte-identical body. Delivery is at-least-once: drop ids you have already processed. Each retry is re-signed with a fresh t.
  • A webhook whose deliveries all fail for 7 days is disabled and its owner emailed. Nothing is sent to it until it is enabled again, or its URL is changed.
  • Every delivery from the last 30 days, with its status and the exact payload, is listed in Settings → Webhooks → Deliveries and by the deliveries endpoint below. Failed ones can be resent.

List webhooks

GET/v1/webhooks

All registered webhook endpoints.

Example request
curl https://api.metakit.cloud/v1/webhooks \
  -H "Authorization: Bearer stk_live_..."
Example response
[
  { "id": "6a...", "name": "Trade alerts", "url": "https://example.com/hook",
    "lastDeliveryStatus": "never", "status": "active", "createdAt": "2026-07-10T12:00:00.000Z" }
]

Create webhook

POST/v1/webhooks

Register a webhook endpoint.

Request body
{ "name": "Trade alerts", "url": "https://example.com/hook" }
Example request
curl https://api.metakit.cloud/v1/webhooks \
  -H "Authorization: Bearer stk_live_..." \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{ "name": "Trade alerts", "url": "https://example.com/hook" }'
Example response
{ "id": "6a...", "name": "Trade alerts", "url": "https://example.com/hook",
  "lastDeliveryStatus": "never", "createdAt": "2026-07-10T12:00:00.000Z" }

Update webhook

PATCH/v1/webhooks/{id}

Update a webhook name and/or URL. Changing the URL of a disabled webhook also enables it again.

Request body
{ "name": "Renamed", "url": "https://example.com/new" }
Example request
curl https://api.metakit.cloud/v1/webhooks/123 \
  -H "Authorization: Bearer stk_live_..." \
  -H "Content-Type: application/json" \
  -X PATCH \
  -d '{ "name": "Renamed", "url": "https://example.com/new" }'
Example response
{ "id": "6a...", "name": "Renamed", "url": "https://example.com/new", "...": "..." }

Enable webhook

POST/v1/webhooks/{id}/enable

Turn a disabled webhook back on (status becomes active). New events are sent again; events from while it was disabled are not, but failed deliveries can be resent.

Example request
curl https://api.metakit.cloud/v1/webhooks/123/enable \
  -H "Authorization: Bearer stk_live_..." \
  -X POST
Example response
{ "id": "6a...", "status": "active", "...": "..." }

List deliveries

GET/v1/webhooks/{id}/deliveries

Deliveries to one webhook, newest first, kept 30 days. status is pending (waiting for a retry), delivered or failed. payload is the exact body sent. After an outage on your side, list the failed ones and resend them.

Parameters

NameTypeRequiredDescription
statusstringNopending, delivered or failed.
pageintegerNoPage number (default 1).
limitintegerNoItems per page (default 25, max 100).
Example request
curl https://api.metakit.cloud/v1/webhooks/123/deliveries \
  -H "Authorization: Bearer stk_live_..."
Example response
{
  "data": [
    {
      "id": "6745c0d2a1b2c3d4e5f60718",
      "event": "trade.position.closed",
      "status": "failed",
      "attempts": 12,
      "last_response_status": 503,
      "last_error": "HTTP 503",
      "last_latency_ms": 212,
      "last_attempt_at": "2026-07-31T09:44:10.000Z",
      "next_attempt_at": null,
      "delivered_at": null,
      "created_at": "2026-07-28T09:41:00.000Z",
      "payload": "{"event":"position.closed", ...}"
    }
  ],
  "page": 1, "limit": 25, "total": 1, "total_pages": 1
}

Resend delivery

POST/v1/webhooks/{id}/deliveries/{delivery_id}/resend

Send one delivery again now, with the same body and X-MetaKit-Delivery id. Its retry schedule restarts. Returns 409 webhook_disabled while the webhook is disabled, and 409 delivery_in_progress if an attempt is running right now.

Example request
curl https://api.metakit.cloud/v1/webhooks/123/deliveries/123/resend \
  -H "Authorization: Bearer stk_live_..." \
  -X POST
Example response
{ "id": "6745c0d2a1b2c3d4e5f60718", "status": "delivered", "attempts": 1, "...": "..." }

Delete webhook

DELETE/v1/webhooks/{id}

Remove a webhook. Returns 204.

Example request
curl https://api.metakit.cloud/v1/webhooks/123 \
  -H "Authorization: Bearer stk_live_..." \
  -X DELETE
Example response
204 No Content

On this page