{
  "openapi": "3.0.1",
  "info": {
    "title": "NHS ODS Scraper: GP Practices, Pharmacies & Dentists",
    "description": "$0.1/1K providers | Search the NHS ODS registry for GP practices, pharmacies, dentists, trusts, hospices and care homes by name, postcode or type. Each row has the ODS code, address, roles and status. No login or API key. Not affiliated with the NHS.",
    "version": "0.1",
    "x-build-id": "RMubxwb9BgbB2GWjz"
  },
  "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 — prefix match on the registered address. A district (<code>BS1</code>), a full postcode (<code>SW1A 1AA</code>), or a whole postcode area (<code>LS</code> = every Leeds district, <code>M</code> = every Manchester district) all work."
          },
          "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)."
          },
          "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 address, phone & roles",
            "type": "boolean",
            "description": "Enrich every search hit with the full registry record — street address, town, county, phone, all ODS roles and operational dates. On by default. No extra cost per record; adds roughly 35 seconds per 1,000 organisations. Turn it off for a faster, codes-and-names-only run.",
            "default": true
          },
          "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",
            "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",
            "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
          },
          "dedupe": {
            "title": "Repeat-delivery suppression",
            "required": [
              "enabled",
              "key"
            ],
            "type": "object",
            "description": "Suppress confirmed repeat deliveries for the same Apify user and search.",
            "properties": {
              "enabled": {
                "type": "boolean",
                "title": "Enabled",
                "description": "Use the tenant-isolated delivery ledger."
              },
              "key": {
                "type": "string",
                "maxLength": 256,
                "title": "Scope key",
                "description": "Optional stable alert or profile key. Empty derives the scope from this search."
              }
            },
            "default": {
              "enabled": true,
              "key": ""
            },
            "additionalProperties": false
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}