# India Hospitals & Pharmacies by PIN (`automation-lab/india-healthcare-directory-by-pin`) Actor

Resolve Indian PIN codes and export public OpenStreetMap hospital and pharmacy names, categories, coordinates, addresses, and available contacts.

- **URL**: https://apify.com/automation-lab/india-healthcare-directory-by-pin.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 healthcare record extracteds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## India Hospitals & Pharmacies by PIN

Build a PIN-indexed healthcare directory from public OpenStreetMap data.
Enter one or more Indian postal PIN codes and receive named hospitals and
pharmacies with coordinates, mapped address parts, and available public contact
fields.

If you are researching **Hyderabad India hospitals**, this Actor turns PIN
500001 or another local PIN into a structured dataset instead of a manually
copied map list. The same workflow works for supported PIN codes across India.

### What this Actor does

The Actor performs four steps:

1. validates each six-digit Indian PIN code;
2. resolves the PIN to a geographic center using OpenStreetMap Nominatim;
3. reads a bounded area from the public OpenStreetMap map API;
4. filters, normalizes, and deduplicates named hospitals and pharmacies.

Each result keeps the requested PIN code and, separately, the `addr:postcode`
value mapped on the OSM feature. This distinction helps you audit records near a
PIN centroid whose mapped postal code differs from the requested PIN.

### Who is it for

- healthcare data teams building location indexes;
- pharmacy and hospital market researchers;
- operations teams preparing territory spreadsheets;
- developers enriching an internal location database;
- analysts comparing mapped healthcare access across PIN codes;
- data pipeline owners who need stable OSM IDs and source links.

Choose this Actor when your input is a list of Indian PIN codes and your target
entities are hospitals or pharmacies. For broad, worldwide POI categories or a
custom Overpass query, use the related OpenStreetMap POI Extractor instead.

### Why use a PIN-specific healthcare workflow

A generic POI search leaves postal indexing and category normalization to the
user. This Actor adds:

- strict Indian PIN validation;
- multi-PIN batching;
- hospital/pharmacy-only filtering;
- one normalized healthcare category field;
- `requestedPinCode` and mapped `pinCode` fields;
- node and way deduplication by stable OSM identity;
- way centroid calculation;
- a spreadsheet-friendly default dataset view;
- bounded radius and output controls.

The Actor does not enrich records from private databases. Contact values are
included only when public OSM contributors mapped them.

### Extracted data

| Field | Meaning |
| --- | --- |
| `requestedPinCode` | PIN supplied in the input |
| `pinCode` | OSM `addr:postcode`, or `null` |
| `category` | `hospital` or `pharmacy` |
| `name` | Public mapped place name |
| `latitude`, `longitude` | Node coordinates or calculated way centroid |
| `address` | Combined available address parts |
| `houseNumber`, `street` | Detailed mapped address values |
| `locality`, `city`, `district`, `state` | Available administrative values |
| `phone`, `email`, `website` | Public contact values when mapped |
| `openingHours` | OSM opening-hours expression when mapped |
| `operator` | Public operator value when mapped |
| `emergency` | Emergency-service indicator when mapped |
| `osmType`, `osmId` | Stable source element identity |
| `osmUrl` | Public OSM element page |
| `sourceUrl` | Bounded OSM API request used for retrieval |
| `retrievedAt` | UTC retrieval timestamp |

Fields absent from the source are returned as `null`. A null contact value is
not an extraction error.

### Getting started

1. Open the Actor input page.
2. Add one Indian PIN code, such as `500001`.
3. Keep both healthcare categories selected for the first run.
4. Use the default 1 km radius.
5. Set `maxItems` to 20 for a small trial.
6. Start the run.
7. Open the **Healthcare directory** dataset view.
8. Export the results as CSV, Excel, JSON, XML, or RSS through Apify.

Start with a small run because dense city centers can return many records and a
larger OSM map response.

### Input parameters

#### `pinCodes`

Required array of 1–25 Indian PIN codes. Every value must contain six digits and
cannot begin with zero. Duplicate values are removed before requests start.

#### `categories`

Choose one or both values:

- `hospital`
- `pharmacy`

The default includes both.

#### `radiusKm`

Radius around the PIN centroid, from 0.25 km through 1.5 km. The default is 1
km. This is a centroid search, not a claim that every postal boundary is a
perfect circle.

#### `maxItems`

Maximum unique records saved across all PIN codes. The accepted range is 1 to
5,000 and the default is 100. Processing stops when this limit is reached.

### Example input

```json
{
  "pinCodes": ["500001"],
  "categories": ["hospital", "pharmacy"],
  "radiusKm": 1,
  "maxItems": 20
}
```

This input returned 20 typed records in a local verification run on 26 August
2026\. Public map data changes, so later counts can differ.

### Example output

The following shape is based on current Actor output. Values are abbreviated to
keep the example readable.

```json
{
  "requestedPinCode": "500001",
  "pinCode": "500029",
  "category": "hospital",
  "name": "Hope Children's Hospital",
  "latitude": 17.4064283,
  "longitude": 78.4738814,
  "address": "Hyderabad, Telangana, 500029",
  "houseNumber": null,
  "street": null,
  "locality": null,
  "city": null,
  "district": "Hyderabad",
  "state": "Telangana",
  "phone": "040 23223782;040 23223792;040 66069000",
  "email": "info@hopechildrenshospital.com",
  "website": "https://hopechildrenshospital.com/",
  "openingHours": null,
  "operator": null,
  "emergency": null,
  "osmType": "node",
  "osmId": 2192962541,
  "osmUrl": "https://www.openstreetmap.org/node/2192962541",
  "sourceUrl": "https://api.openstreetmap.org/api/0.6/map?bbox=...",
  "retrievedAt": "2026-08-26T14:35:45.762Z"
}
```

Always use `osmUrl` to inspect the current source record when a field is
important to a business decision.

### How much does it cost to extract India healthcare records?

The Actor uses pay-per-event pricing:

- a one-time **$0.005 run start** event;
- **$0.002 per healthcare record** at the BRONZE tier;
- lower per-record prices on higher subscription tiers.

At the BRONZE tier, the Actor price is approximately:

| Saved records | BRONZE calculation | Approximate Actor price |
| ---: | --- | ---: |
| 10 | 0.005 + (10 × 0.002) | 0.025 USD |
| 50 | 0.005 + (50 × 0.002) | 0.105 USD |
| 100 | 0.005 + (100 × 0.002) | 0.205 USD |
| 500 | 0.005 + (500 × 0.002) | 1.005 USD |

The per-record event is charged only for a named hospital or pharmacy saved to
the default dataset. Empty source features, unnamed places, duplicates, and
rejected records are not charged as healthcare records. Apify platform usage
may be billed separately according to your plan.

### Hyderabad India hospitals workflow

For a focused Hyderabad export:

1. use PIN `500001`;
2. select `hospital`;
3. keep a 1 km radius;
4. review `requestedPinCode` and `pinCode` together;
5. export the dataset to CSV or Excel;
6. retain `osmId` and `retrievedAt` for future comparisons.

You can schedule the same Actor input as an Apify Task when you need recurring
snapshots. The Actor returns the current public OSM view; it does not itself
calculate changes between separate runs.

### Build a multi-PIN directory

Supply up to 25 PIN codes in one run. Records are deduplicated by OSM element
identity, so an entity found in overlapping PIN radii appears once. The retained
`requestedPinCode` is the first processed PIN that found that element.

For more than 25 PIN codes, split your workload into several Tasks. Sequential,
bounded batches are kinder to public OSM services and make failures easier to
retry.

### Export to CSV, Excel, and data pipelines

The default Apify dataset supports:

- CSV for spreadsheet import;
- Excel for business review;
- JSON for APIs and warehouses;
- XML and RSS for compatible tools;
- Google Sheets and Make through Apify integrations;
- webhooks for downstream processing after a run finishes.

Use `osmType` plus `osmId` as the durable compound key in your destination.
Use `retrievedAt` as snapshot provenance, not as the feature's edit timestamp.

### Run through the Apify API

Replace `<APIFY_TOKEN>` with your token.

#### cURL

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/automation-lab~india-healthcare-directory-by-pin/runs?token=<APIFY_TOKEN>&waitForFinish=600" \
  -H "Content-Type: application/json" \
  -d '{"pinCodes":["500001"],"categories":["hospital","pharmacy"],"radiusKm":1,"maxItems":20}'
```

#### JavaScript

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('automation-lab/india-healthcare-directory-by-pin').call({
  pinCodes: ['500001'],
  categories: ['hospital', 'pharmacy'],
  radiusKm: 1,
  maxItems: 20,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient(token='<APIFY_TOKEN>')
run = client.actor('automation-lab/india-healthcare-directory-by-pin').call(
    run_input={
        'pinCodes': ['500001'],
        'categories': ['hospital', 'pharmacy'],
        'radiusKm': 1,
        'maxItems': 20,
    }
)
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)
```

### Use with MCP and AI agents

#### Claude Code setup

Add the Apify MCP server to Claude Code:

```bash
claude mcp add --transport http apify \
  "https://mcp.apify.com?tools=automation-lab/india-healthcare-directory-by-pin"
```

#### Claude Desktop setup

Claude Desktop can use this MCP configuration:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=automation-lab/india-healthcare-directory-by-pin"
    }
  }
}
```

#### Cursor setup

Add the same JSON MCP server URL in **Cursor Settings → MCP**.

#### VS Code setup

Add the same server URL to your VS Code MCP configuration or use the Apify MCP
extension's server settings.

#### Example prompts

- “Run the India healthcare directory for PIN 500001 and return hospitals.”
- “Find pharmacies around Mumbai PIN 400001 and save at most 15 records.”
- “Build a hospital dataset for PINs 110001 and 700001.”

Review source links before using agent-produced conclusions.

### Data quality and limitations

OpenStreetMap is community-maintained. Coverage, names, addresses, categories,
and contacts vary by place and date.

Important limits:

- the search area is a radius around a geocoded PIN centroid;
- it is not an official postal-boundary dataset;
- a nearby record may have a different mapped postal code;
- some valid healthcare facilities are absent from OSM;
- unnamed features are excluded because they are not useful directory rows;
- ways receive a calculated center from their available nodes;
- relations are not emitted in the current version;
- public OSM services may rate-limit or have temporary outages;
- a successful empty dataset can mean no named supported records were mapped in
  that radius.

Do not describe the output as every hospital or pharmacy in a PIN area without
independent coverage validation.

### Reliability and retries

The Actor retries transient network errors and HTTP 429/5xx responses with
bounded backoff. It does not blindly retry invalid input or deterministic client
errors.

Requests run sequentially. If an upstream public service remains unavailable,
the run fails rather than returning a misleading partial success for that PIN.
Retry later or split a large PIN batch into smaller Tasks.

### Legality and responsible use

The output derives from OpenStreetMap data, available under the Open Database
License (ODbL). Follow OpenStreetMap attribution and share-alike requirements
that apply to your use and produced databases.

Only use public contact fields for lawful purposes. Comply with applicable
privacy, marketing, healthcare, and anti-spam rules. A mapped phone or email is
not consent for unsolicited outreach. Verify important records with the linked
source and, when necessary, the facility's official website.

### Troubleshooting

#### A PIN is rejected

Use exactly six digits. Indian PIN codes cannot begin with zero. Send strings,
not shortened numeric values.

#### A valid PIN cannot be resolved

Confirm the PIN and retry later. Nominatim data or availability can change. The
Actor fails clearly when no Indian location is returned.

#### The dataset is empty

Increase the radius gradually up to 1.5 km, select both categories, and inspect
OpenStreetMap near the PIN. Empty results can be accurate when no named feature
with a hospital/pharmacy tag exists in the bounded area.

#### The mapped PIN differs from my input

`requestedPinCode` identifies the search center. `pinCode` comes from the
feature's OSM `addr:postcode`. A feature can lie near the centroid but carry a
neighbouring PIN, or have no mapped PIN.

#### A contact field is null

The source feature does not currently provide that public tag. The Actor does
not guess, scrape unrelated websites, or purchase contact enrichment.

#### A run times out

Reduce the number of PIN codes, radius, or `maxItems`. Run several smaller Tasks
instead of one dense batch.

### FAQ

#### Does this use Google Maps?

No. It uses public OpenStreetMap Nominatim and map data.

#### Does it require an OSM API key?

No API key is required for the bounded public endpoints used by this Actor.

#### Can it search doctors or clinics?

The product contract is hospitals and pharmacies. It does not expose a doctor
or general-clinic category.

#### Are the results verified businesses?

They are source-attributed public OSM features, not independently verified
business records. Use `osmUrl` and official sources for critical validation.

#### Can I monitor changes?

Schedule recurring Apify Tasks and compare datasets using `osmType` and `osmId`.
This Actor creates current snapshots; it does not emit a change report.

#### Why is the radius limited?

A bounded area protects public source services, controls response size, and
keeps local processing reliable. Use multiple nearby PINs for broader coverage.

### Related Automation Lab Actors

- [OpenStreetMap POI Extractor](https://apify.com/automation-lab/openstreetmap-poi-extractor) — worldwide location, bounding-box, category, and custom Overpass workflows.
- [CSV & Excel Data Quality Cleaner](https://apify.com/automation-lab/csv-excel-data-quality-cleaner) — normalize and validate exported tabular datasets.

Use the PIN-specific Actor for Indian healthcare directory jobs; use the generic
POI extractor when your category or geographic input is outside this contract.

# Actor input Schema

## `pinCodes` (type: `array`):

One to 25 six-digit Indian postal PIN codes. Each PIN is geocoded to a search center.

## `categories` (type: `array`):

Choose hospitals, pharmacies, or both.

## `radiusKm` (type: `number`):

Search radius around the PIN centroid. Public OSM postal boundaries vary, so the output includes both requestedPinCode and any mapped addr:postcode.

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

Maximum unique healthcare records saved across all PIN codes.

## Actor input object example

```json
{
  "pinCodes": [
    "500001"
  ],
  "categories": [
    "hospital",
    "pharmacy"
  ],
  "radiusKm": 1,
  "maxItems": 20
}
```

# Actor output Schema

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

Default dataset containing normalized hospital and pharmacy records.

# 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 = {
    "pinCodes": [
        "500001"
    ],
    "categories": [
        "hospital",
        "pharmacy"
    ],
    "radiusKm": 1,
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/india-healthcare-directory-by-pin").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 = {
    "pinCodes": ["500001"],
    "categories": [
        "hospital",
        "pharmacy",
    ],
    "radiusKm": 1,
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/india-healthcare-directory-by-pin").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 '{
  "pinCodes": [
    "500001"
  ],
  "categories": [
    "hospital",
    "pharmacy"
  ],
  "radiusKm": 1,
  "maxItems": 20
}' |
apify call automation-lab/india-healthcare-directory-by-pin --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automation-lab/india-healthcare-directory-by-pin"
        }
    }
}

```

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/1Sy7WEguZmoSP3rYh/builds/bjc4W3t5vybaFQgZC/openapi.json
