SettleMint
Compliance

Rotate a webhook signing secret

Rotate a compliance-provider webhook signing secret through the Platform API without losing inbound provider events, using the staged rotate, promote, and cancel sequence and a configurable grace window.

Rotate a compliance-provider webhook signing secret when the current secret may be exposed, when a scheduled key-rotation policy comes due, or when you move a provider integration to new credentials. The Platform API stages the new secret first, keeps the old one valid for a grace window, and activates the new one only when you promote it. Both secrets verify inbound events during the window, so events the provider already queued under the old secret are not lost.

For the provider record, claim topics, and first webhook, see Onboard a compliance provider. For the full endpoint and field reference, see Compliance provider API reference.

Prerequisites

  • API access for a user with the admin, systemManager, or complianceManager role on the active organisation.
  • An active compliance provider with at least one webhook. New providers and topics are created through provider onboarding.
  • The provider ID from the Console provider detail page or the provider list endpoint.
  • A new signing secret value, and access to the provider dashboard where the inbound webhook secret is configured.

How staged rotation works

Rotation has three operations. Each one acts on the webhook for the provider you name.

OperationEndpointEffect
RotatePOST /api/v2/compliance/providers/{providerId}/rotate-secretStages the new secret as pending and starts the grace window. The active secret keeps verifying events.
PromotePOST /api/v2/compliance/providers/{providerId}/promote-secretActivates the pending secret. The previous secret stops verifying events.
CancelPOST /api/v2/compliance/providers/{providerId}/cancel-secret-rotationDiscards the pending secret. The active secret is unchanged.

During the grace window, DALP verifies an inbound webhook against either the active secret or the pending secret. This overlap is what lets you change the secret in the provider dashboard without dropping events that the provider signed with the old secret moments before the change.

A webhook holds one pending rotation at a time. Promote or cancel the current pending secret before you start another rotation.

This guide rotates the provider's primary webhook secret, which is the secret tied to the provider ID you pass to these endpoints. A provider that serves more than one claim topic keeps a separate webhook secret per topic. Rotate one provider record at a time, and confirm each rotation against the provider record it returns.

Stage the new secret

Call the rotate endpoint with the new secret. Set graceWindowMinutes to the overlap you want both secrets to remain valid. The default is 15 minutes; the maximum is 1440 minutes (24 hours).

curl -X POST "https://your-platform.example.com/api/v2/compliance/providers/44444444-4444-4444-4444-444444444444/rotate-secret" \
  -H "X-Api-Key: sm_dalp_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "webhookSigningSecret": "new-provider-signing-secret",
    "graceWindowMinutes": 30
  }'

The response returns the current provider record. The new secret is now pending, and the grace window is running. The record's pendingSecretExpiresAt field holds the moment the window ends. Promote the new secret before then. Both the active and pending secrets verify inbound events until you promote the new secret or the window expires.

If the webhook already has a pending rotation, DALP rejects this request with error DALP-0501 (COMPLIANCE_INVALID_STATE_TRANSITION, HTTP 409). Promote or cancel the pending secret first, then rotate again.

Update the provider dashboard

In the provider dashboard, change the inbound webhook signing secret to the new value. Do this within the grace window.

The provider signs new deliveries with the new secret as soon as you save the change. DALP verifies those deliveries against the pending secret. Deliveries that the provider already signed with the old secret still verify against the active secret until the window ends.

Confirm the provider is delivering during the window

Before you promote, confirm the provider is still delivering events that DALP accepts. List monitoring alerts with GET /api/v2/compliance/providers/{providerId}/monitoring, or watch recent deliveries in the Console.

The grace window is your safety margin. While it is open, DALP accepts deliveries signed with either secret, so a delivery that arrives before the provider dashboard change still verifies against the active secret, and a delivery that arrives after the change verifies against the pending secret. Promote once you are confident the provider dashboard now signs with the new secret. If you are unsure, cancel the rotation instead of promoting, then start again.

Promote the pending secret

Activate the pending secret. After promotion, the previous secret no longer verifies events.

curl -X POST "https://your-platform.example.com/api/v2/compliance/providers/44444444-4444-4444-4444-444444444444/promote-secret" \
  -H "X-Api-Key: sm_dalp_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json"

The response returns the updated provider record with no pending rotation.

If the grace window has already expired, DALP rejects the promotion with error DALP-0500 (COMPLIANCE_SECRET_ROTATION_GRACE_EXPIRED, HTTP 410). The expired rotation still blocks a new one, so cancel it first. If you already changed the provider dashboard to the expired pending secret, change it back to the active secret before you cancel. After cancellation, start a fresh rotation and update the provider dashboard with the new secret.

Cancel a rotation

Cancel a pending rotation when you started one in error, used the wrong secret value, or no longer want to change the secret. Cancelling discards the pending secret and leaves the active secret in place.

curl -X POST "https://your-platform.example.com/api/v2/compliance/providers/44444444-4444-4444-4444-444444444444/cancel-secret-rotation" \
  -H "X-Api-Key: sm_dalp_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json"

After cancellation, the webhook has no pending rotation, so you can start a fresh one. If you already changed the secret in the provider dashboard, change it back to the active value, because the discarded pending secret no longer verifies events.

Errors

ErrorHTTPWhen it happensWhat to do
DALP-0501 COMPLIANCE_INVALID_STATE_TRANSITION409A rotate request arrives while a pending rotation already exists, or a promote or cancel request loses a race to a concurrent rotation.Promote or cancel the current pending secret, or refresh the provider and retry against its current state.
DALP-0500 COMPLIANCE_SECRET_ROTATION_GRACE_EXPIRED410A promote request arrives after the grace window has expired.Cancel the expired rotation first. If the provider dashboard was already changed to the expired pending secret, restore the active secret before cancelling. Then start a fresh rotation.
DALP-0502 COMPLIANCE_PROVIDER_NOT_FOUND404The provider ID does not belong to the active organisation.Confirm the provider ID was created by your organisation, then retry.

Concurrent rotation is safe by design. If two sessions try to act on the same pending secret, only one succeeds; the other receives DALP-0501 so it can refresh and re-decide rather than reverting the secret to a stale value.

See also

On this page