# Open Brewery DB Scraper (`devilscrapes/open-brewery-db-scraper`) Actor

Query the Open Brewery DB public API by city, state, country, postal code, brewery type, name, or lat/lng radius and get clean, typed brewery, cidery, and brewpub rows. No manual paging, no six-param juggling, no empty-vs-exhausted guesswork.

- **URL**: https://apify.com/devilscrapes/open-brewery-db-scraper.md
- **Developed by:** [DevilScrapes](https://apify.com/devilscrapes) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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/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

<div align="center">
  <img src=".actor/icon.svg" width="160" alt="Devil Scrapes mark" />

## Open Brewery DB Scraper

**$2.20 / 1 000 results**  ·  pay only for results  ·  no credit card to try

*We do the dirty work so your dataset stays clean.* 😈

Turn the Open Brewery DB public API into one clean, queryable dataset. Pick a city, state, country, brewery type, name, postal code, or lat/lng radius — and get back typed rows with location and contact fields for every matching brewery, cidery, and brewpub. No manual paging, no six-param juggling, no guesswork about whether a search came up empty or the Actor broke.

</div>

***

### 🎯 What this scrapes

Open Brewery DB is a free, keyless, no-auth JSON API listing breweries, cideries, and brewpubs. It is genuinely useful — but its raw shape is not friendly to a one-off integration: results cap at 200 rows per page, there are six separate `by_*` filter params spread across list and search endpoints, and telling "this filter matched nothing" apart from "the page paging just ended early" requires a second call to a `meta` endpoint most integrators never discover.

This Actor collapses all of that into one input form. Pick a search mode — city, state, country, brewery type, name, postal code, or lat/lng distance — and it pages the API on your behalf, validates every record against a typed schema, and hands you back a clean dataset. It also tells the difference, in plain language, between "your filter matched zero breweries" and "the source ran out before your max results cap" — two very different outcomes that look identical if you only watch a row count.

### 🔥 What we handle for you

- 🔁 **Automatic pagination** — Open Brewery DB caps every request at 200 rows. We page through to your `maxResults` limit or until the source is exhausted, and merge the results transparently.
- 🧱 **Rate-limit-aware backoff** — on `408`/`429`/`503` responses we back off exponentially and honour `Retry-After` headers, retrying up to 5 times before surfacing an error.
- 🧊 **Pydantic-validated rows** — every record is typed at write time. A single malformed record is skipped and logged, never crashes the run.
- ✅ **Honest empty results** — a search mode that genuinely matches nothing finishes successfully with a status message naming the exact filter or query that came up empty — it is never confused with a broken run.
- 🌐 **Proxy-ready** — an optional Apify Proxy pass-through is available if your network needs it; the public API itself needs no authentication or rotation.
- 💰 **Pay-Per-Event pricing** — you pay only for records that land in your dataset, plus a small run warm-up fee.

### 💡 Use cases

- **Hospitality lead-gen lists** — pull every brewery, cidery, or brewpub in a city or state and load contact details straight into your outreach pipeline.
- **Beverage distributor territory mapping** — filter by state, city, or postal code to plan sales coverage and route planning.
- **POS / CRM vendor onboarding** — populate a venue database for a beverage-industry product without hand-rolling API paging.
- **Craft-beer travel and tourism apps** — build a location-searchable brewery directory using the lat/lng radius search mode.
- **Market research** — count and map brewery density by state, country, or brewery type (micro, brewpub, regional, etc.).

### ⚙️ How to use it

1. Click **Try for free** — no credit card required.
2. Pick a **Search mode**: `city`, `state`, `country`, `type`, `postal`, `name`, `dist`, or `all`.
3. Fill in the matching field for that mode — e.g. `byCity` for `city` mode, or both `byDistLat`/`byDistLng` for `dist` mode.
4. Set **Max results** — the row cap across all pages.
5. Click **Start**. Results stream into the dataset in real time.
6. Export from **Storage → Dataset** as JSON, CSV, or Excel.

### 📥 Input

| Field | Type | Required | Default | Notes |
|---|---|:--:|---|---|
| `searchMode` | `string` | yes | `all` | `city` / `state` / `country` / `type` / `postal` / `name` / `dist` / `all` |
| `byCity` | `string` | iff `searchMode=city` | — | City name |
| `byState` | `string` | iff `searchMode=state` | — | State or province name |
| `byCountry` | `string` | iff `searchMode=country` | — | Country name |
| `byPostal` | `string` | iff `searchMode=postal` | — | Postal / ZIP code |
| `byType` | `string` | iff `searchMode=type` | — | `micro` / `nano` / `regional` / `brewpub` / `large` / `planning` / `bar` / `contract` / `proprietor` / `closed` |
| `searchQuery` | `string` | iff `searchMode=name` | — | Free-text brewery name search |
| `byDistLat` | `number` | iff `searchMode=dist` | — | Latitude, -90..90 |
| `byDistLng` | `number` | iff `searchMode=dist` | — | Longitude, -180..180 |
| `maxResults` | `integer` | no | `500` | Row cap across all pages, 1-10 000 |
| `proxyConfiguration` | `object` | no | `{"useApifyProxy": false}` | Optional Apify Proxy pass-through |

```json
{
  "searchMode": "city",
  "byCity": "San Diego",
  "maxResults": 500,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### 📤 Output

One row per brewery, cidery, or brewpub record.

```json
{
  "id": "5128df48-79fc-4f0f-8b52-d06be54d0cec",
  "name": "(405) Brewing Co",
  "brewery_type": "micro",
  "address_1": "1716 Topeka St",
  "address_2": null,
  "address_3": null,
  "city": "Norman",
  "state_province": "Oklahoma",
  "postal_code": "73069-8224",
  "country": "United States",
  "longitude": -97.46818222,
  "latitude": 35.25738891,
  "phone": "4058160490",
  "website_url": "http://www.405brewing.com",
  "state": "Oklahoma",
  "street": "1716 Topeka St"
}
```

### 💰 Pricing

Pay-Per-Event — pay only for what lands in your dataset.

| Event | Price | Trigger |
|---|---|---|
| Actor start | $0.20 | Once per run |
| Result | $0.002 | Per brewery record written |

At 1,000 results: `$0.20 + 1000 × $0.002 = $2.20`.

### 🚧 Limitations

- Covers only what Open Brewery DB itself covers — it does not include venues the source doesn't track, and it carries no beer/menu/tap-list data, only venue records.
- Only the current record per `id` — no historical/versioned data.
- Free-text `byCountry`/`byState` values are passed through unmodified; a near-miss spelling can genuinely return zero rows (the status message will name exactly what was searched).

### ❓ FAQ

**Does this need an API key?**
No — Open Brewery DB is a free, keyless public API, and this Actor is keyless too.

**What happens if my filter matches nothing?**
The run finishes successfully with zero rows and a status message naming the exact filter or query that matched nothing. That is a valid outcome, not a failure.

**Can I search by radius around a coordinate?**
Yes — use `searchMode: "dist"` with `byDistLat`/`byDistLng`. Results come back in the source's distance-sorted order.

**How current is the data?**
Rows reflect Open Brewery DB's live API response at run time; it is a community-maintained open-data project, updated on its own schedule.

### 🙋 Your feedback

Found a brewery-type edge case or a field that doesn't map cleanly? Open an issue on the Actor's Apify Store page or reach out via [DevilScrapes on Apify](https://apify.com/DevilScrapes) — we read every report.

# Actor input Schema

## `searchMode` (type: `string`):

Which filter drives the query. Each mode (other than <code>all</code>) needs its matching field below filled in.

## `byCity` (type: `string`):

City name. Required when <code>searchMode</code> is <code>city</code>.

## `byState` (type: `string`):

State or province name, e.g. <code>California</code>. Required when <code>searchMode</code> is <code>state</code>.

## `byCountry` (type: `string`):

Country name, e.g. <code>United States</code>. Required when <code>searchMode</code> is <code>country</code>.

## `byPostal` (type: `string`):

Postal / ZIP code. Required when <code>searchMode</code> is <code>postal</code>.

## `byType` (type: `string`):

Brewery type filter. Required when <code>searchMode</code> is <code>type</code>.

## `searchQuery` (type: `string`):

Free-text search against brewery names. Required when <code>searchMode</code> is <code>name</code>.

## `byDistLat` (type: `number`):

Latitude, -90..90. Required together with <code>byDistLng</code> when <code>searchMode</code> is <code>dist</code>.

## `byDistLng` (type: `number`):

Longitude, -180..180. Required together with <code>byDistLat</code> when <code>searchMode</code> is <code>dist</code>.

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

Maximum number of brewery rows to return across all pages.

## `proxyConfiguration` (type: `object`):

Apify Proxy settings. Open Brewery DB is a public, keyless API with no anti-bot layer observed; direct routing is fine for most runs. A supplied proxy is honoured for routing only.

## Actor input object example

```json
{
  "searchMode": "city",
  "byCity": "San Diego",
  "maxResults": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

Full set of scraped brewery records — one item per venue. Streamed JSON via the Apify dataset API.

## `datasetItemsCsv` (type: `string`):

Same data, CSV export. Drop straight into a spreadsheet or CRM loader.

## `datasetView` (type: `string`):

Open the run's dataset in the Console with the Overview view applied.

# 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 = {
    "searchMode": "city",
    "byCity": "San Diego",
    "maxResults": 5,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("devilscrapes/open-brewery-db-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 = {
    "searchMode": "city",
    "byCity": "San Diego",
    "maxResults": 5,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("devilscrapes/open-brewery-db-scraper").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 '{
  "searchMode": "city",
  "byCity": "San Diego",
  "maxResults": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call devilscrapes/open-brewery-db-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devilscrapes/open-brewery-db-scraper"
        }
    }
}

```

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/FMbqIao5TMDvPyaOb/builds/E4lpV3Nl6P8r3wTaU/openapi.json
