Receive Cases via Polling

Poll for new cases when you can't receive webhooks.


🎯 Overview

📌 TL;DR

If your system can't receive inbound webhooks (firewall, no public endpoint), poll the API instead. Same data, you just pull it on your schedule.

This guide is for you if:

  • You receive referrals from other firms via Lexamica

  • You can't expose a public HTTPS endpoint (firewall restrictions)

  • You prefer batch processing or scheduled syncs

What you'll build:

  • A Case mapping to receive data in your format

  • A stored event subscription for the Case Received event

  • A polling loop that fetches new cases

What this does NOT cover:

  • Accepting/declining invitations via API

  • Sending status updates via API

  • Real-time notifications

For webhooks instead, see Receive Cases via Webhook


📖 Key Terms

Term
Definition

Stored Event Subscription

Configuration that tells Lexamica to store events for later retrieval

Stored Event

An event record stored in the database, waiting to be polled

Polling

Periodically calling the API to retrieve new events


⚙️ Architecture

🎯 Key Takeaway

Events are stored until you retrieve them. Poll as frequently as your use case requires—every minute for near-real-time, or hourly for batch processing.


📋 Prerequisites

Credentials:

Infrastructure:

Foundational Docs:


💡 Step-by-Step Implementation

Step 1: Create Your Case Mapping

Create a mapping that transforms Lexamica's Case fields to your format.

Request:

Step 2: Create a Stored Event Subscription

Subscribe to the Case Received event for storage.

Request:

Step 3: Poll for Events

Query the stored events endpoint to retrieve new cases.

Request:

Response:


🔧 Complete Code Example

Node.js Polling Service

Python Polling Service


❓ FAQ

❓ "How often should I poll?"

📝 Full Answer:

Use Case
Recommended Interval

Near real-time

Every 1-5 minutes

Standard business ops

Every 15-30 minutes

Daily batch processing

Once per day

Consider API rate limits and your business needs.


❓ "How do I avoid processing the same event twice?"

🔍 Quick Check:

  • Track the _id of each processed event

  • Or track lastPollTime and always query from that point

📝 Full Answer: Use a combination of:

  1. Track your last successful poll timestamp

  2. Store processed event IDs or Lexamica case IDs

  3. Check for duplicates before processing


❓ "How long are events stored?"

📝 Full Answer: Events are retained for a configurable period (typically 30-90 days). Always sync to your own database for long-term storage.


🔧 Troubleshooting

"No events returned"

  • Check your date range (from and to parameters)

  • Verify the subscription is active

  • Ensure events have occurred within the time window

"Authentication failed"

  • Use your Private Key for polling (not Public Key)

  • Check the key is in the Authorization header

"Missing events"

  • Ensure your from time doesn't have gaps from previous polls

  • Consider overlapping your time windows slightly


➡️ Next Steps


Last updated: January 2026

Last updated