Webhooks
Webhooks allow you to receive real-time HTTP notifications when events occur in your Monk account. Instead of polling the API for changes, webhooks push data to your server as events happen.How Webhooks Work
- You configure a webhook endpoint URL in your Settings
- When an event occurs (e.g., an invoice is created), Monk sends an HTTP POST request to your endpoint
- Your server processes the event and returns a
2xxresponse to acknowledge receipt
Webhooks are sent asynchronously and may arrive out of order. Use the
id
field and timestamps to handle deduplication and ordering.Setting Up Webhooks
1. Create an Endpoint
Navigate to Settings → Webhooks in your Monk dashboard and click Add Endpoint. Provide:- URL: Your HTTPS endpoint that will receive webhook events
- Events: Select which events to subscribe to
2. Get Your Signing Secret
After creating the endpoint, copy the signing secret. You’ll use this to verify webhook signatures.3. Handle Incoming Webhooks
Your endpoint should:- Verify the webhook signature
- Process the event
- Return a
2xxstatus code quickly
Webhook Headers
Each webhook request includes these headers:| Header | Description |
|---|---|
Content-Type | Always application/json |
User-Agent | Monk-Webhook/1.0 |
X-Monk-Event | Event type (e.g., invoice.created) |
X-Monk-Delivery-Id | Unique delivery ID for idempotency |
X-Monk-Signature | Signature for verification |
Retry Policy
If your endpoint returns a non-2xx response or times out, Monk will retry delivery:
- Total attempts: 6 (1 initial + 5 retries)
- Backoff: Exponential with jitter (~15s, 30s, 1m, 2m, 5m)
- Timeout: 10 seconds per attempt
Best Practices
Return 2xx quickly
Return 2xx quickly
Webhook requests timeout after 10 seconds. Return a
200 response
immediately, then process the event asynchronously in a background job if
needed.Handle duplicates
Handle duplicates
Use the
X-Monk-Delivery-Id header or the payload id field to detect and
ignore duplicate deliveries.Always verify signatures
Always verify signatures
Never trust webhook payloads without verifying the
signature. This prevents spoofed
requests.
Use HTTPS
Use HTTPS
We enforce HTTPS endpoints to ensure webhook payloads are encrypted in
transit.
Next Steps
Webhook Events
See all available events and their payload structures
Signature Verification
Learn how to verify webhook signatures