Webhook Integration

Receive real-time notifications when your subscribed API endpoints refresh.

Receive real-time notifications when subscribed API endpoints refresh. Register your HTTPS endpoint through the Universe portal to receive your webhook secret.

Webhook Specification

When an API endpoint refreshes, we send an HTTP POST to your registered URL with the following specification.

Request Format

PropertyValue
MethodPOST
Content-Typeapplication/json
Timeout30 seconds

Headers

Each request includes these headers for authentication and tracking:

HeaderRequiredDescriptionExample
X-SignatureYesHMAC-SHA256 signaturesha256=a1b2c3d4e5...
X-TimestampYesUnix timestamp (seconds)1704067200
X-Delivery-IDYesUnique delivery identifier (UUID)550e8400-e29b-41d4-...
X-Event-TypeYesEvent typeapi.data.refreshed
Content-TypeYesAlways application/jsonapplication/json
AuthorizationConditionalBasic Auth (if configured)Basic dXNlcjpwYXNz
User-AgentYesService identifierMarketCheck

Payload

The request body contains event details in JSON format:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "event_type": "api.data.refreshed",
  "event_data": {
    "endpoint": "/search/car/active",
    "event_timestamp": "2025-01-15T14:30:00.000Z"
  }
}
FieldTypeDescription
idstring (UUID)Unique identifier (matches X-Delivery-ID)
event_typestringCurrently api.data.refreshed
event_data.endpointstringAPI endpoint that was refreshed
event_data.event_timestampstring (ISO 8601)When the refresh occurred

Response Handling

Your endpoint's response determines how we handle the delivery:

ResponseBehavior
2xx (Success)Delivery complete, no retry
408, 429 (Timeout/Rate Limit)Will retry automatically
5xx (Server Error)Will retry automatically
4xx (Other Client Errors)Permanently failed, no retry
No Response (Timeout)Will retry automatically

Recommended success response:

{
  "status": "accepted",
  "message": "Webhook processed successfully",
  "delivery_id": "550e8400-e29b-41d4-a716-446655440000"
}

Retry Schedule

AttemptDelay
1Immediate
21 second
3 (final)2 seconds

After 3 failed attempts, the delivery is marked as permanently failed.


Security

Every webhook request is cryptographically signed. Always verify the signature before processing to ensure the request originated from MarketCheck.

Signature Verification

Follow these steps to verify the X-Signature header:

  1. Remove sha256= prefix from X-Signature header
  2. Normalize JSON: sort_keys=True, separators=(',', ':'), ensure_ascii=False
  3. Create string to sign: {X-Timestamp}.{normalized_json}
  4. Compute HMAC-SHA256 with your webhook secret
  5. Compare using constant-time comparison

Timestamp Validation

Reject requests with timestamps older than 5 minutes to prevent replay attacks.


Implementation

Handle webhooks reliably with these patterns.

Idempotency

Webhooks may be delivered multiple times due to retries or network issues. Each delivery attempt receives a unique X-Delivery-ID, including retries. For event-level deduplication, use event_data.endpoint + event_data.event_timestamp as a composite key.

Code Examples

Troubleshooting

  1. Verify webhook secret matches subscription configuration
  2. Check signature verification with code examples
  3. Ensure endpoint responds within 30 seconds
  4. Review server logs and test with the test script