Webhook Subscriptions
How to receive real-time event notifications FROM Lexamica.
Table of Contents
🎯 Overview
📌 TL;DR
Webhook subscriptions push events to your server in real-time. When something happens in Lexamica (case created, invitation accepted, etc.), we POST the data to your URL—already transformed to your field format.
Webhook subscriptions let you receive events FROM Lexamica the moment they happen. Instead of polling for updates, you register a URL and we'll notify you:
When cases are created or updated
When invitations are sent, accepted, or declined
When the Relay Engine matches or rejects cases
When files are uploaded
And 20+ other event types
Each subscription targets a specific event type and includes your mapping, so data arrives in your format.
📖 Key Terms
Webhook Subscription
A configuration that tells Lexamica where to send a specific event type.
Event
Something that happened in Lexamica (e.g., "Case Created", "Invitation Accepted").
Payload
The data sent with each webhook, transformed via your mapping.
Signature
An HMAC-SHA256 hash that verifies the webhook came from Lexamica.
Secret
A key you provide when creating the subscription, used to generate signatures.
⚙️ How It Works
When an event occurs in Lexamica:
Key points:
You create a subscription for the events you care about
When that event happens, we transform the data using your mapping
We sign the payload with your secret and POST it to your URL
If delivery fails, we retry with exponential backoff
🎯 Key Takeaway
Return
200 OKquickly and process the data asynchronously. Slow responses can cause timeouts and unnecessary retries.
💡 Available Events
Case Events
Case Created
A new case is created in the system
Case Received
Your firm receives a case (as handler)
Case Edited
Case details are modified
Case Fields Updated
Specific fields on a case change
Case Stage Changed
Case moves to a new stage
Case Deleted
A case is deleted
Invitation Events
Case Invitation Sent
An invitation is sent to a firm
Case Invitation Accepted
A firm accepts an invitation
Case Invitation Declined
A firm declines an invitation
Case Invitation Cancelled
The originator cancels an invitation
Case Invitation Expired
An invitation passes its expiration date
Case Invitation Evaluated
A firm marks invitation as "evaluating"
Case Invitation Evaluated Contact Attempted
Firm attempted to contact the client
Case Invitation Evaluated Consult Complete
Consultation completed
Case Invitation Closed
An invitation is closed
Update Events
Case Update Made
A status update or note is posted to a case
Relay Events
Case Relay Matched
Relay Engine finds a matching partner
Case Relay Rejected
Relay Engine can't find any matches
Case Relay Missed
Partners were invited but none accepted
Case Relay Stopped
Relay matching process was stopped
Other Events
Case Settlement
Settlement process begins on a case
Case File Uploaded
A file is uploaded to a case
Case Missing Info
A case is flagged as missing required info
📋 Common Use Cases
📗 Use Case: Subscribing to Case Creation Events
Goal
Get notified when new cases are created in Lexamica
How
Create a webhook subscription for the Case Created event
Result
Receive POST requests whenever a case is created
Request:
Response:
📗 Use Case: Verifying Webhook Signatures
Goal
Ensure webhooks actually came from Lexamica
How
Verify the HMAC-SHA256 signature in the request header
Result
Reject any requests that don't match
Sample webhook payload your endpoint receives:
Headers:
Body (in your field format):
Signature verification (Node.js):
Signature verification (Python):
📗 Use Case: Testing Your Webhook Endpoint
Goal
Verify your endpoint receives and processes webhooks correctly
How
Use the test endpoint to send a sample payload
Result
Confirm your endpoint responds properly
Request:
📕 Use Case: Handling Failed Deliveries
Goal
Understand what happens when your endpoint is unavailable
How
Lexamica retries with exponential backoff
Result
You have time to recover; events aren't lost immediately
Retry schedule:
Immediate — First attempt
+30 seconds — Second attempt
+2 minutes — Third attempt
+5 minutes — Fourth attempt
+15 minutes — Fifth attempt
Marked failed — Logged for review
💡 Tip: If you expect extended downtime, consider using Event Storage and Polling as a backup.
❓ FAQ
❓ "How do I test my webhook endpoint?"
🔍 Quick Check:
✅ Use the
/webhook-subscriptions/{subscriptionId}/testendpoint✅ Or use tools like ngrok to expose a local endpoint
📝 Full Answer: The test endpoint lets you trigger your subscription with custom data:
This sends a properly signed webhook to your endpoint with the payload you provide.
❓ "What if my server is down?"
📝 Full Answer: Lexamica retries failed deliveries with exponential backoff (up to 5 attempts over ~22 minutes). If all attempts fail, the delivery is marked as failed and logged.
For critical integrations, consider:
Redundant endpoints — Multiple webhook URLs for the same event
Event storage — Use stored event subscriptions as a backup to poll for missed events
Monitoring — Check your logs regularly for failed deliveries
❓ "Can I receive multiple event types at the same URL?"
📝 Full Answer: Yes. Create multiple subscriptions pointing to the same URL, one per event type. Use the X-Lexamica-Event header to distinguish between events in your handler:
❓ "How do I pause a subscription temporarily?"
📝 Full Answer: Update the subscription and set active to false:
Events that occur while the subscription is inactive won't be delivered. Re-enable it by setting active to true.
❓ "Can I add a delay before webhooks are sent?"
📝 Full Answer: Yes. When creating or updating a subscription, set the delay field (in milliseconds):
This delays delivery by 5 seconds. Useful if you need time for related data to settle before processing.
🔧 Technical Reference
Webhook Request Format
Each webhook POST includes:
Headers:
Content-Type
application/json
X-Lexamica-Signature
HMAC-SHA256 signature: sha256=<hash>
X-Lexamica-Event
The event type (e.g., Case Created)
Body: The event payload, transformed via your mapping to use your field names.
Subscription Fields
event
String
Yes
The event type to subscribe to
url
String
Yes
Your webhook endpoint URL
secret
String
Yes
Key used to sign payloads (HMAC-SHA256)
mapping
String
Yes
Mapping ID for transforming payloads
description
String
No
Human-readable description
active
Boolean
No
Enable/disable the subscription (default: true)
delay
Number
No
Milliseconds to wait before sending
Verify Endpoint
You can verify a webhook signature using the API:
🔧 Technical Deep-Dive: Signature Verification
The signature is computed as:
Prefixed with
sha256=in the header. Always use timing-safe comparison to prevent timing attacks.Important: The signature is computed on the exact JSON string sent. If your framework parses and re-serializes the body, the signature may not match. Use the raw request body for verification.
Event Payload Examples
Case Created:
Case Invitation Accepted:
Case Relay Matched:
Last updated: January 2026
Last updated
