Skip to main content

Receive DALP webhooks

Register an HTTPS endpoint, verify Standard Webhooks signatures, send test events, rotate signing secrets, and manage endpoint settings.

Overview

This guide covers endpoint setup and lifecycle management through the Platform API: registering an HTTPS receiver, verifying signatures, sending test events, rotating secrets, and updating, disabling, or deleting endpoints. For event schemas, subscription patterns, lifecycle states, retry schedules, and Resend or Replay rules, see the Webhooks reference.

You can manage the same endpoint settings in the Console under Webhooks. Every route on this page requires an active organisation and webhook management permission (held by the Owner role). See Authentication and API keys.

Register an endpoint

POST /api/v2/webhooks creates an endpoint. Target URLs must be public HTTPS addresses unless your deployment operator configured a private-network exception.

curl -X POST "$DALP_API_URL/api/v2/webhooks" \
  -H "X-Api-Key: $DALP_API_KEY" \
  -H "Idempotency-Key: webhook-create-001" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://webhooks.example.com/dalp",
    "displayName": "Settlement notifications"
  }'

DALP returns 200 OK with the endpoint and its one-time signingSecret:

{
  "data": {
    "id": "0199c4e2-5b7a-7d10-9a3e-2f61c8b04d17",
    "tenantId": "org_7Hq2kWm9",
    "systemId": "0x5fbdb2315678afecb367f032d93f642f64180aa3",
    "url": "https://webhooks.example.com/dalp",
    "displayName": "Settlement notifications",
    "subscriptions": ["*.provisional", "*.final", "*.retracted"],
    "defaultPayloadShape": "thin",
    "counterSignedReceipts": false,
    "receiptTimeoutSeconds": 30,
    "breakerState": "closed",
    "disabledAt": null,
    "disabledReason": null,
    "fatEventsAcknowledgment": null,
    "secret": {
      "activeVersion": 1,
      "previousVersion": null,
      "previousRevokesAt": null,
      "lastUsedAt": null
    },
    "createdAt": "2026-11-09T08:14:05.000Z",
    "updatedAt": "2026-11-09T08:14:05.000Z",
    "version": 1,
    "createdByUserId": "usr_4Fp8nQx2",
    "signingSecret": "dalp_whsk_sample_not_a_live_secret"
  },
  "links": {
    "self": "/api/v2/webhooks/0199c4e2-5b7a-7d10-9a3e-2f61c8b04d17"
  }
}

Save data.id (the {webhookId} used below) and signingSecret immediately because later reads never return the secret. Retrying the same body with the same Idempotency-Key returns the existing endpoint with signingSecret: null. A different body returns 409 WEBHOOK_IDEMPOTENCY_KEY_REUSED, and a concurrent retry returns 409 WEBHOOK_CREATE_IN_PROGRESS. If the first response was lost, rotate the secret to obtain a new one.

Organisations require a deployed System (404 WEBHOOK_SYSTEM_SCOPE_REQUIRED otherwise) and can hold up to 1,000 endpoints across all networks (409 WEBHOOK_ENDPOINT_LIMIT_REACHED, counting disabled endpoints but not deleted ones). New endpoints receive only future events from the current chain head onward.

When subscriptions is omitted, DALP applies default subscriptions, which skip families whose event names do not end in .provisional, .final or .retracted, such as transaction.request.*, bank-rail.credit.*, and bank-rail.cash-out.*. New endpoints default to thin payloads (omitting personal data). To enable fat payloads, register first and then update with the required acknowledgement per Consuming webhooks.

The event envelope

Every delivery carries evt_id, type, version, lifecycle_state, related, and payload (plus source_id on all non-test events, supersedes on retractions, is_replay on Replays, is_test on test events, and request.idempotency_key when uniquely attributable). For full payload schemas and domain semantics, see the event catalogue and machine-readable event definitions.

{
  "evt_id": "evt_a4eac9d5432394cd91b380838ddbd4a5",
  "source_id": "chain:537001:0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc:7:0:token.transfer.final@2",
  "type": "token.transfer.final",
  "version": 2,
  "lifecycle_state": "final",
  "payload": {
    "tokenAddress": "0x5555555555555555555555555555555555555555",
    "chainId": 537001,
    "from": "0x6666666666666666666666666666666666666666",
    "to": "0x7777777777777777777777777777777777777777",
    "amount": "250000000000000000000",
    "transactionHash": "0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
    "blockNumber": 18445240,
    "logIndex": 7,
    "occurredAt": "2026-09-28T09:18:00.000Z",
    "venueTrade": {
      "tradeId": "0x2222222222222222222222222222222222222222222222222222222222222222",
      "leg": "base",
      "marketId": "0x1111111111111111111111111111111111111111111111111111111111111111",
      "venueAddress": "0x9999999999999999999999999999999999999999"
    }
  },
  "related": {
    "idxr_token": "0x5555555555555555555555555555555555555555"
  }
}

Verify the signature

DALP signs every delivery with Standard Webhooks headers plus two DALP headers:

Header
Contents
webhook-id
Event ID, equal to evt_id.
webhook-timestamp
Unix seconds when signed.
webhook-signature
Signature over webhook-id, webhook-timestamp, and the raw body.
webhook-delivery-id
Unique ID for this delivery attempt.
webhook-endpoint-id
Target endpoint ID.

Verify the raw body before parsing JSON using verifyWebhook from @settlemint/dalp-sdk/verify-webhook. The verifier strips the dalp_whsk_ prefix automatically and enforces a 5-minute timestamp window (configurable via timestampToleranceSeconds). DALP re-signs queued envelopes once a signature reaches 4 minutes old, so keep your receiver's clock synchronised.

import { verifyWebhook } from "@settlemint/dalp-sdk/verify-webhook";

export async function receive(request: Request, secrets: ReadonlyArray<string>): Promise<Response> {
  const result = await verifyWebhook({
    rawBody: await request.text(),
    headers: request.headers,
    secret: secrets,
  });
  if (!result.ok) {
    return new Response(result.code, { status: 401 });
  }
  await storeEvent(result.event);
  return new Response(null, { status: 204 });
}

On failure, verifyWebhook returns { ok: false, code } (TIMESTAMP_SKEW, SECRET_MISMATCH, BODY_HASH_MISMATCH, or MALFORMED_BODY, plus REPLAYED_EVENT or REPLAY_STORE_FAILURE when using a replay store). Any 4xx response other than 408 or 429 ends automatic delivery of that event, and only a Resend or a Replay sends it again, so keep your clock synced and pass both active and previous secrets during rotation.

Refuse a repeated delivery

Retries and Resends keep the original webhook-id. Pass an optional replayStore to verifyWebhook to accept each webhook-id once after timestamp, signature, and JSON checks pass.

Implement claim(eventId, claimId) as one atomic check-and-set (such as Redis SET ... NX) returning true only when newly recorded, and release(eventId, claimId) as one atomic compare-and-delete (such as a Redis Lua script). Retain claims for at least the 3-day retry window, or 30 days if operator Resends must also be suppressed.

  • On REPLAYED_EVENT, return 2xx (and submit a counter-signed receipt if enabled).
  • On REPLAY_STORE_FAILURE, log webhook-id and return 5xx so DALP retries.
  • If your handler throws, call await result.release() before returning 5xx so the retry can re-verify. Keep the claim on 2xx.
import { verifyWebhook, type WebhookReplayStore } from "@settlemint/dalp-sdk/verify-webhook";

export async function receive(
  request: Request,
  secrets: ReadonlyArray<string>,
  replayStore: WebhookReplayStore
): Promise<Response> {
  const result = await verifyWebhook({
    rawBody: await request.text(),
    headers: request.headers,
    secret: secrets,
    replayStore,
  });
  if (!result.ok) {
    if (result.code === "REPLAYED_EVENT") {
      return new Response(null, { status: 204 });
    }
    return new Response(result.code, { status: result.code === "REPLAY_STORE_FAILURE" ? 503 : 401 });
  }
  try {
    await storeEvent(result.event);
  } catch {
    await result.release();
    return new Response(null, { status: 503 });
  }
  return new Response(null, { status: 204 });
}

Because DALP times out attempts after 20 seconds, a slow handler or crash before release() can leave a claim stuck so later retries return REPLAYED_EVENT. Log webhook-id on store or release() errors, delete the stuck key and Resend (or Replay with a new webhook-id), or record webhook-id inside your database transaction instead of using a separate replay store. For full deduplication semantics including source_id, see Consuming webhooks.

Send a test event

POST /api/v2/webhooks/{webhookId}/test-events queues a test delivery regardless of subscriptions or disabled state, without tripping the 30-failure circuit breaker. eventType defaults to webhook.test.final, and the envelope sets is_test: true with payload { "test": true }.

Each API server enforces a limit of 10 test events per minute per endpoint and 100 per organisation, returning 429 WEBHOOK_REPLAY_RATE_LIMITED when exceeded.

Rotate the signing secret

POST /api/v2/webhooks/{webhookId}/secret-rotations issues a new signingSecret and keeps the previous secret valid for 24 hours, signing deliveries with both keys during overlap. Store the new secret immediately and accept both keys until previousRevokesAt passes.

Rotation does not replay by Idempotency-Key, and calling it again immediately revokes the older previous secret. After an uncertain response, read GET /api/v2/webhooks/{webhookId} (secret.activeVersion, previousVersion, previousRevokesAt) before rotating again.

DELETE /api/v2/webhooks/{webhookId}/secret-rotations/previous ends overlap early once at least one delivery signed with the new secret succeeds (send a test event first).

Update an endpoint

PATCH /api/v2/webhooks/{webhookId} updates url, displayName, subscriptions (replaces the full list), defaultPayloadShape, fatEventsAcknowledgment, counterSignedReceipts, receiptTimeoutSeconds, disabled, and disabledReason. Omitted fields remain unchanged.

Changing url retargets pending deliveries and requires ?acknowledgePending=true if deliveries are queued. On a fat endpoint, the fatEventsAcknowledgment, sent with the update or already stored, must cover every personal data field the resulting subscriptions carry. Otherwise the update is refused.

Send the endpoint's top-level version as expectedVersion for optimistic concurrency (version increments on every field update, independent of secret.activeVersion, secret rotation, or circuit-breaker changes). A mismatch returns 409 WEBHOOK_ENDPOINT_VERSION_CONFLICT (DALP-0542): re-read the endpoint, check breakerState and disabledAt, and resend with the latest version. The Console's Edit endpoint sheet always sends expectedVersion.

Switch off or delete an endpoint

Setting disabled: true cancels queued deliveries and requires ?acknowledgePending=true while deliveries are pending. Events occurring while disabled are never queued and cannot be recovered by Resend or Replay. Setting disabled: false re-enables delivery and resets the circuit breaker. The platform refuses it with WEBHOOK_SYSTEM_SCOPE_REQUIRED unless the endpoint's system is verified as your organisation's own. A system address that was backfilled onto your organisation and is also held by another organisation does not count as verified.

DELETE /api/v2/webhooks/{webhookId} permanently disables the endpoint and cancels queued deliveries and retries. Delivery history remains readable until retention cleanup.

Next steps

  • Webhooks reference for event catalogues, subscriptions, lifecycle states, retries, Resend/Replay, and counter-signed receipts.
  • Errors for webhook management error envelopes.

Was this page helpful?