# Municode Ordinances & Municipal Code Scraper by City (`talcoe/municode-ordinances`) Actor

Search municipal code sections and adopted ordinances from Municode Library by city and keyword, with full section text, source links and codification dates, billed per result.

- **URL**: https://apify.com/talcoe/municode-ordinances.md
- **Developed by:** [M Usama](https://apify.com/talcoe) (community)
- **Categories:** Business, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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

### What does Municode Ordinances & Municipal Code Scraper do?

It searches the Municode Library for the cities you choose and returns municipal code sections and adopted ordinances as clean, structured records. Each record has the city, title, section number, chapter path, a keyword snippet, the full section text, a direct link, and the date the code was last updated. Filters keep runs small, and pricing is per result.

### Data source

The Actor reads the public JSON API behind library.municode.com, the same data the website shows to any visitor, so results match the current published code of each city.

### Why use it?

- Compliance and legal research: pull every section that mentions "short term rental", "setback" or "signage" across several cities in one run.
- Real estate and development: compare zoning rules between municipalities.
- Monitoring: schedule a run and track new ordinances adopted since last time (use `ordinanceYearFrom` and the stable `id`).
- It replaces copying sections by hand out of the Municode web viewer.

### How to use it

1. Open the Actor and enter your cities as "City, ST" plus a search phrase.
2. Click Start. Download results as JSON, CSV or Excel, or read them through the API.
3. Add a Schedule and an Integration (Slack, Google Sheets, webhook) to get new records automatically.

### Input

| Field | Description |
|---|---|
| `cities` | List of cities written as "City, ST", for example "Austin, TX". The city must have a Municode library. |
| `searchText` | Keyword or phrase searched in the code and ordinances. Leave empty to list everything. |
| `contentTypes` | `BOTH`, `CODES` (code sections) or `ORDINANCES` (adopted ordinances). |
| `includeFullText` | Fetch the full text of each code section. Off gives snippets only and runs faster. |
| `ordinanceYearFrom` | Skip ordinances adopted before this year. 0 keeps all. |
| `maxResults` | Hard stop for the run. You are billed per result, so this caps the cost. |
| `proxyConfiguration` | Apify proxy is recommended for larger runs. |

Example input:

```json
{
    "cities": ["Abilene, TX", "Austin, TX"],
    "searchText": "zoning",
    "contentTypes": "BOTH",
    "includeFullText": true,
    "maxResults": 50
}
```

### Output

Every record has the same shape:

```json
{
    "id": "942:CODES:PTICH_ARTVIPLZO_S83PLZOCORECO",
    "type": "code",
    "city": "Abilene",
    "state": "TX",
    "title": "Sec. 83. - Planning and zoning commission, Created; composition.",
    "sectionNumber": "83",
    "path": "PART I - CHARTER > ARTICLE VI. - PLANNING AND ZONING",
    "year": null,
    "snippet": "There shall be established a planning and zoning commission which shall consist of seven (7) citizens...",
    "text": "There shall be established a planning and zoning commission ...",
    "url": "https://library.municode.com/tx/abilene/codes/code_of_ordinances?nodeId=PTICH_ARTVIPLZO_S83PLZOCORECO",
    "nodeId": "PTICH_ARTVIPLZO_S83PLZOCORECO",
    "codeVersion": "Supplement 14",
    "codeLastUpdated": "2026-07-20T12:32:50.000Z",
    "codifiedThrough": "Ordinance No. 47-2026, enacted May 28, 2026.",
    "scrapedAt": "2026-10-13T08:40:19.001Z"
}
```

| Field | Meaning |
|---|---|
| `id` | Stable key, safe for deduplication between runs |
| `type` | `code` for a code section, `ordinance` for an adopted ordinance |
| `city`, `state` | Municipality as listed on Municode |
| `title`, `sectionNumber` | Section or ordinance heading and its number when present |
| `path` | Chapter and article hierarchy (for ordinances, the adoption year) |
| `year` | Adoption year, ordinances only |
| `snippet` | Text around your keyword match |
| `text` | Full section text (code sections, when `includeFullText` is on) |
| `url` | Link to the item in the Municode Library |
| `codeVersion`, `codeLastUpdated`, `codifiedThrough` | Which supplement of the code the record comes from, when it was updated, and the last ordinance included |

### Pricing

Pay per event: a small fee when a run starts, then a fixed price per result returned. You only pay for records that pass your filters. Set `maxResults` to cap any run.

### Limitations

- Only cities that publish on Municode are covered, and the city name must match the Municode library name.
- Ordinances return the title, year and a snippet. The full ordinance text is only available as a PDF in the web viewer.
- Heading nodes (chapters, articles) can come back with empty text because the text lives in their child sections.
- Results are capped by `maxResults` and follow Municode's own ranking.

### FAQ

**Is this legal?** The Actor reads listings the site publishes for any visitor without a login and stores only business information published for that purpose. You are responsible for how you use the data.

**Something is missing or broken?** Open an issue in the Issues tab; response time is usually under a day.

# Actor input Schema

## `cities` (type: `array`):

Cities with a Municode library, written as "City, ST" (for example "Austin, TX"). Every city is searched.

## `searchText` (type: `string`):

Keyword or phrase searched inside the code and ordinances, for example "short term rental". Leave empty to list everything.

## `contentTypes` (type: `string`):

Municipal code sections, adopted ordinances, or both.

## `includeFullText` (type: `boolean`):

Fetch the complete text of each code section (one extra request per result). Turn off for faster runs with snippets only.

## `ordinanceYearFrom` (type: `integer`):

Skip ordinances adopted before this year. 0 keeps all.

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

Hard stop for the run. You are billed per result, so this caps the cost.

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

Apify proxy is recommended for larger runs.

## Actor input object example

```json
{
  "cities": [
    "Abilene, TX",
    "Austin, TX"
  ],
  "searchText": "zoning",
  "contentTypes": "BOTH",
  "includeFullText": true,
  "ordinanceYearFrom": 0,
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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 = {
    "cities": [
        "Abilene, TX",
        "Austin, TX"
    ],
    "searchText": "zoning",
    "contentTypes": "BOTH",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("talcoe/municode-ordinances").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 = {
    "cities": [
        "Abilene, TX",
        "Austin, TX",
    ],
    "searchText": "zoning",
    "contentTypes": "BOTH",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("talcoe/municode-ordinances").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 '{
  "cities": [
    "Abilene, TX",
    "Austin, TX"
  ],
  "searchText": "zoning",
  "contentTypes": "BOTH",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call talcoe/municode-ordinances --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,talcoe/municode-ordinances"
        }
    }
}
```

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/0bvfVjU7afdDMblWY/builds/tG9g9yTgkoxAb3qSh/openapi.json
