# OpenStreetMap Local Business Extractor — $2/1k places (`toolkitlabs/osm-local-business-extractor`) Actor

Local-business records from OpenStreetMap via the Overpass API: name, category, address, phone, website, opening hours, coordinates. ODbL, attributed on every row.

- **URL**: https://apify.com/toolkitlabs/osm-local-business-extractor.md
- **Developed by:** [Toolkit Labs](https://apify.com/toolkitlabs) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 place extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## OpenStreetMap Local Business Extractor — $2/1k places

Local-business records from **OpenStreetMap**, normalised into one flat row per business.

**Price: $0.002 per business record returned — $2 per 1,000.** Pay-per-event: a run that returns
no usable record charges nothing, and the row cap you set is the ceiling on what you can spend.

Give it an area (a place name or a bounding box) and one or more OSM category tags. It runs a
single Overpass query and returns clean rows — no HTML, no duplicated tag namespaces.

### What one row looks like

```json
{
  "name": "Tandartspraktijk Centrum",
  "category": "amenity=dentist",
  "lat": 52.3702,
  "lon": 4.8952,
  "address": "Damstraat 12, 1012 JM Amsterdam",
  "phone": "+31 20 555 0100",
  "website": "www.example.nl",
  "email": "",
  "opening_hours": "Mo-Fr 08:00-17:00",
  "osm_type": "node",
  "osm_id": 123456789,
  "permalink": "www.openstreetmap.org/node/123456789",
  "license": "ODbL-1.0",
  "attribution": "© OpenStreetMap contributors",
  "source": "OpenStreetMap via Overpass API"
}
```

`phone` prefers the bare `phone` tag and falls back to `contact:phone`; `website` and `email`
behave the same way. `address` is assembled from the `addr:*` tags. `website` is reproduced exactly as OSM has it, normally including the scheme; the sample above is abbreviated. Records with no `name` tag
are dropped rather than shipped as blanks.

### Input

| field | type | meaning |
|---|---|---|
| `place` | string | Area to search, resolved through Nominatim. Ignored when `bbox` is given. |
| `bbox` | `[south, west, north, east]` | Exact area in degrees. |
| `categories` | string list | OSM tags: `amenity=dentist`, `shop=hairdresser`, `office=*`. |
| `maxResults` | integer | Row cap, 1–1000. |

### Every run publishes its own fill rate

OSM coverage is uneven, so this actor measures itself instead of asking you to trust a claim. The
last item in each dataset is a `run_summary` row:

```json
{
  "record_type": "run_summary",
  "records": 23,
  "query_area": "Delft",
  "fill_rate": {
    "records": 23,
    "fields": {
      "phone":         {"tagged": 9,  "total": 23, "rate": 0.391},
      "website":       {"tagged": 11, "total": 23, "rate": 0.478},
      "email":         {"tagged": 3,  "total": 23, "rate": 0.13},
      "address":       {"tagged": 20, "total": 23, "rate": 0.87},
      "opening_hours": {"tagged": 12, "total": 23, "rate": 0.522}
    }
  }
}
```

Those numbers are illustrative of the shape, not of your area — the row you get back is computed
from your own run's rows, field by field, and it is the number to judge the result by. The same
object is printed to the run log as `[fill_rate] {...}`. It is not charged: only business records
are billed.

### Licence and attribution — please read

The data is **OpenStreetMap**, licensed **ODbL 1.0** (www.openstreetmap.org/copyright).
Every row carries `license` and `attribution` fields, and the actor refuses to write a row that
does not. If you publish or redistribute this data, or anything derived from it, you must keep the
attribution **© OpenStreetMap contributors** and honour the ODbL's share-alike terms. Do not strip
those fields.

The code is CC0-1.0. The data is not — the licence travels with it.

### Honest limitations

- **OSM coverage varies by region and by category.** In some cities most businesses are mapped with
  phone and opening hours; elsewhere you will get a name and a location and little else. This is
  thinner than a commercial POI database and is not claimed to be equivalent to one.
- **Contact details are only what OSM already publishes.** Nothing is enriched, guessed, or looked
  up on a second site. No email pattern generation.
- Empty strings mean "not present in OSM", not "does not exist".
- The public Overpass endpoint is a volunteer service. This actor issues **one** query per run,
  sequentially, with a descriptive User-Agent and exponential backoff on 429/504, and caps results
  at 1000 (operations.osmfoundation.org/policies/api). For large-scale extraction, run
  your own Overpass instance from a Geofabrik regional extract rather than increasing the run rate.
- Ways are returned by their centre point (`out center`), not their full geometry.

# Actor input Schema

## `place` (type: `string`):

A place to search, e.g. 'Amsterdam' or 'Cork, Ireland'. Resolved to a bounding box through Nominatim. Ignored when bbox is set.

## `bbox` (type: `array`):

Exact search area in WGS84 degrees. Takes precedence over the place name.

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

One or more OpenStreetMap tags, e.g. amenity=dentist, shop=hairdresser, office=\* (wildcard matches any value).

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

Upper bound on rows returned (hard cap 1000, to stay inside the Overpass fair-use policy).

## Actor input object example

```json
{
  "place": "Amsterdam",
  "bbox": [
    52.35,
    4.85,
    52.4,
    4.95
  ],
  "categories": [
    "amenity=dentist"
  ],
  "maxResults": 50
}
```

# Actor output Schema

## `businesses` (type: `string`):

One dataset item per named business: name, category, address, phone, website, email, opening hours, coordinates, OSM permalink, and the ODbL licence and attribution.

# 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 = {
    "bbox": [
        52.35,
        4.85,
        52.4,
        4.95
    ],
    "categories": [
        "amenity=dentist"
    ],
    "maxResults": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("toolkitlabs/osm-local-business-extractor").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 = {
    "bbox": [
        52.35,
        4.85,
        52.4,
        4.95,
    ],
    "categories": ["amenity=dentist"],
    "maxResults": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("toolkitlabs/osm-local-business-extractor").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 '{
  "bbox": [
    52.35,
    4.85,
    52.4,
    4.95
  ],
  "categories": [
    "amenity=dentist"
  ],
  "maxResults": 50
}' |
apify call toolkitlabs/osm-local-business-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,toolkitlabs/osm-local-business-extractor"
        }
    }
}

```

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/W5OPJGppIEKYGJQnw/builds/x0dpfswMd7w46vQCh/openapi.json
