Templates / Answer legal questions with Groq using CanLII and CourtListener

Answer legal questions with Groq using CanLII and CourtListener

Ready for 3.0

by Kevin Yu ✓ · 1 views · created 2026-07-03 · Document Extraction, AI RAG

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 15 nodes and runs when someone submits an n8n form (“Legal research assistant”). Along the way it connects Groq Chat Model. It also calls courtlistener.com over HTTP.

How it runs

Trigger: When someone submits an n8n form (“Legal research assistant”).

  1. Set research configuration (Edit Fields (Set)): sets 6 fields: resultCount, canliiLanguage, citatorDirection…
  2. Route by source database (Switch): routes items into 2 branches
  3. Search CourtListener case law (HTTP Request): calls courtlistener.com (GET)
  4. Fetch CanLII case metadata (HTTP Request): calls an HTTP API (GET)
  5. Fetch CourtListener opinion text (HTTP Request): calls an HTTP API (GET)
  6. Build error result (Code): runs custom JavaScript code
  7. Fetch CanLII citator cases (HTTP Request): calls an HTTP API (GET)
  8. Build grounding context (Code): runs custom JavaScript code
  9. Return result (n8n Form): shows the next form page
  10. Answer grounded in retrieved sources (Basic LLM Chain): sends a prompt to an LLM, with model: Groq Chat Model; output parser: Structured citation parser

…plus 1 more step. See the full node list below.

Services it uses

Groq Chat Model

HTTP calls to: courtlistener.com

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (9)

From the author

Quick overview This workflow collects a legal question via an n8n form, retrieves supporting authorities from CourtListener or CanLII, and uses a Groq-hosted Llama model to produce an answer grounded only in the retrieved text with verified, non-hallucinated…

Excerpt from Kevin Yu's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.