User alerts
User alerts let people save a search or follow one docket and receive new matching content by email or webhook. The alert system connects web and API settings to search matching, court-specific docket updates, and background delivery. See Search and notifications for the wider search flow, Legal search for search behavior, and RECAP case records for RECAP data.
Alert types
Saved-search alerts
Saved-search alerts turn a search URL into a named rule. They can watch opinions, RECAP content, RECAP dockets, or oral arguments. A RECAP alert can report new cases only or both new cases and new filings. The rule keeps the search filters so each delivery can link the user back to matching results.
Search alerts support these delivery rates:
- Real time
- Daily
- Weekly
- Monthly
- Off
Off pauses delivery without deleting the saved rule. Each alert also has a private key for one-click actions in alert mail.
References: cl/…/models.py• L64-151 cl/…/forms.py• L22-69
Docket alerts
Docket alerts follow one case docket instead of a broad search. A user enables an alert from a docket page or an alert settings page. One record exists for each user and docket, and its state changes between subscribed and unsubscribed.
When a new docket entry arrives, subscribed users can receive an email and an enabled docket-alert webhook. A private key supports subscribe and unsubscribe links from alert mail. The web toggle checks the user's docket-alert quota and can include the RECAP browser extension bonus. The newer HTMX path locks the user's profile while it checks the quota and changes the subscription, so concurrent toggles cannot both consume the same capacity.
References: cl/…/models.py• L154-211 cl/…/views.py• L233-317 cl/…/views.py• L442-460
Alert configuration
Search filters and quotas
The web form and search-alert API store the filters that define an alert. Both reject invalid or match-all queries. The API estimates recent activity and rejects a query that would produce more results per day than delivery can support. When it rejects a broad query, it returns the estimated hit count with the error so a client can help the user narrow the search.
The shared limit rules apply to search alerts from both interfaces. They account for the alert rate, alert type, membership, and commercial API access. Real-time alerts require the required account access. RECAP and case-only search alerts use membership quotas, while other search types do not use those quotas. The quota varies by rate and membership level. Disabling an existing alert does not consume a new quota slot. Commercial users with an alert throttle override bypass these membership limits and use the alert-specific API write control instead.
The API returns the estimated hit count when it evaluates a new or changed query. Clients can use this value to warn about broad alerts before delivery starts.
References: cl/…/forms.py• L22-155 cl/…/constants.py• L1-35 cl/…/api_serializers.py• L29-109 cl/…/api_serializers.py• L168-279 cl/…/utils.py• L945-1071 cl/…/utils.py• L1074-1144
Docket sources
Each docket alert uses a source profile to decide which entries count as new and which email format describes them. RECAP and PACER dockets use the default source. Supreme Court dockets use a separate source with its own entry and document rules.
The docket's court selects the source. This keeps one alert flow while allowing each court system to define its own entry shape and message format. Supreme Court document placeholders are left out of alert messages. Supreme Court email delivery uses this source even while its webhook delivery remains separately gated.
References: cl/…/models.py• L994-1009 cl/…/docket_alert_sources.py• L18-35 cl/…/docket_alert_sources.py• L56-86 cl/…/tasks.py• L397-428 cl/…/tests.py• L1035-1202
User interfaces
Web interface
The search page creates and edits saved-search alerts from the current search. A signed-in user names the alert and selects its rate. RECAP searches also select whether the alert covers new cases or new cases and filings.
The profile area separates saved-search alerts from docket alerts. Docket pages provide a toggle for the current case. The current page uses an HTMX response, while a legacy AJAX path remains available during the page transition. New docket-alert pages can resolve a docket from its internal ID or from PACER case and court IDs, which supports links from the RECAP browser extension.
Email links provide private paths to disable or re-enable alerts. Signed-in users can act directly. Other users must pass the confirmation step for protected actions, and the one-click mail actions use rate limits.
References: cl/…/forms.py• L22-171 cl/…/views.py• L46-230 cl/…/views.py• L232-439 cl/…/views.py• L442-578 cl/…/tests.py• L183-847
API interface
The REST API exposes saved-search alerts at /api/rest/v3/alerts/ and /api/rest/v4/alerts/. It exposes docket alerts at the matching /api/rest/v3/docket-alerts/ and /api/rest/v4/docket-alerts/ paths. Both resources provide authenticated, owner-scoped create, read, update, and delete actions.
List results support filters, pagination, and cursor ordering. Search-alert responses include alert state and read-only delivery fields. When a search query is created or changed, the response can include an estimated hit count. A broad-query error also carries that estimate. Search-alert writes use the normal API throttle unless a commercial user has an alert-specific throttle override. That override governs writes only; reads use the normal API throttle.
The API derives the alert kind from the search query. RECAP queries must also state whether they cover cases only or cases and filings. Updates cannot change an alert kind when that change would break the alert's existing scope.
References: cl/…/urls.py• L172-178 cl/…/urls.py• L200-223 cl/…/api_views.py• L26-94 cl/…/api_serializers.py• L61-109 cl/…/api_serializers.py• L231-303 cl/…/api_serializers.py• L316-329 cl/…/filters.py• L7-29
Delivery system
Search-match signals
When a saved-search alert is created or changed, a save signal queues its rule for the matching index after the database transaction commits. The index matches the rule against new or updated searchable content. A delete signal removes the rule and clears its remembered hit state.
The matching path covers separate content families. Opinions and oral arguments use their own alert indexes. RECAP and Supreme Court content share the RECAP alert index, while each source can be enabled or disabled separately. A match can queue a webhook immediately and can create a stored hit for email delivery. The system remembers accepted document identities per alert so later updates do not create repeat notices.
The following flow shows how a saved rule becomes an email or webhook.
flowchart LR
A[Create or change saved search] --> B[Save signal after commit]
B --> C[Matching index]
D[New or updated content] --> E[Match alert rules]
C --> E
E --> F[Remove repeat hits]
F --> G[Queue webhook]
F --> H[Store email hit]
H --> I[Rate-based email task]
G --> J[Enabled webhook]
References: cl/…/apps.py• L6-14 cl/…/signals.py• L22-101 cl/…/tasks.py• L640-830 cl/…/tasks.py• L852-980 cl/…/utils.py• L174-409 cl/…/utils.py• L524-594
Docket update signals
Docket alerts start from a docket change rather than a search-rule match. A background task finds active subscribers, asks the docket source for entries since the last run, renders one source-specific message per recipient, and sends related webhook events.
The task uses a short-lived docket lock to prevent concurrent workers from sending the same update. RECAP email notifications receive special handling: a new @recap.email user can receive an independent first notice, while existing subscribers do not receive a duplicate for the same filing. Users with auto-subscribe enabled then become docket subscribers.
The normal docket path and its source-specific branch are:
flowchart LR
A[New docket entry] --> B[Queue docket alert]
B --> C[Find active subscribers]
C --> D[Choose docket source]
D --> E[Find new entries]
E --> F[Render source email]
F --> G[Send email]
E --> H[Queue docket webhook]
H --> I[Send enabled webhook]
Supreme Court docket webhooks remain gated until their payload path supports Supreme Court entry identifiers. Email delivery still uses the Supreme Court source when that source is selected.
References: cl/…/tasks.py• L84-200 cl/…/tasks.py• L233-312 cl/…/tasks.py• L316-431 cl/…/tasks.py• L421-428 cl/…/tests.py• L1204-1270
Scheduled delivery
Search matches that are not sent by the RECAP sweep at once are stored as scheduled hits. A delivery task groups them by user and alert, merges related child documents, adds a time filter to the results link, and sends one message that preserves each alert's search context. Sent hits are marked complete. Old sent and stale unsent hits are removed in bounded batches during daily cleanup.
Scheduled hits preserve the matched document snapshot and can point back to its source object. This lets later delivery use the content captured when the match occurred instead of depending only on the current source record.
The RECAP alert sweep rebuilds a time-based view of changed dockets and documents. It sends real-time and daily RECAP alerts, then stores weekly and monthly hits for later delivery. It also queues search-alert webhooks for matches found during the weekly and monthly sweep. The percolator path handles alert-enabled sources outside that sweep and can accumulate hits for any supported email rate while sending eligible search-alert webhooks as soon as a match is found.
Scheduled storage has both a total limit per alert and a child-document limit per parent result. Monthly delivery must run by the 28th so every month has a valid prior-month window.
References: cl/…/models.py• L224-268 cl/…/cl_send_recap_alerts.py• L167-237 cl/…/cl_send_recap_alerts.py• L641-763 cl/…/cl_send_recap_alerts.py• L766-855 cl/…/cl_send_recap_alerts.py• L871-941 cl/…/cl_send_scheduled_alerts.py• L46-94 cl/…/cl_send_scheduled_alerts.py• L124-235 cl/…/cl_send_scheduled_alerts.py• L252-327 cl/…/tasks.py• L640-830 cl/…/utils.py• L453-521
Terminated docket alerts
Terminated dockets have a separate maintenance flow. It warns users when a subscribed alert has been inactive for about 90 days, warns again near 180 days, and disables it after 187 days if the alert remains untouched. The flow sends one user-level email and can send an old-alerts report webhook.
References: cl/…/handle_old_docket_alerts.py• L20-81 cl/…/handle_old_docket_alerts.py• L84-121 cl/…/handle_old_docket_alerts.py• L124-206
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the web form and search-alert API serializer aligned with shared query, frequency, alert-type, and quota rules.
- Keep RECAP and case-only alert types mapped to the same matching index while preserving their different hit behavior.
- Keep membership and rate quota tables aligned with the messages shown by both the web form and the API.
- Keep each docket court source aligned with its entry lookup, email templates, document rules, and webhook payload support.
- Keep source-specific percolation settings aligned with the content ingestion path and the delivery command that handles that source.
- Keep private-key links compatible with mail-client one-click actions and confirmation pages.
- Keep commercial alert-write throttles separate from read throttles when changing API rate controls.
- Keep scheduled-hit grouping, per-parent limits, and cleanup aligned with the limits used during matching.
- Keep the HTMX docket toggle's quota check inside the same profile lock as the subscription change.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A saved query matches all content | The alert can create an unbounded stream of hits | Web and API validation reject match-all queries |
| A query exceeds the supported daily hit rate | Delivery can exceed the system's supported volume | Query estimation rejects broad queries and reports the estimate |
| A saved alert is changed while its source alert index is disabled | New content does not match the alert | Save signals check source and index settings; indexing tasks log invalid rules |
| Two workers process one docket at the same time | Users can receive duplicate docket mail | A short-lived docket lock and remembered hit identities limit repeats |
| Supreme Court content reaches an unsupported webhook payload path | The webhook can contain wrong or unusable entry data | Supreme Court webhook delivery remains gated until its payload path supports the source |
| A real-time alert belongs to a user without real-time email access | The email hit is not scheduled, although an enabled search webhook can still receive the match | Eligibility is checked before real-time email scheduling |
| A scheduled-hit limit is reached | Later matches are not stored for scheduled email | Per-alert and per-parent hit limits stop further scheduling |
| Monthly delivery runs after the 28th | The command cannot build a complete prior-month period | The scheduled-delivery command rejects late monthly runs |
| A docket remains subscribed long after termination | The user can keep an inactive alert indefinitely | The old-docket task warns the user and disables the alert after the grace period |
Key files
| File | Why to read it |
|---|---|
| cl/…/models.py | Defines saved-search alerts, docket subscriptions, and pending search hits. |
| cl/…/forms.py | Shows web rules for alert scope, rate, query width, and account limits. |
| cl/…/constants.py | Defines RECAP alert quotas by delivery rate and membership level. |
| cl/…/utils.py | Holds shared query checks, quota checks, hit identity rules, frequency estimation, and scheduled-hit limits. |
| cl/…/api_views.py | Defines owner-scoped API resources, filtering, pagination, and throttling. |
| cl/…/api_serializers.py | Defines API validation, alert-kind rules, quota errors, and estimated-hit responses. |
| cl/…/docket_alert_sources.py | Defines the default docket source and the Supreme Court source boundary. |
| cl/…/signals.py | Connects alert changes to search indexing and hit cleanup. |
| cl/…/tasks.py | Coordinates percolation, docket messages, email, and webhook work. |
| cl/…/cl_index_search_alerts.py | Rebuilds the matching index for existing saved-search rules. |
| cl/…/cl_send_recap_alerts.py | Rebuilds the RECAP sweep view and sends or schedules its alert rates. |
| cl/…/cl_send_rt_percolator_alerts.py | Groups and sends real-time percolator hits. |
| cl/…/cl_send_scheduled_alerts.py | Groups scheduled hits, sends rate-based email, and cleans old hits. |
| cl/…/handle_old_docket_alerts.py | Manages warnings and disablement for terminated docket alerts. |
| cl/…/views.py | Handles web toggles, private links, confirmations, and unsubscribe actions. |
| cl/…/urls.py | Connects the alert resources to the versioned REST API paths. |
| cl/…/tests.py | Shows the end-to-end guarantees for configuration, source selection, delivery, quotas, and API ownership. |