# US TTB Wine & Spirits Permit Intelligence (`afkdigital/us-ttb-wine-spirits-permit-intelligence`) Actor

Search official TTB wine producer and spirits producer/bottler public permits. Filter by state, permit type, ZIP and owner/DBA; export JSON or CSV.

- **URL**: https://apify.com/afkdigital/us-ttb-wine-spirits-permit-intelligence.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.50 / 1,000 unique permit records

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## US TTB Wine & Spirits Permit Intelligence

Get filterable, deduplicated federal permit records from the **official TTB List of Permittees** public files. Built for supplier research, permit-holder matching and structured CRM workflows in Clay or n8n.

### What this Actor returns

Only these two official lists are processed:

- **Wine Producer Permit List** — source industry type: `Wine Producer`.
- **Spirits Producers and Bottlers List** — source industry type: `Distilled Spirits Plant`.

The permit holder may be an individual or business. A permit is not automatically a consumer brand, a distinct physical production facility, or proof of current production. Names containing "brewing" may hold a wine permit; that does not turn the source into a brewery directory.

**No brewery list is included.** TTB says it does not publish lists of brewers, industrial alcohol producers/users or tobacco permit holders in this source. Importer, wholesaler and Puerto Rico consolidated lists are outside this Actor's selected list scope. Puerto Rico or other territories appear only if represented in the selected wine/spirits files.

Source: [TTB List of Permittees](https://www.ttb.gov/public-information/foia/list-of-permittees).
TTB describes weekly updates; actual freshness follows the agency, not the run date. The file URL path can contain an old year/month while its contents are current.

### Quick start

```json
{"state":"CA","permitType":"wine","zipCode":"","companyName":"","maxResults":25}
```

Select **Start**, then download the Dataset as JSON or CSV. No TTB API key, login, browser or proxy is required.

| Input | Meaning |
| --- | --- |
| state | Optional two-letter US state/territory, case-insensitive |
| permitType | all (default), wine, or spirits |
| zipCode | Optional exact 5-digit ZIP or ZIP+4; 5 digits include that ZIP's +4 values |
| companyName | Case-insensitive substring in owner or operating/DBA name |
| maxResults | 1–10000 unique permit records; default 25 |

Filters combine with **AND**. Empty strings disable optional filters. Unknown inputs, malformed ZIPs, unsupported permit types and invalid limits fail before downloading.

### Output and official data dictionary

TTB's [consolidated public JSON](https://www.ttb.gov/system/files/2025-04/FRL_All_Permits.json) includes a **Definitions** array. The current CSV files expose the same ten documented columns. This Actor maps them as follows:

| Output | Official column / handling |
| --- | --- |
| permit_number | Permit_Number — primary permit identifier |
| registry_number | null; no registry field in current files |
| owner_company_name | Owner_Name — individual or business holding the permit |
| operating_trade_name_dba | Operating_Name — operating/Doing Business As name |
| street_address | Street — premise street address, preserved |
| city_state_zip | City + State + Prem_Zip, formatting only |
| county | Prem_County — submitted by permit holder; TTB warns it may not reflect the actual premises county |
| permit_type | Industry_Type, preserved verbatim |
| city / state / zip_code | City / State / Prem_Zip, preserved as strings |
| new_permit_flag | New_Permit_Flag: 0=false, 1=true, otherwise null; TTB defines newly issued as less than 7 days |
| permit_status | null in current files; only populated if an explicit Status/Permit_Status column is published |
| permit_date | null in current files; only populated from an explicit Permit_Date/Issue_Date column |
| source_url | Exact official CSV used |
| source_updated_at | TTB page's “Data as of” date (YYYY-MM-DD), or null if unavailable |
| fetched_at | UTC time this run fetched the CSV |

Blank values are null. No geocoding, address repair, brand enrichment, live-operation classification or status inference is performed. Leading-zero ZIP strings and ZIP+4 values are preserved. The SUMMARY record adds source hashes, byte/row counts and HTTP Last-Modified without treating HTTP metadata as a permit issue date.

### Pricing and limits

**$0.0055 per successfully saved unique permit record ($5.50 per 1,000).**

The sole chargeable event is `permit-record`. There is no start fee, separate dataset-item fee, or additional platform-usage charge for standard runs. Charges are triggered only after saving deduplicated results to the Dataset. Source download retries, duplicate permits, errors before saving and zero-result searches do not trigger a result charge.

A separate new run requesting the same permits is a new delivery and is charged again. Within a run, the permit number is the identity. On restart/resurrection, already saved permit numbers are skipped and are never charged again; a crash between saving and billing can leave a free record. Billing retries use a deterministic idempotency key for each saved batch.

Set Apify's **maximum run charge** as well as maxResults. The Actor checks both before output and does not deliberately exceed either. Default 25 results cost at most **$0.1375** in event fees. Downloads are restricted to official TTB HTTPS hosts, up to 8 MiB per CSV, at most three attempts, 20-second socket timeouts and a shared download deadline. The Actor stops adding batches after approximately 210 seconds; the default platform timeout is 240 seconds. Very large requests can return a partial set with `stop_reason=runtime_limit` in SUMMARY.

### JSON / CSV for Clay and n8n

1. Run the Actor using the input above (Apify integration or HTTP request).
2. Read the finished run's `defaultDatasetId`.
3. Request `https://api.apify.com/v2/datasets/DATASET_ID/items?format=json&clean=true`, or change format to `csv`.
4. Map permit_number as the stable key; keep owner and DBA as separate columns.

Use an Authorization Bearer header for private API access. Do not paste tokens into input fields or publicly shared URLs. The Output tab links to JSON, CSV and the source manifest. Apify Dataset API access follows your account/storage permissions.

### Reliability and limitations

Current source schema and official definition mapping are checked at release. A missing download link, unexpected industry label, invalid CSV or changed required columns fails visibly. No stale bundled records are silently substituted. Addresses and counties are agency-published values, not independently verified. Missing permits do not establish cancellation or closure. This is an independent AFK Mesh data-processing Actor and is not affiliated with TTB.

Source snapshots checked on 2026-10-30: 18,121 wine rows and 5,572 spirits rows, both dated 2026-10-26. These counts are validation evidence, not a promise of future coverage.

### Development

Python 3.13; Apify SDK 4.2.0. HTTP/CSV only.
Run `python -m unittest discover -s tests -v`.
Real-file integration checks: `python tools/integration.py`.
Actor implementation version: **1.0.0**.

# Actor input Schema

## `state` (type: `string`):

Optional two-letter US state or territory abbreviation, e.g. CA, KY or PR.

## `permitType` (type: `string`):

wine = Wine Producer; spirits = Distilled Spirits Plant, including the source's producers and bottlers list. No brewery list.

## `zipCode` (type: `string`):

Optional exact five-digit ZIP or ZIP+4. Five digits also match that ZIP's +4 values. Keep leading zeros.

## `companyName` (type: `string`):

Optional case-insensitive substring in Owner_Name or Operating_Name. Does not search brands.

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

Hard output limit per run, 1–10000. The run's spending limit may reduce this further. Default 25 costs at most $0.1375 in event fees.

## Actor input object example

```json
{
  "state": "",
  "permitType": "all",
  "zipCode": "",
  "companyName": "",
  "maxResults": 25
}
```

# Actor output Schema

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

No description

## `csv` (type: `string`):

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/us-ttb-wine-spirits-permit-intelligence").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/us-ttb-wine-spirits-permit-intelligence").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 '{}' |
apify call afkdigital/us-ttb-wine-spirits-permit-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/us-ttb-wine-spirits-permit-intelligence"
        }
    }
}
```

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/80eevqN5n2CwpD3o2/builds/jrQAZlNkEZlVFLF9Q/openapi.json
