# UK NHS Providers Scraper — ODS Organisation Registry (`nomad-agent/uk-nhs-ods-providers-scraper`) Actor

Search the official NHS Organisation Data Service (ODS) registry of UK healthcare providers — GP practices, pharmacies, dentists, NHS trusts, hospices, care homes. Filter by name, postcode, type, status; optional full address/contacts/roles. Official open-data API (OGL v3), no login, no proxies.

- **URL**: https://apify.com/nomad-agent/uk-nhs-ods-providers-scraper.md
- **Developed by:** [Nomad.Dev](https://apify.com/nomad-agent) (community)
- **Categories:** Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.40 / 1,000 provider records

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## UK NHS Providers Scraper — ODS Organisation Registry

Search the official NHS Organisation Data Service (ODS) registry of UK healthcare providers — GP practices, pharmacies, dental practices, NHS trusts, hospices, care homes and more. Official open-data API, no login, no proxies, no HTML parsing.

### What NHS provider data does this scraper extract?

One flat JSON record per organisation:

| Field | Meaning |
|---|---|
| `odsCode` | Official ODS organisation code (e.g. `L81008`) |
| `name` | Registered organisation name |
| `status` | `Active` / `Inactive` |
| `primaryRoleId` / `primaryRoleDescription` | Provider type (e.g. GP practice, pharmacy) |
| `postCode` | Registered postcode |
| `lastChangeDate` | Last registry change (useful for incremental syncs) |
| `orgLink` | Canonical registry URL for the organisation |

With **Include full details** (or in detail mode) each record adds:

| Field | Meaning |
|---|---|
| `addressLine1/2`, `town`, `county`, `country`, `uprn` | Full registered address |
| `phone`, `website` | Registered contacts where provided |
| `roles` | All ODS roles with names, primary flag and status |
| `relationships` | Organisation-hierarchy links — `[{relTypeId, relTypeName, targetOdsCode, targetName}]` (e.g. an NHS trust *site* "IS OPERATED BY" its parent trust). `targetName` is `null` by default — the registry doesn't embed the target's display name in the relationship payload. Turn on **Resolve relationship target names** (`includeRelationshipNames`) to fill it in (one extra API call per unique related org) |
| `operationalStart/End`, `legalStart/End` | Operational and legal dates |

#### Optional enrichments

| Enrichment | Adds | Turn on with |
|---|---|---|
| **Add lat/long geocoding** | `latitude`, `longitude` — the organisation's postcode geocoded via the free, open [postcodes.io](https://postcodes.io) service (Ordnance Survey / ONS open data). `null` when a postcode can't be resolved. Works in search or detail mode. | `includeGeo: true` |
| **Resolve relationship target names** | Fills `relationships[].targetName` with each related organisation's registered name (e.g. the parent NHS trust). Needs detail data — detail mode, or `includeDetails: true` in search mode. | `includeRelationshipNames: true` |

With **Only new since last run** enabled, every returned record also carries `isNew: true`.

### How to scrape NHS providers with this Actor

1. Pick a **mode**: `search` (filters below) or `detail` (pass `odsCodes`).
2. In search mode set at least one filter: `name`, `postCode` (full or partial, e.g. `BS1`), `providerType` (GP practice, pharmacy, dental, NHS trust, hospice, care home, …), `roleId` (any official role code), `lastChangeDate` for a one-off incremental sync, or `onlyNewSinceLastRun` for automatic incremental syncs across scheduled runs.
3. Run and export JSON, CSV or Excel — or call it over the API:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("nomad-agent/uk-nhs-ods-providers-scraper").call(run_input={
    "mode": "search",
    "postCode": "BS1",
    "providerType": "pharmacy",
    "includeDetails": True,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["odsCode"], "|", item["name"], item["postCode"])
````

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/nomad-agent~uk-nhs-ods-providers-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"mode": "search", "postCode": "BS1", "providerType": "gp_practice"}'
```

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select | `search` | `search` queries the registry with the filters below; `detail` fetches full records for the ODS codes in `odsCodes`. |
| `name` | string | – | Case-insensitive substring match on the organisation name. |
| `postCode` | string | *(prefilled `BS1` in Console)* | Full or partial UK postcode; prefix match on the registered address. |
| `providerType` | select | `any` | Common provider types mapped to official ODS role codes (GP practice, pharmacy, dental, NHS trust, NHS trust site, hospice, care home, optical site, independent provider, branch surgery). |
| `specialty` | string | – | Free-text specialty (e.g. `pharmacy`, `hospice`, `dental`), matched against the ODS role vocabulary. Ignored if `providerType` (non-`any`) or `roleId` is set. |
| `roleId` | string | – | Any official ODS role code (advanced) — overrides `providerType` and `specialty`. |
| `status` | select | `active` | `active`, `inactive`, or `all`. |
| `lastChangeDate` | string (`YYYY-MM-DD`, datepicker) | – | Only organisations changed on or after this date. The registry rejects dates more than ~185 days in the past (HTTP 406). |
| `onlyNewSinceLastRun` | boolean | `false` | Search only organisations changed since this Actor's own last successful run (server-side, via the registry's `LastChangeDate` filter). Overrides `lastChangeDate` once a prior run exists. Search mode only. Tags every record `isNew: true`. |
| `odsCodes` | array | – | ODS codes to fetch in `detail` mode (e.g. `L81008`, `RA7`, `FLM49`). |
| `includeDetails` | boolean | `false` | In search mode, enrich every hit with the full registry record — one extra API call per organisation. |
| `includeGeo` | boolean | `false` | Add `latitude`/`longitude` by geocoding each postcode via the free postcodes.io service. Best-effort — unresolved postcodes return `null`. |
| `includeRelationshipNames` | boolean | `false` | Resolve `relationships[].targetName` (needs detail data) — one extra API call per unique related organisation. |
| `maxItems` | integer | `100` | Hard cap on organisations returned. Each result is billed, so start low and raise once your filter is dialed in. `0` = no cap. |
| `concurrency` | integer | `8` | *(Advanced)* Parallel detail-record fetches (detail mode / `includeDetails`), 1–16. |

### Output example

Search mode (`includeDetails: false`):

```json
{
  "odsCode": "L81008",
  "name": "SHIREHAMPTON GROUP PRACTICE",
  "status": "Active",
  "primaryRoleId": "RO177",
  "primaryRoleDescription": "PRESCRIBING COST CENTRE",
  "postCode": "BS11 9SB",
  "orgRecordClass": "RC1",
  "lastChangeDate": "2024-07-15",
  "orgLink": "https://directory.spineservices.nhs.uk/ORD/2-0-0/organisations/L81008",
  "source": "nhs-ods"
}
```

Detail mode / `includeDetails: true` — a real NHS trust *site*, showing the `relationships` link back to its parent trust:

```json
{
  "odsCode": "A0A1E",
  "name": "CAMHS - ADASH",
  "status": "Active",
  "primaryRoleId": "RO198",
  "primaryRoleDescription": "NHS TRUST SITE",
  "postCode": "AL10 8HR",
  "orgRecordClass": "RC2",
  "lastChangeDate": "2024-05-08",
  "orgLink": "https://directory.spineservices.nhs.uk/ORD/2-0-0/organisations/A0A1E",
  "source": "nhs-ods",
  "addressLine1": "DOWNS FARM CENTRE",
  "town": "HATFIELD",
  "country": "ENGLAND",
  "roles": [
    {"id": "RO198", "name": "NHS TRUST SITE", "primary": true, "status": "Active"},
    {"id": "RO31", "name": "PPA EPACT SYSTEM", "primary": false, "status": "Active"}
  ],
  "relationships": [
    {"relTypeId": "RE6", "relTypeName": "IS OPERATED BY", "targetOdsCode": "RWR", "targetName": null}
  ],
  "operationalStart": "2024-03-22"
}
```

### Integrations

Every run's results are available as a dataset you can export as JSON, CSV, Excel (XLSX), or query straight from the API with `run-sync-get-dataset-items`. Wire it into **Make**, **Zapier**, or **n8n** via their native Apify integrations, or drive it programmatically through the [Apify MCP server](https://apify.com/apify/actors-mcp-server) so an LLM agent can call this Actor as a tool.

### Pricing

Pay per event: **$0.05 per Actor start** and **$0.004 per organisation returned**.
100 providers ≈ $0.45. No subscription — pay only for what you fetch.

### Use cases

- Healthcare lead generation: every pharmacy, GP practice or dental practice in a region, with addresses and phone numbers
- Master-data / CRM enrichment keyed on official ODS codes
- Incremental registry syncs via `lastChangeDate`, or automatically on a schedule via `onlyNewSinceLastRun`
- Health-tech integrations that need canonical NHS organisation reference data
- Market analysis of UK primary care, community pharmacy and independent providers
- Mapping organisational hierarchy (e.g. which trust operates which site) via the `relationships` field (with `includeRelationshipNames` for resolved names)
- Geospatial analysis and mapping via optional `latitude`/`longitude` geocoding (`includeGeo`)

### FAQ

**Is it legal to scrape NHS ODS data?**
Yes. The ORD API is the official, public, unauthenticated open-data API of NHS England's Organisation Data Service, and the data is published under the **Open Government Licence v3** — free to use, including commercially, with attribution ("Contains information from NHS England, licenced under the current version of the Open Government Licence").

**Do I need an API key or login?**
No. The ORD API requires no authentication of any kind.

**Which countries does it cover?**
Primarily England (plus border/cross-registered organisations in Wales, Scotland and Northern Ireland where they hold ODS codes).

**Why does a GP practice show `PRESCRIBING COST CENTRE` as its primary role?**
That is how ODS models GP practices — the primary role is RO177 with RO76 (GP PRACTICE) as a non-primary role. Filtering by the "GP practice" provider type handles this for you.

**What if an ODS code isn't found?**
It is logged and skipped — the run continues with the other codes.

**How fresh is the data?**
Every run hits the live registry API. No caching layer in between.

**How do I run this on a schedule and only get what's new?**
Turn on **Only new since last run** (`onlyNewSinceLastRun`). It stores this Actor's last successful run date and, on the next run, asks the registry for organisations changed since then — no need to track ids yourself, and no re-paying for organisations you already have. First run with the flag on (no prior state yet) behaves like a normal search; every run after that is incremental.

**What's in `relationships`?**
Organisation-hierarchy links from the registry's own data, e.g. an NHS trust *site* record links back to the trust that operates it (`relTypeId: "RE6"`, `"IS OPERATED BY"`). Only present in detail mode / with **Include full details** on. `targetName` is `null` by default; turn on **Resolve relationship target names** (`includeRelationshipNames`) to fill in each related organisation's name.

**Can I get map coordinates?**
Yes — turn on **Add lat/long geocoding** (`includeGeo`) and each record gains `latitude`/`longitude`, geocoded from its postcode via the free, open postcodes.io service. Unresolvable postcodes return `null`.

**Something broken or missing?**
Open an issue on the Actor's **Issues** tab — it is monitored and fixes ship fast.

### Related Actors

More official-registry and government-data scrapers from the same family:

- [UK Case Law Scraper — Find Case Law Judgments API](https://apify.com/nomad-agent/uk-case-law-scraper)
- [SPAC Redemptions Scraper — SEC EDGAR Lifecycle Tracker](https://apify.com/nomad-agent/spac-redemptions-scraper)
- [PTAB Trials Scraper — USPTO IPR & PGR Decisions API](https://apify.com/nomad-agent/ptab-trials-scraper)

# Actor input Schema

## `mode` (type: `string`):

<code>search</code> queries the registry with the filters below. <code>detail</code> fetches full records for the ODS codes listed in odsCodes.

## `name` (type: `string`):

Case-insensitive substring match on the organisation name (e.g. <code>pharmacy</code>, <code>surgery</code>, <code>st thomas</code>).

## `postCode` (type: `string`):

Full or partial UK postcode (e.g. <code>BS1</code>, <code>SW1A 1AA</code>, <code>LS</code>). Prefix match on the registered address.

## `providerType` (type: `string`):

Common healthcare provider types, mapped to official ODS role codes. Use roleId below for any other role.

## `specialty` (type: `string`):

Free-text provider specialty, matched against the official ODS role vocabulary (e.g. <code>pharmacy</code>, <code>hospice</code>, <code>dental</code>, <code>optical</code>). A convenience alternative to the <code>Provider type</code> enum for roles it doesn't list. Ignored if <code>Provider type</code> (non-Any) or <code>Role ID</code> is set.

## `roleId` (type: `string`):

Any official ODS role code (e.g. <code>RO177</code>). Overrides providerType and specialty. Full list: https://directory.spineservices.nhs.uk/ORD/2-0-0/roles

## `status` (type: `string`):

Registration status filter.

## `lastChangeDate` (type: `string`):

Only organisations whose record changed on or after this date — useful for incremental syncs. Note: the registry itself rejects dates more than ~185 days in the past (HTTP 406). For automatic incremental syncs without picking a date by hand, use <code>Only new since last run</code> below instead.

## `onlyNewSinceLastRun` (type: `boolean`):

Search only organisations changed since this Actor's own last successful run (uses the registry's LastChangeDate filter under the hood — cheaper and more accurate than caching every id ever seen across ~280k organisations). Overrides <code>Changed since</code> once a prior run exists. Search mode only — no-op in detail mode. Every returned record is tagged isNew: true.

## `odsCodes` (type: `array`):

Organisation ODS codes to fetch in detail mode (e.g. L81008, RA7, FLM49).

## `includeDetails` (type: `boolean`):

In search mode, enrich every hit with the full registry record (address, contacts, all roles, operational dates). One extra API call per organisation — slower on big result sets.

## `includeGeo` (type: `boolean`):

Geocode each organisation's postcode to <code>latitude</code>/<code>longitude</code> using the free, open postcodes.io service (Ordnance Survey / ONS open data). Best-effort — postcodes that can't be resolved return null coordinates. Adds a small batch of extra lookups; no per-record cost.

## `includeRelationshipNames` (type: `boolean`):

Fill in each relationship's <code>targetName</code> (e.g. the parent NHS trust an org site is operated by). Requires detail data (detail mode, or <code>Include full details</code> in search mode) — costs one extra API call per unique related organisation. Off by default: relationships still carry <code>targetOdsCode</code>, just with <code>targetName</code> null.

## `maxItems` (type: `integer`):

Hard cap on organisations returned. Each returned organisation is a billed result, so keep this low while testing filters — raise it once you know your filter returns the right set. 0 = no cap (the full register is ~280k organisations — set a cap or a filter).

## `concurrency` (type: `integer`):

How many detail records (detail mode / includeDetails) to fetch in parallel. Higher is faster but hits the registry API harder — leave the default unless you know you need to change it.

## Actor input object example

```json
{
  "mode": "search",
  "postCode": "BS1",
  "providerType": "any",
  "status": "active",
  "onlyNewSinceLastRun": false,
  "includeDetails": false,
  "includeGeo": false,
  "includeRelationshipNames": false,
  "maxItems": 100,
  "concurrency": 8
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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 = {
    "postCode": "BS1"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nomad-agent/uk-nhs-ods-providers-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 = { "postCode": "BS1" }

# Run the Actor and wait for it to finish
run = client.actor("nomad-agent/uk-nhs-ods-providers-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "postCode": "BS1"
}' |
apify call nomad-agent/uk-nhs-ods-providers-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nomad-agent/uk-nhs-ods-providers-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "UK NHS Providers Scraper — ODS Organisation Registry",
        "description": "Search the official NHS Organisation Data Service (ODS) registry of UK healthcare providers — GP practices, pharmacies, dentists, NHS trusts, hospices, care homes. Filter by name, postcode, type, status; optional full address/contacts/roles. Official open-data API (OGL v3), no login, no proxies.",
        "version": "0.1",
        "x-build-id": "BA9aYYGf06UiBtgmS"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/nomad-agent~uk-nhs-ods-providers-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-nomad-agent-uk-nhs-ods-providers-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/nomad-agent~uk-nhs-ods-providers-scraper/runs": {
            "post": {
                "operationId": "runs-sync-nomad-agent-uk-nhs-ods-providers-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/nomad-agent~uk-nhs-ods-providers-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-nomad-agent-uk-nhs-ods-providers-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "search",
                            "detail"
                        ],
                        "type": "string",
                        "description": "<code>search</code> queries the registry with the filters below. <code>detail</code> fetches full records for the ODS codes listed in odsCodes.",
                        "default": "search"
                    },
                    "name": {
                        "title": "Name contains",
                        "type": "string",
                        "description": "Case-insensitive substring match on the organisation name (e.g. <code>pharmacy</code>, <code>surgery</code>, <code>st thomas</code>)."
                    },
                    "postCode": {
                        "title": "Postcode",
                        "type": "string",
                        "description": "Full or partial UK postcode (e.g. <code>BS1</code>, <code>SW1A 1AA</code>, <code>LS</code>). Prefix match on the registered address."
                    },
                    "providerType": {
                        "title": "Provider type",
                        "enum": [
                            "any",
                            "gp_practice",
                            "pharmacy",
                            "dental_practice",
                            "nhs_trust",
                            "nhs_trust_site",
                            "hospice",
                            "care_home",
                            "optical_site",
                            "independent_provider",
                            "branch_surgery"
                        ],
                        "type": "string",
                        "description": "Common healthcare provider types, mapped to official ODS role codes. Use roleId below for any other role.",
                        "default": "any"
                    },
                    "specialty": {
                        "title": "Specialty (free text)",
                        "type": "string",
                        "description": "Free-text provider specialty, matched against the official ODS role vocabulary (e.g. <code>pharmacy</code>, <code>hospice</code>, <code>dental</code>, <code>optical</code>). A convenience alternative to the <code>Provider type</code> enum for roles it doesn't list. Ignored if <code>Provider type</code> (non-Any) or <code>Role ID</code> is set."
                    },
                    "roleId": {
                        "title": "Role ID (advanced)",
                        "type": "string",
                        "description": "Any official ODS role code (e.g. <code>RO177</code>). Overrides providerType and specialty. Full list: https://directory.spineservices.nhs.uk/ORD/2-0-0/roles"
                    },
                    "status": {
                        "title": "Status",
                        "enum": [
                            "active",
                            "inactive",
                            "all"
                        ],
                        "type": "string",
                        "description": "Registration status filter.",
                        "default": "active"
                    },
                    "lastChangeDate": {
                        "title": "Changed since",
                        "type": "string",
                        "description": "Only organisations whose record changed on or after this date — useful for incremental syncs. Note: the registry itself rejects dates more than ~185 days in the past (HTTP 406). For automatic incremental syncs without picking a date by hand, use <code>Only new since last run</code> below instead."
                    },
                    "onlyNewSinceLastRun": {
                        "title": "Only new since last run",
                        "type": "boolean",
                        "description": "Search only organisations changed since this Actor's own last successful run (uses the registry's LastChangeDate filter under the hood — cheaper and more accurate than caching every id ever seen across ~280k organisations). Overrides <code>Changed since</code> once a prior run exists. Search mode only — no-op in detail mode. Every returned record is tagged isNew: true.",
                        "default": false
                    },
                    "odsCodes": {
                        "title": "ODS codes (detail mode)",
                        "type": "array",
                        "description": "Organisation ODS codes to fetch in detail mode (e.g. L81008, RA7, FLM49).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeDetails": {
                        "title": "Include full details",
                        "type": "boolean",
                        "description": "In search mode, enrich every hit with the full registry record (address, contacts, all roles, operational dates). One extra API call per organisation — slower on big result sets.",
                        "default": false
                    },
                    "includeGeo": {
                        "title": "Add lat/long geocoding",
                        "type": "boolean",
                        "description": "Geocode each organisation's postcode to <code>latitude</code>/<code>longitude</code> using the free, open postcodes.io service (Ordnance Survey / ONS open data). Best-effort — postcodes that can't be resolved return null coordinates. Adds a small batch of extra lookups; no per-record cost.",
                        "default": false
                    },
                    "includeRelationshipNames": {
                        "title": "Resolve relationship target names",
                        "type": "boolean",
                        "description": "Fill in each relationship's <code>targetName</code> (e.g. the parent NHS trust an org site is operated by). Requires detail data (detail mode, or <code>Include full details</code> in search mode) — costs one extra API call per unique related organisation. Off by default: relationships still carry <code>targetOdsCode</code>, just with <code>targetName</code> null.",
                        "default": false
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Hard cap on organisations returned. Each returned organisation is a billed result, so keep this low while testing filters — raise it once you know your filter returns the right set. 0 = no cap (the full register is ~280k organisations — set a cap or a filter).",
                        "default": 100
                    },
                    "concurrency": {
                        "title": "Concurrency",
                        "minimum": 1,
                        "maximum": 16,
                        "type": "integer",
                        "description": "How many detail records (detail mode / includeDetails) to fetch in parallel. Higher is faster but hits the registry API harder — leave the default unless you know you need to change it.",
                        "default": 8
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
