POST request to your configured endpoint
when a subscribed event occurs.
Use them for:
- wallet and collateral dashboards;
- payment reconciliation and entitlement updates;
- withdrawal status notifications;
- audit records and operational alerts.
Webhooks are asynchronous
Webhook delivery normally happens soon after an event, but it is not part of the synchronous transaction that produced the event. Delivery can be delayed, retried, duplicated, or arrive after another related event. Do not block a user-facing payment, deposit, or withdrawal flow while waiting for a webhook. Use the response from the original API or protocol operation for the immediate result, then use webhooks to reconcile and update your systems.When to use webhooks
Webhooks work well when your application needs to:- update a database after a collateral or settlement change;
- send a notification after a withdrawal changes state;
- refresh a dashboard without polling continuously;
- reconcile payment and delivery records;
- trigger background accounting, analytics, or entitlement work.
How delivery works
- A subscribed 4Mica lifecycle event occurs.
- 4Mica creates an event with a unique
id. - 4Mica sends the JSON event to your HTTPS endpoint with an HTTP
POST. - Your endpoint verifies the signature against the raw request body.
- Your endpoint durably records or queues the event.
- Your endpoint returns a
2xxresponse. - A worker applies the event to your application state.
2xx response when you cannot durably accept the delivery. The
sender may retry unsuccessful deliveries, so every handler must be idempotent.
Event envelope
Every event uses the same top-level shape:Unique delivery identity used for deduplication.
Event name that determines the
data shape.Event-specific payload.
Example event
Events
Collateral deposited
Refresh collateral after a finalized deposit.
Guarantee settled
Reconcile a guarantee that completed clearing and settlement.
Withdrawal requested
Show pending withdrawal and timing information.
Withdrawal finalized
Mark a withdrawal complete and refresh balances.
Syncing application data
Use webhook data to identify what changed, then fetch authoritative state when your application needs a complete or current record. This prevents a partial, late, or out-of-order event from overwriting newer data. A reliable database synchronization pattern is:- Deduplicate the event by
id. - Find the local record using
guarantee_id,withdrawal_id, or wallet address. - Compare the incoming state with the local state.
- Fetch current API or protocol state if the transition is missing context.
- Apply the update in a database transaction.
- Record the event as processed.
Delivery failures and replay
Expect temporary failures from deployments, network issues, database outages, and handler bugs. Failed deliveries may be retried, but your application should not depend on a particular retry count or schedule. Keep enough information to replay an event safely from your own queue or dead-letter store. Replaying the same event must not apply the business change twice. Run scheduled reconciliation for high-value state such as collateral, guarantees, and finalized withdrawals. Webhooks reduce polling; they should not be the only recovery mechanism for financial records.Next steps
Quick start
Build and test your first handler.
Security
Verify signatures and prevent replay.
Best practices
Handle retries, ordering, and observability.
FAQs
Find answers to common implementation questions.