Skip to main content

Webhooks

Webhooks let you receive real-time notifications when events occur in your Crowd.Credit account. Instead of polling the API, webhooks push event data to your server.

Setting Up a Webhook

Create a Subscription

curl -X POST https://api.crowd.credit/api/v1/webhooks \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhooks/crowd-credit",
"events": ["deposit.created", "payment.received", "credit.tier_changed"],
"secret": "your_webhook_secret"
}'

Event Types

EventDescription
deposit.createdNew deposit confirmed on-chain
deposit.withdrawnDeposit withdrawal completed
payment.receivedCredit payment received
payment.duePayment due date approaching
payment.overduePayment is past due
credit.tier_changedGraduation tier changed
credit.line_updatedCredit line amount changed
credit.frozenCredit line frozen
yield.distributedYield distribution credited
score.updatedCrowdProof score updated
account.frozenAccount frozen

Webhook Payload

All webhook deliveries include a JSON payload:

{
"id": "evt_abc123",
"type": "deposit.created",
"timestamp": "2026-03-07T12:00:00Z",
"data": {
"depositId": "dep_xyz789",
"token": "USDC",
"amount": "10000.00",
"transactionHash": "0x..."
}
}

Verifying Signatures

Every webhook delivery includes an HMAC-SHA256 signature in the X-Webhook-Signature header. Always verify this signature to ensure the payload is authentic.

import crypto from 'crypto';

function verifyWebhookSignature(
payload: string,
signature: string,
secret: string
): boolean {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}

Retry Policy

Failed webhook deliveries are retried with exponential backoff:

AttemptDelay
1Immediate
21 minute
35 minutes
430 minutes
52 hours
612 hours

After 6 failed attempts, the webhook subscription is marked as inactive. You can reactivate it from the dashboard.

Next Steps