What are Webhooks?
Webhooks allow you to receive real-time HTTP notifications when trading events occur on your account, eliminating the need to poll the API for order status updates.Webhooks are the recommended way to track order execution and trade activity. They provide real-time updates and reduce API load.
Supported Events
| Event | Description | When Triggered |
|---|---|---|
order.created | Order submitted | New order accepted by the matching engine |
order.filled | Order completely filled | All quantity executed |
order.partially_filled | Order partially filled | Some quantity executed, order still open |
order.cancelled | Order cancelled | User cancelled or system cancelled |
order.rejected | Order rejected | Validation failed or insufficient balance |
trade.executed | Trade executed | A trade matched involving your order |
Webhook Configuration
Configure webhook endpoints in your Daya Pro Dashboard:- Navigate to API Settings > Webhooks
- Add webhook URL (must be HTTPS)
- Generate webhook secret
- Select events to subscribe to
HTTP Headers
All webhook requests include the following headers:| Header | Description | Example |
|---|---|---|
Content-Type | Always application/json | application/json |
X-Webhook-Signature | HMAC-SHA256 signature with sha256= prefix | sha256=a8f5f167f44f... |
X-Webhook-Event | Event type that triggered this webhook | order.filled |
X-Webhook-ID | Unique event identifier (UUID) | 550e8400-e29b-41d4-a716-446655440000 |
X-Webhook-Timestamp | When the event occurred (RFC3339) | 2026-01-14T15:08:15Z |
User-Agent | Identifies Daya as the sender | Daya-Webhook/1.0 |
Webhook Payload
All webhook events follow this structure:Common Fields
Unique identifier for this event (UUID format)Use for: Idempotency (deduplicate multiple deliveries)
Event typeValues:
order.created, order.filled, order.partially_filled, order.cancelled, order.rejected, trade.executedWhen event occurred (RFC3339 timestamp)
Event-specific data (varies by event type)
Event-Specific Payloads
- order.created
- order.filled
- order.partially_filled
- order.cancelled
- order.rejected
- trade.executed
Sent when: New order accepted by matching engineNext steps: Monitor for
order.filled, order.partially_filled, or order.cancelledDelivery Guarantees
At-least-once delivery
At-least-once delivery
Webhooks may be delivered multiple times. Your endpoint must handle duplicate deliveries using
event_id for idempotency.Order not guaranteed
Order not guaranteed
Events may arrive out of order. Use
created_at timestamps to order events client-side.Retry behavior
Retry behavior
If your endpoint returns non-2xx status or times out, Daya retries with exponential backoff:
After 10 failed attempts, delivery is marked as failed and the webhook may be automatically disabled.
| Attempt | Delay After Previous |
|---|---|
| 1 | 10 seconds |
| 2 | 30 seconds |
| 3 | 1 minute |
| 4 | 5 minutes |
| 5 | 15 minutes |
| 6 | 30 minutes |
| 7 | 1 hour |
| 8 | 2 hours |
| 9 | 4 hours |
| 10 | 8 hours |
Timeout
Timeout
Your endpoint must respond within 30 seconds. Longer responses will timeout and trigger retries.
Auto-disable
Auto-disable
Webhooks are automatically disabled after 10 consecutive delivery failures. You can re-enable them via the API or dashboard.
Webhook Verification
All webhooks include an HMAC-SHA256 signature in theX-Webhook-Signature header with a sha256= prefix. Always verify signatures to prevent spoofing.
Implementing a Webhook Endpoint
Required Response
Your endpoint must:- Verify signature (see Verification)
- Return 2xx status to acknowledge receipt
- Process quickly (< 10 seconds) or queue for async processing
Example Implementation
Best Practices
Verify signatures
Always verify
X-Webhook-Signature to prevent spoofing attacks. Remember to strip the sha256= prefix before comparing.Return 200 quickly
Acknowledge receipt immediately (< 1 second). Queue heavy processing asynchronously.
Handle out-of-order delivery
Events may arrive out of order. Use
timestamp field and order status to reconcile.Reconcile with API
Periodically call List Orders to reconcile state in case webhooks are missed.
Testing Webhooks
Local Testing
For local development, use tools like ngrok:Troubleshooting
Webhooks not received
Webhooks not received
Possible causes:
- Firewall blocking Daya’s IPs
- Endpoint returning non-2xx status
- SSL certificate issues
Duplicate deliveries
Duplicate deliveries
Expected behavior: At-least-once delivery means duplicates are possibleFix: Implement idempotency using
event_idTimeouts
Timeouts
Cause: Endpoint taking > 30 seconds to respondFix: Return 200 immediately, queue processing asynchronously
Signature verification fails
Signature verification fails
Cause: Wrong secret, payload manipulation, or not stripping
sha256= prefixFix: Verify you’re using correct webhook secret and stripping the sha256= prefix from the X-Webhook-Signature header before comparingNext Steps
Webhook Events
Detailed event schemas
Signature Verification
Implement HMAC verification