# Bailii — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search and retrieve court judgments and case law from British and Irish courts across multiple jurisdictions, with filtering by date range and location. Access complete case details including full judgment text and metadata to research legal precedents and decisions.

**Category:** Government & Public Data | **Website:** [bailii.org/](https://bailii.org/) | **Docs:** [parse.bot/marketplace/d88b79c8-973f-42b6-88f7-0786af1c2d4f/bailii-org-api](https://parse.bot/marketplace/d88b79c8-973f-42b6-88f7-0786af1c2d4f/bailii-org-api)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/bailii/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Get case detail

Fetch and parse a BAILII case detail page. Returns structured metadata (title, citation, court, date, judges, status, result) and the full judgment text. Requires either case_path or case_url. Case paths are obtained from search_cases or search_cases_rss results.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `case_path` | string | No | Case path relative to BAILII root (e.g., 'ie/cases/IEHC/2016/H187.html'). Obtain from search_cases or search_cases_rss results' case_path field. |
| `case_url` | string | No | Full URL of the case page (e.g., 'https://www.bailii.org/ie/cases/IEHC/2016/H187.html'). Use either case_path or case_url. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/bailii/get-case-detail \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"case_path":"<string>","case_url":"<string>"}'
```

### Search cases

Search BAILII case law databases with various filters. Returns paginated results with case titles, citations, courts, dates, and relevance scores. Requires at least one search parameter (query, phrase, all_words, or any_words). Pagination via page parameter; default 10 results per page. Sort by relevance, date, title, or jurisdiction.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `all_words` | string | No | All of these words must appear (space-separated) |
| `any_words` | string | No | Any of these words may appear (space-separated) |
| `date_from` | string | No | Filter results from this date (DD/MM/YYYY format) |
| `date_to` | string | No | Filter results up to this date (DD/MM/YYYY format) |
| `jurisdiction` | string | No | Jurisdiction filter. Accepted values: ie (all Ireland), ie_sc (Supreme Court), ie_ca (Court of Appeal), ie_hc (High Court), uk (all UK), ew (England & Wales), nie (Northern Ireland), scot (Scotland). Or a direct mask_path like 'ie/cases/IESC'. |
| `page` | integer | No | Page number (1-based) |
| `per_page` | integer | No | Results per page |
| `phrase` | string | No | Exact phrase to search for (e.g., 'negligence') |
| `query` | string | No | Direct search query string (advanced boolean syntax). Use this OR phrase/all_words/any_words. |
| `sort` | string | No | Sort order for results. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/bailii/search-cases \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"all_words":"<string>","any_words":"<string>","date_from":"<string>","date_to":"<string>","jurisdiction":"<string>","page":"<integer>","per_page":"<integer>","phrase":"<string>","query":"<string>","sort":"<string>"}'
```

### Search cases rss

Search BAILII cases and return ALL matching results at once (no pagination needed). Uses the RSS feed format for faster retrieval. Returns basic metadata per case (title, citation, court, date, URL). Best for getting a complete list of matching cases. Requires at least one search parameter.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `all_words` | string | No | All of these words must appear (space-separated) |
| `any_words` | string | No | Any of these words may appear (space-separated) |
| `jurisdiction` | string | No | Jurisdiction filter. Accepted values: ie (all Ireland), ie_sc (Supreme Court), ie_ca (Court of Appeal), ie_hc (High Court), uk (all UK), ew (England & Wales), nie (Northern Ireland), scot (Scotland). Or a direct mask_path like 'ie/cases/IESC'. |
| `phrase` | string | No | Exact phrase to search for |
| `query` | string | No | Direct search query string. Use this OR phrase/all_words/any_words. |
| `sort` | string | No | Sort order for results. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/bailii/search-cases-rss \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"all_words":"<string>","any_words":"<string>","jurisdiction":"<string>","phrase":"<string>","query":"<string>","sort":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.