Commercial legal databases charge hundreds of dollars per seat per month, while Google Scholar's case law search is free and covers US federal and state opinions back well over a century. The catch is that it only exists as a web page. I wanted that corpus as JSON I could query from scripts and agents, which is what the Google Scholar Case Law API on Apify does: give it a query like "qualified immunity" and it returns opinions with courts, dates, and citations as structured data.
Disclosure: the Apify links in this post are affiliate links. If you run the Actor, I may earn a referral commission at no extra cost to you.
Does Google Scholar have a case law API?
No. Google Scholar has never shipped a public API for anything it indexes, and the case law collection is no exception. There is no key to request, no endpoint, no bulk export. The commercial alternatives license their own databases and price accordingly. So in practice a case law API means a scraper you consume like an API: send a query with court and year filters, get opinions back as JSON. That is what this Actor is, and it stays scoped to what Scholar actually publishes.
What the case law API returns
The case law API returns US court opinions as structured JSON: case title and party names, deciding court, decision date, reporter citation, a snippet, the cited-by count, and the list of cases each opinion cites.
| Field | Example | Notes |
|---|---|---|
| Case title | Harlow v. Fitzgerald |
Party names as Scholar renders them |
| Court | Supreme Court of the United States |
The deciding court |
| Decision date | June 24, 1982 |
Argument and filed dates included when published |
| Citation | 457 US 800 |
Reporter citations, page ranges, docket numbers |
| Cited by | 30,000+ |
Citation count plus inline citation links |
result_id |
9124178popularname... |
Identifier used to fetch the full case detail |
A search hit is the light record. Pass its result_id back through caseIds, or set fetchCaseDetailsForResults to true, and you get the full case detail including the complete list of cases the opinion cites. That second layer is what makes citation-graph work possible.
Who this is for
Three groups keep showing up. Legal researchers and litigation support teams assembling jurisdiction-specific corpora or preloading case metadata before discovery. Developers doing citation analysis, where cited-by counts and cited-case lists become edges in a graph. And people wiring legal search into AI agent workflows, where an agent needs to check real precedent mid-conversation instead of guessing.
One caution worth stating plainly: this is a research tool that returns what Google Scholar indexes. It is not legal advice, and anything you plan to file should be verified against the official reporter.
The manual way, and where it breaks
The DIY version is a script that requests scholar.google.com/scholar?as_sdt=2006&q=... and parses the result cards. It works for about ten queries. Scholar is one of the most aggressively bot-protected properties Google runs, so you hit captchas fast, and from a datacenter IP you often get blocked on request one. The court filter is a numeric code system buried in the UI that you have to reverse-engineer, pagination tops out quietly, and the markup shifts under your selectors. I got a prototype working in an afternoon and then spent far longer keeping it alive than building it.
The faster way: run the Google Scholar Case Law API
The hosted route is a documented JSON input and a documented JSON output.
Apify Console
- Open the Google Scholar Case Law API and click Try for free.
- Enter a
query, and optionallycourts,yearFrom, andyearTo. - Run it and download the dataset as JSON or CSV.
REST
curl -X POST "https://api.apify.com/v2/acts/johnvc~google-scholar-case-law/runs?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "query": "qualified immunity", "courts": ["158"], "yearFrom": 2015, "maxResults": 20 }'
Court code 158 is the Supreme Court; leave courts empty to search every US state and federal court. Endpoint details live in the Apify API docs.
Search case law in Python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("johnvc/google-scholar-case-law").call(
run_input={
"query": "Chevron deference",
"courts": ["158"],
"yearFrom": 2010,
"maxResults": 20,
}
)
for case in client.dataset(run["defaultDatasetId"]).iterate_items():
print(case.get("title"), case.get("court"), case.get("result_id"))
Feed the result_id values back in a second run through caseIds when you want full detail on specific opinions.
Scope a search to one circuit
The task Find Ninth Circuit opinions on qualified immunity shows court scoping in practice: one court code turns a national search into a jurisdiction-specific corpus.
Trace a doctrine through the Supreme Court
Find Supreme Court cases citing Chevron deference pairs a doctrine query with the SCOTUS court code, which is the starting point for tracking how a standard evolved.
Export results to a spreadsheet
Export case law search results to CSV is the no-code path: run the search, download the dataset as CSV, hand it to whoever works in Excel.
Start with the free credit
Search US case law with a free API shows the cheapest possible run. New Apify accounts include platform credit, and a search-only run bills half a cent per result, so first experiments usually cost nothing out of pocket.
Search US precedent in Chinese
A pair of tasks serve Chinese-speaking legal researchers who need US precedent. The first, US trade secret case search, covers trade secret disputes.
Pull US patent infringement precedents
The companion task US patent infringement case law does the same for patent litigation, using the language input to localize the interface.
Put case law inside AI agent workflows
Apify exposes the Actor over the Model Context Protocol, so Claude, Claude Code, and Cursor can call it as a tool. An agent can search a doctrine, pull the full detail for the top hit, and cite real opinions instead of hallucinating them, which is the failure mode that gets people sanctioned. The task Do legal research in Claude with a case law MCP has the setup, and you can read more about Claude at claude.ai.
FAQ about scraping Google Scholar case law
How much does the case law scraper cost to run?
Billing is per event: half a cent per search result and one cent per full case detail, plus a fraction of a cent when a run starts. A 20-result search-only run is about a dime. Full details are off by default so a cheap search stays cheap, and Apify's free credit covers early usage.
How do I run the case law scraper from Python?
Use apify-client as shown above: pass a query with optional courts and year bounds, then iterate the dataset. For citation-graph work, collect result_id values and run them back through caseIds.
Can an AI agent use this case law scraper through MCP?
Yes. Connected over MCP, the Actor shows up as a callable tool in Claude, Claude Code, or Cursor, so agent workflows can ground their legal answers in opinions that actually exist.
Can I schedule the scraper to watch for new opinions?
Yes. Save your query as a task, attach an Apify schedule, and enable sortByDate so the newest decisions surface first. Repeated runs against a watchlist query is how the monitoring use case works; start from the Google Scholar Case Law API.
What are the honest limits of a case law scraper?
It returns what Google Scholar indexes, nothing more. You get citations and cited-by counts, but not editorial treatment signals, so it will not tell you a case was overruled the way a paid citator does. Coverage of very recent or very obscure opinions depends on Scholar's own indexing. Treat the output as research input, not legal advice.
More from Truffle Pig Data
Related Actors from the same shop, all returning structured JSON: the Google Scholar API for academic papers and citations, the Google Scholar Lite API for lighter search runs, and the Google Patents API for the patent side of IP research.
Wrapping up
Google Scholar's case law collection is the best free corpus of US opinions, and now it behaves like an API. Run the Google Scholar Case Law API and start with a single query and a court code.
Top comments (0)