Skip to main content
Tutorial

Legal Case Law Research Web Scraping Pipeline

Build a legal research pipeline: crawl case law and statutes, extract clean text and citations as structured data, and feed a search-and-read research loop.

fastcrw
By RecepNovember 28, 20269 min read

By the fastCRW team · Benchmark and capability claims verified 2026-05-18 · for current pricing see /pricing · Verify independently before relying on any figure.

Legal case law research web scraping, end to end

Legal case law research web scraping is the practice of turning court opinions, statutes, and regulatory text on the public web into a clean, searchable corpus your tools can read. The hard part is not fetching a page — it is getting faithful text out of dense, deeply-nested legal documents, capturing the citations and metadata that make the corpus navigable, and doing all of it without leaking privileged or client-sensitive material to a third party. This post walks the full pipeline: crawl official sources, convert to clean markdown, extract citations and metadata as structured data, and power a search-and-read research loop you compose yourself.

We will be explicit about what fastCRW does well here and where it stops. Two constraints matter up front for legal teams and we state them plainly: there is no document-upload /parse endpoint — fastCRW scrapes web pages, not uploaded PDFs — and there is no managed /v1/deep-research endpoint, so the research loop is something you assemble from primitives rather than call as a black box.

What legal research scraping collects

Opinions, statutes, and citation metadata

A useful legal corpus is more than raw text. For each document you typically want: the full opinion or statute body, the court or jurisdiction, the docket or citation number, the decision date, the parties, and — critically — the outbound citations to other authorities. Citations are what let a research tool traverse from one case to the cases it relies on, which is most of what legal research actually is. So the extraction target is two-layered: clean prose for reading and embedding, plus a structured metadata record (including a citation list) for navigation.

Clean text for downstream search and RAG

Whatever you build on top — keyword search, vector retrieval, or a retrieval-augmented generation (RAG) loop — inherits the quality of the text underneath it. Legal pages are notorious for footnote markers, line numbers, pagination artifacts, and boilerplate chrome that pollute naive HTML-to-text conversion. fastCRW returns LLM-ready markdown that strips the chrome while preserving structure, which is the right ingestion format for chunking and embedding. For the markdown-extraction mechanics in detail, see LLM-ready markdown extraction.

Crawling official legal sources

Map and crawl court and statute sites

Most official sources — court opinion archives, statute compilations, regulatory libraries — are link-structured: an index or term page links out to individual documents. The pattern is map-then-crawl. Use POST /v1/map to discover the URL set on a site, then POST /v1/crawl to walk it. The crawl is an async BFS job: it returns a job ID, and you poll GET /v1/crawl/:id for status and results. Bound the job with maxDepth (cap 10) and maxPages (cap 1,000) so a sprawling archive does not run away from you; for archives beyond 1,000 documents, segment by year or jurisdiction and run multiple bounded crawls.

Convert dense documents to clean markdown

Each crawled page comes back as markdown by default. For an individual document you want to pull on demand, POST /v1/scrape with a single URL does the same conversion. fastCRW auto-selects a renderer (auto by default, falling back chrome → lightpanda → http), so JavaScript-rendered opinion viewers still resolve to readable text rather than an empty shell. That matters for the older or heavily-scripted government portals that legal content disproportionately lives on.

Extract citations and metadata with a JSON schema

To get the structured metadata record, add formats: ["json"] plus a jsonSchema to the same /v1/scrape call. You define the shape — court, citation, date, parties, an array of cited authorities — and the extraction step fills it from the page. This costs the 1-credit scrape plus the LLM token cost — billed as usage-metered LLM credits, scaling with page size and token usage rather than a fixed multiple — so you typically scrape the body cheaply at crawl time and run the structured pass only where you need the metadata record. The full pattern, including how to design robust schemas for messy documents, is covered in structured extraction with a JSON schema.

Powering a research loop

Search-and-read over the corpus

Once you have a corpus, the research loop is search-then-read: find candidate documents, read them, extract what matters, and follow citations. fastCRW gives you POST /v1/search for live web discovery of fresh sources (a new opinion, a recent amendment) and /v1/scrape to read each hit. You wire these into your own agent or retrieval layer. The search step is fast: in the canonical search benchmark, fastCRW search averaged 880 ms over 100 queries with 73 of 100 latency wins against Firecrawl and Tavily (triple-bench.ts, single point-in-time run) — useful when a research loop fires many discovery queries per question.

Composing deep research without a managed endpoint

Here is the honest gap, stated once and clearly: there is no managed /v1/deep-research and no /v1/agent. fastCRW does not ship a one-call "research this legal question for me" endpoint. What it ships are the retrieval primitives — search, scrape, crawl, structured extract — and you orchestrate the multi-step loop (search, read, decide, follow citations, synthesize) in your own code, against an LLM you control. For teams that want the loop pattern spelled out, the sibling deep research agent walkthrough shows how to compose it. The upside of composing it yourself is total control over what gets sent where — which, for legal work, is frequently a requirement rather than a preference.

Why text fidelity decides answer quality

Recall and clean extraction for legal text

In legal research, a silently dropped document or a mangled passage is worse than a visible error — it produces a confident answer built on a hole. So the metric that matters most is recall: did the extractor actually capture the labeled content? On Firecrawl's public 819-URL labeled dataset, fastCRW posted 63.74% truth-recall — the highest of the three tools tested (diagnose_3way.py, 2026-05-08), ahead of Crawl4AI (59.95%) and Firecrawl (56.04%) on the same set — paired with ~92% scrape-success of reachable URLs and 0 thrown errors across the run. Higher recall means fewer passages quietly missing from the text you feed your model.

On latency: fastCRW's p50 of 1,914 ms beats Firecrawl's 2,305 ms. In fast mode, the p90 is 4,348 ms — the lowest of the three (Crawl4AI 4,754 ms, Firecrawl 6,937 ms). For a research corpus where coverage is the priority, the chrome-stealth fallback that recovers documents the others miss is the right trade. Plan your timeouts around the p90 for your chosen mode, and see the full distribution at /benchmarks.

Managed structured extraction (paid plans)

The structured-extraction step runs on an LLM. LLM-based JSON extraction is a managed feature available on paid plans; the FREE plan has no LLM features. For legal data, the privacy control that matters most is keeping the documents and target URLs on infrastructure you own — covered in the residency section below — rather than which model fills the schema.

Data residency and access rights

Self-host so legal documents stay in-house

For privileged research, the strongest control is keeping the documents and the target URLs on infrastructure you own. fastCRW's engine is a single static Rust binary under AGPL-3.0 (github.com/fastcrw/crw) — one container, no Redis, no Node.js sidecar required — so you can self-host the entire pipeline and never route opinions, statutes, or your research targets through a vendor cloud. The API is Firecrawl-compatible, so if you ever prototyped on a hosted service you can move to self-host with a base-URL swap. For the privacy architecture in depth, see local-first scraping for data privacy.

robots.txt respected by default

fastCRW respects robots.txt by default. It can be overridden only when the caller has the legal right to do so — which, for a profession built on respecting rules of access, is the right default to ship. Confirm each source's terms of access and any applicable court-data licensing before you crawl; "publicly reachable" is not the same as "licensed for bulk extraction."

Honest gaps for legal workloads

No PDF-upload /parse endpoint — web pages, not uploads

A large share of legal source material is distributed as PDFs. fastCRW scrapes web pages; there is no document-upload /parse endpoint where you hand it a PDF file and get text back. If a PDF is reachable at a URL on the public web, the scraper can fetch and convert it like any other resource — but you cannot upload a local file for parsing. If your workflow is upload-driven, that step lives outside fastCRW; for a survey of dedicated tools, see best document parsing APIs.

No managed deep-research, single-URL extraction, and no anti-bot

To restate the constraints together: no managed /v1/deep-research (compose the loop yourself), extraction is single-URL with no multi-URL batch (/v1/extract is a managed-only single-URL wrapper — iterate /v1/scrape concurrently or crawl), the engine is stateless per request (you own the corpus store and any session state), and there is no Fire-engine anti-bot for hardened portals. None of these block a well-designed legal-research pipeline, but you should architect around them rather than discover them mid-build.

Sources

Related: Structured extraction with JSON schema · Best document parsing APIs · Deep research agent · Local-first scraping for data privacy

FAQ

Frequently asked questions

How do I scrape case law and statutes into a searchable corpus?
Use map-then-crawl: POST /v1/map to discover the URL set on a court or statute site, then POST /v1/crawl (async BFS, bounded by maxDepth up to 10 and maxPages up to 1,000) to walk it. Each page returns LLM-ready markdown you store, chunk, and index for search or RAG. For individual documents, POST /v1/scrape on a single URL does the same conversion on demand.
Can fastCRW parse uploaded legal PDFs?
No. fastCRW scrapes web pages, not uploaded files — there is no document-upload /parse endpoint. If a PDF is reachable at a public URL, the scraper can fetch and convert it like any other resource, but you cannot hand it a local PDF file for parsing. Upload-driven document parsing lives outside fastCRW; pair it with a dedicated document-parsing tool.
How do I extract citations and metadata from legal documents?
Add formats: ['json'] plus a jsonSchema to a /v1/scrape call. Define the record shape — court, citation number, decision date, parties, and an array of cited authorities — and the extraction step fills it from the page. This costs the 1-credit scrape plus the LLM token cost, billed as usage-metered LLM credits, so run the structured pass only where you need the metadata record.
Can I keep legal documents on my own infrastructure?
Yes. The fastCRW engine is a single static Rust binary under AGPL-3.0 that you can self-host as one container, with no required external services. Opinions, statutes, and your target URLs never leave your infrastructure. The API is Firecrawl-compatible, so moving from a hosted prototype to self-host is a base-URL swap.
Does fastCRW have a deep research endpoint for legal questions?
No. There is no managed /v1/deep-research and no /v1/agent endpoint. fastCRW ships the retrieval primitives — search, scrape, crawl, and structured extraction — and you compose the multi-step research loop (search, read, follow citations, synthesize) in your own code against an LLM you control, which also keeps sensitive legal material under your control.

Get Started

Try fastCRW free

Run a live request in the playground — no signup required. Or grab a free API key with 1000 free credits, no credit card.

Continue exploring

More tutorial posts

View category archive