# Justícia Andorra - Andorran Case Law Search (`legaltech/justicia-ad`) Actor

Search Andorran case law (Tribunal Superior de Justícia, Tribunal de Corts, Batllia) in the official search engine of the Consell Superior de la Justícia: ECLI, ROJ, AI summary, descriptors, related legislation and full text.

- **URL**: https://apify.com/legaltech/justicia-ad.md
- **Developed by:** [Miguel González](https://apify.com/legaltech) (community)
- **Categories:** Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 93.8% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

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

### Justícia Andorra - Andorran Case Law Search

Searches the case law of the Principality of Andorra in the official search engine of the Consell Superior de la Justícia (justicia.ad, powered by the CENDOJ engine): Tribunal Superior de Justícia, Tribunal de Corts and Batllia, in civil, criminal and administrative matters, from the 1990s to the present. Supports full-text search with the Catalan operators I (AND), O (OR), NO (NOT), PROPn (proximity) and "exact phrases" (AND/OR/NOT/NEARn and the Spanish Y/PROXn are translated automatically), direct lookup by ECLI or ROJ, and filters by jurisdiction, court, type of decision (sentència, aute, ordenança), reporting judge and decision date range, sorted by date or relevance. For each decision it returns ROJ, ECLI, court, decision and appeal numbers, date and the official AI summary (Resum IA); optionally it opens each decision to add jurisdiction, type, subject, reporting judge, NIG, descriptors, related legislation (with links to the BOPA) and the full text, or only the most relevant passages. A second run can fetch specific decisions by URL (documentUrls).

### Use cases

- Find Andorran High Court (TSJ) case law on a legal issue (e.g. lease termination, dismissal, tax penalties) within a date range.
- Look up a decision by its ECLI or ROJ and get its full text.
- List the decisions of a given court, jurisdiction or reporting judge.
- Extract the official AI summaries and descriptors for quick review or LLM analysis.
- Get only the passages where the search terms appear (`paragraphs`), ready for an LLM.

### How to use (guide for AI agents)

- `searchTerms`: one search per item (max 10), **written in Catalan** (the decisions are in Catalan: `arrendament`, not `arrendamiento`). Use `I` between concepts, `O` for alternatives and quotes for phrases: `"contracte d'arrendament" I desnonament`.
- ECLI (`ECLI:AD:TSJAD:2026:185`) or ROJ (`STSJ AD 185/2026`) in `searchTerms` are looked up in their dedicated fields; the other filters are ignored.
- `courts`, `jurisdictions` and `resolutionTypes` take the codes listed in the input schema; empty = all.
- Dates use YYYY-MM-DD (`dateFrom`, `dateTo`). `sortOrder`: `newest` (default), `oldest`, `relevance`.
- To read decisions: use `paragraphs: 3` for the key passages only, `includeFullText: true` for the whole text, or search first and pass the returned `documentUrl` values in `documentUrls`.
- Every result includes `searchTerm`, `rank` and `totalHits`; `passages` holds the paragraphs where the search terms appear, ready for LLM analysis.

### Coverage

| Code | Court |
|---|---|
| `TRIBUNAL SUPERIOR DE JUSTICIA DE ANDORRA` | Tribunal Superior de Justícia (civil, criminal and administrative chambers) |
| `TRIBUNAL DE CORTS` | Tribunal de Corts (criminal court) |
| `TRIBUNAL DE BATLLES` | Batllia (first-instance courts) |

The Tribunal Constitucional of Andorra is not part of this database.

### Input example

```json
{
    "searchTerms": ["arrendament I desnonament"],
    "jurisdictions": ["CIVIL"],
    "courts": ["TRIBUNAL SUPERIOR DE JUSTICIA DE ANDORRA"],
    "dateFrom": "2025-01-01",
    "dateTo": "2026-12-31",
    "maxResults": 20,
    "paragraphs": 3
}
```

### Output example (abridged)

```json
{
    "searchTerm": "arrendament I desnonament",
    "rank": 1,
    "totalHits": 239,
    "title": "STSJ ANDORRA, a 13 de setembre del 2026 - ROJ: STSJ AD 185/2026",
    "roj": "STSJ AD 185/2026",
    "ecli": "ECLI:AD:TSJAD:2026:185",
    "court": "Tribunal Superior de Justicia",
    "seat": "Andorra la Vella",
    "jurisdiction": "Civil",
    "resolutionType": "Sentència",
    "resolutionNumber": "97/2026",
    "appealNumber": "83/2026",
    "resolutionDate": "13/09/2026",
    "resolutionDateISO": "2026-09-13",
    "nig": "5300542120250002043",
    "subject": "Improcedència de la invocació de fets nous en segona instància.",
    "ponente": "Sr. Jaume TOR PORTA",
    "summary": "La Sala Civil del Tribunal Superior de Justícia desestima el recurs d'apel·lació...",
    "descriptors": [{ "term": "MANCA DE PAGAMENT DE LA RENDA", "path": "OBLIGACIONS I CONTRACTES, ARRENDAMENT, ..." }],
    "relatedLegislation": [{ "title": "LLEI 24/2018, DEL 18 D'OCTUBRE, DEL CODI DE PROCEDIMENT CIVIL article 277", "url": "https://www.bopa.ad/Legislacio/Detall?doc=CGL20181112_09_46_29" }],
    "passages": ["..."],
    "reference": "11891644",
    "documentUrl": "https://jurisprudencia.poderjudicial.es/andorra/contenidos.action?action=contenthtml&databasematch=ANDORRA&reference=11891644&optimize=20261017&publicinterface=true"
}
```

### Notes and limits

- The search engine shows a captcha after many searches in a row from the same IP. The actor spaces requests, rotates sessions and stops with a clear error instead of solving captchas.
- Searches with Spanish words return few results: the decisions are written in Catalan.
- `maxResults` applies per search term; the engine returns 50 results per page and the actor paginates.
- Parties are already pseudonymised by the source; the actor returns the text as published.

### Source

Only official sources are used (courts, ministries or the open data published by the courts themselves). Results are returned as published by the source: https://www.justicia.ad/cercador-jurisprudencia/

### Proxy

Uses the **Apify RESIDENTIAL proxy (ES)** by default, also when called via API or MCP without `proxyConfiguration` (the code applies it). Each session keeps a fixed IP (sticky session) and the IP is rotated when blocked. With `proxyUrls` your own proxies are used and no Apify proxy is consumed; to run without a proxy, pass `{"useApifyProxy": false}`. Residential traffic is billed per GB.

# Actor input Schema

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

Terms to search in the text of the decisions (one search per item, max 10). Decisions are in Catalan: write terms in Catalan (arrendament, acomiadament, desnonament...). Operators: I (AND), O (OR), NO (NOT), PROPn (within n words), "exact phrase". AND/OR/NOT/NEARn and the Spanish Y/PROXn are translated automatically. An ECLI (ECLI:AD:TSJAD:2026:185) or ROJ (STSJ AD 185/2026) is searched in its dedicated field.

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

Empty = all.

## `courts` (type: `array`):

Empty = all courts.

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

Empty = all.

## `ponente` (type: `string`):

Name (or surname) of the reporting judge, e.g. "TOR PORTA".

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

Decision date, start of range (YYYY-MM-DD).

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

Decision date, end of range (YYYY-MM-DD).

## `sortOrder` (type: `string`):

Order of the results.

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

Maximum decisions per search term.

## `includeFullText` (type: `boolean`):

Opens each decision and adds `text` (full decision) plus jurisdiction, type, subject, reporting judge, descriptors and related legislation. One extra request per result.

## `paragraphs` (type: `integer`):

If > 0, opens each decision and returns in `passages` only the N passages where the terms appear (preferring the legal reasoning), instead of the whole text. Ideal for LLMs.

## `paragraphTerms` (type: `string`):

Words used to locate the passages. Default: the search term.

## `documentUrls` (type: `array`):

URLs of decisions (the `documentUrl` field of previous results) to fetch with full text. Maximum 100 per run.

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

Default: Apify RESIDENTIAL proxy (ES). If omitted (API/MCP call), the actor applies it anyway. With proxyUrls your own proxies are used instead.

## Actor input object example

```json
{
  "searchTerms": [
    "arrendament I desnonament"
  ],
  "sortOrder": "newest",
  "maxResults": 10,
  "includeFullText": false,
  "paragraphs": 0,
  "documentUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "ES"
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset of decisions, one item per result. Main fields: searchTerm, rank, court, resolutionDateISO, roj, ecli, resolutionNumber, appealNumber, summary, documentUrl; with includeFullText or paragraphs also jurisdiction, resolutionType, subject, ponente, descriptors, relatedLegislation, text/passages.

# 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": [
        "arrendament I desnonament"
    ],
    "documentUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "ES"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("legaltech/justicia-ad").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": ["arrendament I desnonament"],
    "documentUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "ES",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("legaltech/justicia-ad").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": [
    "arrendament I desnonament"
  ],
  "documentUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "ES"
  }
}' |
apify call legaltech/justicia-ad --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,legaltech/justicia-ad"
        }
    }
}
```

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/RTxL9QrKNCGX2aYd6/builds/Rearc3j9b0Nhpz37j/openapi.json
