# CENDOJ Spanish Case Law Scraper (`automation-lab/cendoj-case-law-scraper`) Actor

Search Spanish court rulings on CENDOJ (poderjudicial.es) by keyword, ROJ/ECLI, court, jurisdiction, region and date. Get ROJ, ECLI, court, city, date, resolution type and number, judge, summary and PDF link, past the 200-result cap.

- **URL**: https://apify.com/automation-lab/cendoj-case-law-scraper.md
- **Developed by:** [Automation Lab](https://apify.com/automation-lab) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.64 / 1,000 rulings

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## CENDOJ Spanish Case Law Scraper

Search **Spanish case law on CENDOJ** (the judiciary's official jurisprudence database at poderjudicial.es) and get one clean row per ruling: **ROJ, ECLI, court, jurisdiction, city, date, resolution type and number, appeal number, judge (ponente), summary, and direct links to the official PDF and document page**.

Unlike the CENDOJ website, this Actor is **not limited to 200 results per search**. Date-sorted searches are split into date windows automatically, so you can collect every ruling that matches a topic, a court or a judge.

### What does CENDOJ Spanish Case Law Scraper do?

- Runs any CENDOJ search: free words, exact phrases and the same Y / O / NO operators the website accepts.
- Filters by **jurisdiction** (civil, penal, contencioso, social, militar), **court** (Tribunal Supremo, Audiencia Nacional, TSJ, Audiencia Provincial, first-instance courts…), **resolution type** (sentencia, auto, acuerdo), **autonomous community**, **date range**, section, judge, appeal number, resolution number and language.
- Looks up exact rulings by **ROJ** or **ECLI**.
- Returns a **direct PDF link** for every ruling, so you can open or archive the official text.
- Has an **only new rulings** mode for weekly or daily monitoring of new jurisprudence.

### Who is it for?

- **Law firms** that follow new case law on their practice areas (desahucios, cláusulas suelo, despidos, IRPH, responsabilidad patrimonial…).
- **Legaltech companies** that build search engines, alerts, analytics or AI assistants on Spanish jurisprudence.
- **Researchers and universities** that need complete datasets of rulings by court, region or period.
- **Compliance and insurance teams** that track how courts rule on a topic over time.
- **Journalists** who follow a judge, a court or a high-profile procedure.

### Why use this CENDOJ scraper?

- **Every result, not just 200.** CENDOJ shows at most 200 results per query; this Actor walks date windows (and splits very busy days by jurisdiction, region and court) to go past that limit.
- **Fast and cheap listings.** About 50 rulings per request, so even thousands of rulings come back in minutes.
- **Monitoring built in.** Only new rulings mode remembers what earlier runs returned for the same search.
- **Pay per ruling.** No subscription and no monthly rental.
- **Clear English field names**, ISO dates and one stable schema.

### What data can you extract from CENDOJ?

| Field | Example | Notes |
| --- | --- | --- |
| `roj` | `SAP B 8134/2026` | Official ROJ identifier |
| `ecli` | `ECLI:ES:APB:2026:8134` | European Case Law Identifier |
| `court` | `Audiencia Provincial` | Court type from the ROJ, for example Tribunal Supremo or Juzgado de lo Social |
| `courtCode` | `AP` | Court abbreviation from the ROJ |
| `jurisdiction` | `Social` | When the court type or your jurisdiction filter fixes it; otherwise null |
| `city` | `Barcelona` | Municipality where the court sits |
| `resolutionDate` | `2026-11-16` | ISO date |
| `resolutionType` | `Sentencia` | Sentencia or Auto |
| `resolutionNumber` | `655/2026` | |
| `appealNumber` | `1680/2024` | Recurso number |
| `judge` | `MIGUEL JULIAN COLLADO NUÑO` | Ponente |
| `summary` | `Sección nº 19 de la Audiencia…` | CENDOJ summary or headnote |
| `summaryType` | `Resumen Automático` | Label CENDOJ gives the summary |
| `pdfUrl`, `documentUrl` | links | Official PDF and CENDOJ page |
| `reference` | `11933265` | CENDOJ search reference |

#### What this Actor does not include

It does not open the official PDF of each ruling, so it does **not** return the full text, the 20-digit CENDOJ id, the court section, the procedure type or the case history. Use the `pdfUrl` link to open a ruling's full document. CENDOJ serves those documents only to Spanish IP addresses, which makes reading every PDF far more expensive than the listing.

### How much does it cost to scrape Spanish case law from CENDOJ?

The Actor uses pay-per-event pricing. You pay only for rulings saved to your dataset:

| Event | Price (Starter / BRONZE plan) | When it is charged |
| --- | --- | --- |
| Run start | $0.005 per run | Once per run |
| Ruling | $0.000801 per ruling | Each ruling saved to the dataset |

Higher Apify plans pay less per ruling: SILVER $0.0007209 and GOLD and above $0.0006408.

Cost examples at the Starter price:

- **50 rulings** for a weekly topic alert: $0.005 + 50 × $0.000801 = **$0.045**.
- **1,000 rulings** for a research dataset: $0.005 + 1,000 × $0.000801 = **$0.806**.
- **10,000 rulings** for a complete court or topic archive: $0.005 + 10,000 × $0.000801 = **$8.015**.

Apify's free plan includes monthly credit, enough to try the Actor on thousands of rulings.

### How to scrape CENDOJ rulings

1. Open the Actor and enter one or more **Search terms**, for example `desahucio` or `"cláusula suelo"`.
2. Optionally narrow the search with **Jurisdictions**, **Courts**, **Resolution types**, **Autonomous communities** and a **date range**.
3. Set **Maximum results per search**.
4. Click **Start** and download the results as JSON, CSV, Excel or HTML, or read them through the API.

### Input parameters

| Parameter | Description |
| --- | --- |
| `searchTerms` | Words to search, one search per line. CENDOJ syntax works: quotes for phrases, `Y`, `O`, `NO`. |
| `identifiers` | Exact ROJ (`STS 4519/2026`) or ECLI (`ECLI:ES:TS:2026:4519`) values to look up. |
| `maxResults` | Maximum rulings per search line (default 50). No 200 ceiling. |
| `sort` | `newest` (default), `oldest` or `relevance`. Relevance is limited by CENDOJ to the 200 best matches. |
| `jurisdictions` | `CIVIL`, `PENAL`, `CONTENCIOSO`, `SOCIAL`, `MILITAR`, `ESPECIAL`. |
| `courtTypes` | Court codes from the dropdown, for example Tribunal Supremo, Audiencia Nacional, TSJ, Audiencia Provincial. |
| `resolutionTypes` | `SENTENCIA`, `AUTO`, `ACUERDO`. |
| `regions` | Autonomous communities, for example `MADRID`, `CATALUÑA`, `ANDALUCÍA`. |
| `dateFrom`, `dateTo` | Ruling date range (YYYY-MM-DD). |
| `section`, `judge`, `appealNumber`, `resolutionNumber` | Exact-match filters as CENDOJ lists them. |
| `language` | Spanish, Catalan, Galician or Basque. |
| `onlyNew` | Return only rulings that earlier runs of the same search did not return. |
| `proxyConfiguration` | Fallback proxy, Spanish residential by default. CENDOJ serves only Spanish IPs; the Actor tries a Spanish datacenter IP first and switches to this proxy when CENDOJ refuses it. |

Example input:

```json
{
    "searchTerms": ["desahucio"],
    "jurisdictions": ["CIVIL"],
    "courtTypes": ["37"],
    "regions": ["MADRID"],
    "dateFrom": "2026-01-01",
    "maxResults": 100
}
```

To browse without words, leave `searchTerms` empty and set a filter (for example a court) or a start date.

### Output example

```json
{
    "searchTerm": "despido",
    "position": 1,
    "roj": "STSJ PV 3751/2026",
    "ecli": "ECLI:ES:TSJPV:2026:3751",
    "title": "STSJ País Vasco, a 12 de noviembre de 2026 - ROJ: STSJ PV 3751/2026",
    "court": "Tribunal Superior de Justicia",
    "courtCode": "TSJ",
    "jurisdiction": "Social",
    "city": "Bilbao",
    "resolutionDate": "2026-11-12",
    "resolutionType": "Sentencia",
    "resolutionNumber": "2563/2026",
    "appealNumber": "2071/2026",
    "judge": "JUAN CARLOS BENITO-BUTRON OCHOA",
    "summary": "que se cumple la finalidad cuádruple del conocimiento de cargos y posibilidad de pruebas, seguridad y derecho de defensa …",
    "summaryType": "Resumen Automático",
    "documentUrl": "https://www.poderjudicial.es/search/AN/openDocument/…/20261119",
    "pdfUrl": "https://www.poderjudicial.es/search/contenidos.action?action=accessToPDF&publicinterface=true&tab=AN&reference=…&encode=true&optimize=20261119&databasematch=AN",
    "reference": "11929480",
    "scrapedAt": "2026-11-22T08:01:12.000Z"
}
```

### Monitoring new case law

Schedule the Actor weekly with **Only new rulings** on. Each run returns only rulings that previous runs of the same search and filters did not return. Without a start date, the Actor checks the 120 days before the newest ruling it has already seen, because CENDOJ publishes many rulings weeks after their date. Send the new rows to Slack, email, Google Sheets or your own database with an Apify integration or webhook.

### Tips and limits

- **Going past 200 results** works with `newest` and `oldest` order. `relevance` returns at most CENDOJ's 200 best matches.
- **Very busy days** (hundreds of rulings on one date) are split by jurisdiction, region and court. If one court still has more than 200 rulings on a single day, the run log says so.
- **Jurisdiction** is filled when the court type fixes it (for example Juzgado de lo Social) or when you filter by one jurisdiction. For mixed courts such as the Tribunal Supremo or an Audiencia Provincial, filter by jurisdiction to get it on every row.
- **Only new rulings** stores the list of returned ROJ ids in a named key-value store in your account (`cendoj-case-law-scraper-state`).
- Set **Maximum charge per run** to cap spending; the Actor stops cleanly at the limit and keeps the rows already saved.

### Integrations

- **Google Sheets / Excel**: export each run as CSV or XLSX, or use the Google Sheets integration for a live legal tracker.
- **Slack or email alerts**: combine Only new rulings with a schedule and a webhook to notify your team about new judgments.
- **Legal AI and RAG**: feed summaries and PDF links into your vector database or document pipeline.
- **Make, Zapier, n8n**: trigger the Actor and process rulings in your workflow tools.

### Use the CENDOJ scraper with the Apify API

cURL:

```bash
curl -X POST "https://api.apify.com/v2/acts/automation-lab~cendoj-case-law-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms":["desahucio"],"maxResults":20}'
```

JavaScript:

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('automation-lab/cendoj-case-law-scraper').call({
    searchTerms: ['cláusula suelo'],
    jurisdictions: ['CIVIL'],
    maxResults: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("automation-lab/cendoj-case-law-scraper").call(run_input={
    "searchTerms": ["despido improcedente"],
    "courtTypes": ["11|12|13|14|15|16"],
    "maxResults": 50,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["roj"], item["resolutionDate"], item["court"])
```

### Use with AI agents via MCP

Connect the Actor to Claude, Cursor or another MCP client through the Apify MCP server.

Claude Code:

```bash
claude mcp add --transport http apify \
  "https://mcp.apify.com?tools=automation-lab/cendoj-case-law-scraper"
```

Claude Desktop, Cursor or VS Code (JSON configuration):

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com?tools=automation-lab/cendoj-case-law-scraper"
        }
    }
}
```

The Actor-specific URL also adds the run and dataset tools (`get-actor-run`, `get-dataset-items`, `get-key-value-store-record`, `abort-actor-run`). Start one run, keep its run ID, and if `call-actor` returns before the run ends, check that same run with `get-actor-run` at growing intervals (2, 4, 8 seconds, then every 10) up to a deadline you choose. Once it succeeds, read rows with `get-dataset-items` using an explicit `limit`, `offset` and the `fields` you need (for example `roj,resolutionDate,court,summary`), so large result sets do not flood the model context.

Example prompts:

- "Find the 20 newest Tribunal Supremo civil judgments about cláusula suelo and summarize the outcome of each."
- "List all Audiencia Provincial de Madrid rulings on desahucio from October 2026 with their judge and appeal number."
- "Look up ECLI:ES:TS:2026:4519 and give me its court, date, judge and PDF link."

### Error reporting and your data

When a run fails, the Actor sends a sanitized error report (error message, stack trace and input with secrets and URL queries removed) to our private GlitchTip error tracker so we can fix bugs quickly. Reports are kept for 30 days and are never shared or used for training. Scraped rulings stay in your own Apify storage. The Actor uses no AI services.

### Is it legal to scrape CENDOJ?

CENDOJ publishes Spanish court rulings for public access, and personal data in them is anonymised by the judiciary before publication. The CGPJ's terms allow consultation and reuse of the published rulings but restrict mass downloading and commercial reuse; check the CENDOJ legal notice and the Spanish rules on reuse of public-sector information for your use case. Keep request volumes reasonable, do not try to re-identify anonymised people, and respect data-protection law (GDPR and LOPDGDD) when you store or publish results. This Actor is not affiliated with or endorsed by the Consejo General del Poder Judicial.

### FAQ

**Why does the CENDOJ website stop at 200 results, and how does this Actor get more?**
CENDOJ returns at most 200 results for any query. With `newest` or `oldest` order the Actor moves a date cursor past the last ruling it received and searches again, and it splits days with more than 200 rulings by jurisdiction, region and court.

**Do I need a proxy?**
No setup is needed. CENDOJ refuses most datacenter IP addresses. The Actor uses a Spanish datacenter IP first and Apify's Spanish residential proxy as a fallback; both are included in the price.

**Can I get the full text of each ruling?**
Not from this Actor. Every row has `pdfUrl`, the official PDF of the ruling, which you can open or download yourself. The Actor does not read the PDFs, which keeps it fast and cheap.

**My search returns nothing. What should I check?**
Try fewer words, remove filters one by one, and check that exact-match filters (judge, appeal number, section) are written exactly as CENDOJ shows them. A ROJ must include its court code, for example `STS 4519/2026`.

**Can I get rulings in Catalan, Galician or Basque?**
Yes. Use the Language filter, or leave it on Any to get every language.

### Related Actors

- [Court Records Scraper](https://apify.com/automation-lab/court-records-scraper): US court records and case searches, for teams that also follow US litigation.
- [Martindale Lawyer Directory Scraper](https://apify.com/automation-lab/martindale-lawyer-directory): lawyer and law-firm profiles for legal market research.

# Changelog

This Actor's version history is a separate document: https://apify.com/automation-lab/cendoj-case-law-scraper/changelog.md

# Actor input Schema

## `searchTerms` (type: `array`):

Words to find in Spanish court rulings, one search per line, for example `desahucio` or `cláusula suelo`. CENDOJ search syntax works: quotes for an exact phrase, Y / O / NO between words. Each line returns up to Maximum results per search.

## `identifiers` (type: `array`):

Look up exact rulings, one per line, by ROJ (for example `STS 4519/2026`) or ECLI (for example `ECLI:ES:TS:2026:4519`).

## `maxResults` (type: `integer`):

How many rulings each search line returns at most. There is no 200-result ceiling when ordering by date: larger searches are split into date windows automatically.

## `sort` (type: `string`):

Order of the rulings. Newest and oldest go past CENDOJ's 200-result limit; most relevant is limited to the 200 best matches by CENDOJ itself.

## `jurisdictions` (type: `array`):

Only rulings from these jurisdictions. Leave empty for all.

## `courtTypes` (type: `array`):

Only rulings from these courts, for example Tribunal Supremo or Audiencia Provincial. Leave empty for all.

## `resolutionTypes` (type: `array`):

Only these kinds of resolution. Leave empty for all.

## `regions` (type: `array`):

Only rulings from courts seated in these autonomous communities. National courts (Tribunal Supremo, Audiencia Nacional) sit in Madrid.

## `dateFrom` (type: `string`):

Only rulings dated on or after this day.

## `dateTo` (type: `string`):

Only rulings dated on or before this day.

## `section` (type: `string`):

Only rulings from this section number of the court, for example `19`. Best combined with a court.

## `judge` (type: `string`):

Only rulings written by this judge, full name as CENDOJ lists it, for example `MIGUEL JULIAN COLLADO NUÑO`.

## `appealNumber` (type: `string`):

Only rulings with this appeal (recurso) number, for example `1680/2024`.

## `resolutionNumber` (type: `string`):

Only rulings with this resolution number, for example `655/2026`.

## `language` (type: `string`):

Only rulings written in this language.

## `onlyNew` (type: `boolean`):

For scheduled runs: returns only rulings that earlier runs with the same search and filters did not return. Without a start date it checks the last 120 days before the newest ruling seen.

## `proxyConfiguration` (type: `object`):

CENDOJ refuses most datacenter IPs. The Actor first uses a Spanish datacenter IP and switches to this proxy (Spanish residential by default) when CENDOJ refuses it.

## Actor input object example

```json
{
  "searchTerms": [
    "desahucio"
  ],
  "maxResults": 20,
  "sort": "newest",
  "language": "",
  "onlyNew": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "ES"
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

One row per CENDOJ ruling with date, ROJ, ECLI, court, jurisdiction, city, resolution type and number, judge, summary and PDF link.

## `detailed` (type: `string`):

Every field, including search term, position, appeal number, summary type, document links and the CENDOJ reference.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "desahucio"
    ],
    "maxResults": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "ES"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/cendoj-case-law-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["desahucio"],
    "maxResults": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "ES",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/cendoj-case-law-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "desahucio"
  ],
  "maxResults": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "ES"
  }
}' |
apify call automation-lab/cendoj-case-law-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automation-lab/cendoj-case-law-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/dnQVsZxsfN4OxZzcg/builds/lU0SY83e998FKtwHu/openapi.json
