---
type: "firecrawl-provider"
description: "San Francisco's open data portal (data.sf.gov, a Socrata site): search the dataset catalog, read a dataset's metadata and columns, query and count rows of any dataset with SoQL ($select/$where/$order/$group/$q and bare field filters, including spatial functions), and list the portal's category and tag facets."
use_when: "San Francisco's open data portal (data.sf.gov, a Socrata site): search the dataset catalog, read a dataset's metadata and columns, query and count rows of any dataset with SoQL ($select/$where/$order/$group/$q and bare field filters, including spatial functions), and list the portal's category and tag facets."
categories: "Public records"
capabilities: 5
credits_per_call: 5
---
# DataSF open data portal on Firecrawl Alexandria

San Francisco's open data portal (data.sf.gov, a Socrata site): search the dataset catalog, read a dataset's metadata and columns, query and count rows of any dataset with SoQL ($select/$where/$order/$group/$q and bare field filters, including spatial functions), and list the portal's category and tag facets.

- Categories: Public records
- Category index: [Public records category](https://firecrawl.dev/alexandria/agents/categories/public-records)
- Provider key: `data-sf-gov`
- Access: Firecrawl credits
- Cost: 5 credits per call

## More

- [Human guide](https://firecrawl.dev/app/alexandria/data-sf-gov)
- [OpenAPI spec](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/openapi.json)

## Capabilities

- [Dataset](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/dataset): Metadata and the column list of one DataSF asset from /api/views/<4x4>.json: name, description, category, tags, attribution, license, provenance, creation/update timestamps, publishing department and frequency, custom metadata fields, and every column with its SoQL field_name (which can differ from the display name and may be truncated to 10 characters on legacy imports), datatype (text, number, calendar_date, point, multipolygon ...), description and cached value statistics (counts and top values). Also returns the landing source_url and the SODA api_url. Unknown ids are not_found.
- [Datasets](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/datasets): Search the DataSF catalog through the Socrata Discovery API (search_context=data.sf.gov): free-text query, asset type, category, tags and sort order, or look up one asset by its 4x4 id. Each result carries the 4x4 dataset id, name, type (dataset, map, filter, href, chart, story ...), description, category, tags, timestamps, column field names and datatypes, download and view counts, the landing link, permalink and, for tabular datasets, the SODA api_url to pass to `rows`. Paged by `limit` and an opaque `cursor`. An unknown `dataset_id` is not_found; a query with no match is a successful empty result.
- [Facets](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/facets): The DataSF portal's category or tag facets with asset counts, from the Discovery API domain_categories / domain_tags endpoints scoped to data.sf.gov. Use the values as `category` / `tags` inputs to `datasets`.
- [Row count](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/row_count): Number of rows of a DataSF dataset matching optional `where`, `q` and `filters`, from `$select=count(*)` on the SODA endpoint. Returns the integer count and the exact request URL. An unknown dataset id is not_found; a SoQL error is invalid_input.
- [Rows](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/rows): Query rows of any DataSF dataset through the SODA 2.1 endpoint https://data.sf.gov/resource/<4x4>.json with SoQL: `select` (columns, aggregates such as count(*)), `where` (SoQL predicates incl. like, between, intersects(the_geom,'POINT(lon lat)'), within_circle(point, lat, lon, meters), within_box), `order`, `group`, `q` (full text) and `filters` (bare field=value equality parameters), paged with `limit` (1-50000, default 100) and `cursor` (row offset). Without `order` (and without `group`) the program orders by the row id `:id` so pages are stable. Rows come back exactly as published: numbers and dates are strings, geometry is GeoJSON; `columns` lists the returned field names and Socrata types from the X-SODA2-Fields/Types headers. An unknown dataset id is not_found; a SoQL error (unknown column, bad syntax) is invalid_input carrying the portal's message; an empty page is a successful result with count 0.

## 1. Choose this provider when

San Francisco's open data portal (data.sf.gov, a Socrata site): search the dataset catalog, read a dataset's metadata and columns, query and count rows of any dataset with SoQL ($select/$where/$order/$group/$q and bare field filters, including spatial functions), and list the portal's category and tag facets.

## 2. Minimal request

Call `POST https://api.firecrawl.dev/v2/scrape` with `{ alexandria: { provider, capability, options } }`. For a batch, send `{ alexandria: [...] }` with up to 10 calls.

```json
{
  "provider": "data-sf-gov",
  "capability": "open-data/dataset",
  "options": {
    "dataset_id": "3i4a-hu95"
  }
}
```

## 3. Add provider options

Use only the options needed for the task:

- `dataset_id` (string, required): 4x4 id (for example `3i4a-hu95`) or a portal URL containing it: https://data.sf.gov/d/<id>, .../<Category>/<Name>/<id>, .../resource/<id>.json (data.sfgov.org accepted). Example: `3i4a-hu95`

## 4. Request through your preferred interface

### JavaScript

```javascript
const result = await firecrawl.scrape({
  alexandria: {
    provider: "data-sf-gov",
    capability: "open-data/dataset",
    options: {
      dataset_id: "3i4a-hu95",
    },
  },
});
```

### Python

```python
result = firecrawl.scrape_alexandria({
  "provider": "data-sf-gov",
  "capability": "open-data/dataset",
  "options": {
    "dataset_id": "3i4a-hu95"
  }
})
```

### cURL

```sh
curl https://api.firecrawl.dev/v2/scrape \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "alexandria": {
    "provider": "data-sf-gov",
    "capability": "open-data/dataset",
    "options": {
      "dataset_id": "3i4a-hu95"
    }
  }
}'
```

### CLI

```sh
firecrawl scrape 'data-sf-gov/open-data/dataset' \
  --options '{"dataset_id":"3i4a-hu95"}'
```


### MCP

Call the FCX MCP retrieve tool with this object:

```json
{
  "provider": "data-sf-gov",
  "capability": "open-data/dataset",
  "options": {
    "dataset_id": "3i4a-hu95"
  }
}
```

Ask for only the returned fields needed by the task.

## 5. Full request shape

```json
{
  "provider": "data-sf-gov",
  "capability": "open-data/dataset",
  "options": {
    "dataset_id": "3i4a-hu95"
  }
}
```

## 6. Response data

The response includes `success`, `provider`, `capability`, `creditsCost` and `data`. This example shows the provider payload in `data`:

```json
{
  "api_url": "https://data.sf.gov/resource/3i4a-hu95.json",
  "asset_type": "dataset",
  "attribution": "City and County of San Francisco Planning Department",
  "attribution_link": "https://sfplanning.org/zoning",
  "category": "Geographic Locations and Boundaries",
  "column_count": 7,
  "columns": [
    {
      "cached": null,
      "datatype": "multipolygon",
      "description": "the_geom",
      "field_name": "the_geom",
      "name": "the_geom",
      "position": 1,
      "render_type": "multipolygon"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 1872,
            "value": "RH-1"
          },
          {
            "count": 1454,
            "value": "RH-2"
          },
          {
            "count": 908,
            "value": "RTO-C"
          },
          {
            "count": 795,
            "value": "P"
          },
          {
            "count": 763,
            "value": "NCD"
          },
          {
            "count": 605,
            "value": "RM-1"
          },
          {
            "count": 591,
            "value": "RH-3"
          },
          {
            "count": 584,
            "value": "RH-1(D)"
          },
          {
            "count": 347,
            "value": "NC-1"
          },
          {
            "count": 285,
            "value": "NCT"
          },
          {
            "count": 216,
            "value": "RM-2"
          },
          {
            "count": 180,
            "value": "RM-3"
          },
          {
            "count": 130,
            "value": "RC-4"
          },
          {
            "count": 129,
            "value": "PDR-2"
          },
          {
            "count": 112,
            "value": "UMU"
          },
          {
            "count": 101,
            "value": "C-2"
          },
          {
            "count": 97,
            "value": "PDR-1-G"
          },
          {
            "count": 87,
            "value": "NC-2"
          },
          {
            "count": 85,
            "value": "NC-3"
          },
          {
            "count": 83,
            "value": "RTO-1"
          }
        ]
      },
      "datatype": "text",
      "description": "zoning_sim",
      "field_name": "zoning_sim",
      "name": "zoning_sim",
      "position": 2,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 1872,
            "value": "RESIDENTIAL- HOUSE, ONE FAMILY"
          },
          {
            "count": 1454,
            "value": "RESIDENTIAL- HOUSE, TWO FAMILY"
          },
          {
            "count": 908,
            "value": "RESIDENTIAL TRANSIT ORIENTED DISTRICT - C"
          },
          {
            "count": 795,
            "value": "PUBLIC"
          },
          {
            "count": 605,
            "value": "RESIDENTIAL- MIXED, LOW DENSITY"
          },
          {
            "count": 591,
            "value": "RESIDENTIAL- HOUSE, THREE FAMILY"
          },
          {
            "count": 584,
            "value": "RESIDENTIAL- HOUSE, ONE FAMILY- DETACHED"
          },
          {
            "count": 347,
            "value": "NEIGHBORHOOD COMMERCIAL, CLUSTER"
          },
          {
            "count": 216,
            "value": "RESIDENTIAL- MIXED, MODERATE DENSITY"
          },
          {
            "count": 180,
            "value": "RESIDENTIAL- MIXED, MEDIUM DENSITY"
          },
          {
            "count": 130,
            "value": "RESIDENTIAL- COMMERCIAL, HIGH DENSITY"
          },
          {
            "count": 129,
            "value": "PDR PRODUCTION, DISTRIBUTION, AND REPAIR"
          },
          {
            "count": 112,
            "value": "URBAN MIXED USE"
          },
          {
            "count": 101,
            "value": "COMMUNITY BUSINESS"
          },
          {
            "count": 97,
            "value": "PRODUCTION, DISTRIBUTION & REPAIR - 1 - GENERAL"
          },
          {
            "count": 95,
            "value": "GEARY BOULEVARD NEIGHBORHOOD COMMERCIAL DISTRICT"
          },
          {
            "count": 87,
            "value": "NEIGHBORHOOD COMMERCIAL, SMALL SCALE"
          },
          {
            "count": 85,
            "value": "NEIGHBORHOOD COMMERCIAL, MODERATE SCALE"
          },
          {
            "count": 75,
            "value": "EXCELSIOR OUTER MISSION STREET NEIGHBORHOOD COMMERCIAL DISTRICT"
          },
          {
            "count": 75,
            "value": "RESIDENTIAL TRANSIT ORIENTED- MISSION"
          }
        ]
      },
      "datatype": "text",
      "description": "districtname",
      "field_name": "districtna",
      "name": "districtname",
      "position": 3,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 4506,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20077"
          },
          {
            "count": 1068,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-56337"
          },
          {
            "count": 908,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-20086"
          },
          {
            "count": 790,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-50175"
          },
          {
            "count": 347,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25492"
          },
          {
            "count": 282,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20123"
          },
          {
            "count": 222,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20120"
          },
          {
            "count": 162,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20083"
          },
          {
            "count": 158,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20086"
          },
          {
            "count": 112,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-67810"
          },
          {
            "count": 101,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20117"
          },
          {
            "count": 99,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-34612"
          },
          {
            "count": 95,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-62706"
          },
          {
            "count": 87,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25507"
          },
          {
            "count": 85,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25522"
          },
          {
            "count": 75,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25623"
          },
          {
            "count": 73,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-21366"
          },
          {
            "count": 66,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20132"
          },
          {
            "count": 57,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-57664"
          },
          {
            "count": 48,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-70715"
          }
        ]
      },
      "datatype": "text",
      "description": "url",
      "field_name": "url",
      "name": "url",
      "position": 4,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 5894,
            "value": "Residential"
          },
          {
            "count": 2214,
            "value": "Mixed Use"
          },
          {
            "count": 1292,
            "value": "Commercial"
          },
          {
            "count": 836,
            "value": "Public"
          },
          {
            "count": 378,
            "value": "Industrial"
          },
          {
            "count": 3,
            "value": "Mixed"
          }
        ]
      },
      "datatype": "text",
      "description": "gen",
      "field_name": "gen",
      "name": "gen",
      "position": 5,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 1872,
            "value": "RH-1"
          },
          {
            "count": 1454,
            "value": "RH-2"
          },
          {
            "count": 908,
            "value": "RTO-C"
          },
          {
            "count": 795,
            "value": "P"
          },
          {
            "count": 605,
            "value": "RM-1"
          },
          {
            "count": 591,
            "value": "RH-3"
          },
          {
            "count": 584,
            "value": "RH-1(D)"
          },
          {
            "count": 347,
            "value": "NC-1"
          },
          {
            "count": 216,
            "value": "RM-2"
          },
          {
            "count": 180,
            "value": "RM-3"
          },
          {
            "count": 130,
            "value": "RC-4"
          },
          {
            "count": 128,
            "value": "PDR-2"
          },
          {
            "count": 112,
            "value": "UMU"
          },
          {
            "count": 101,
            "value": "C-2"
          },
          {
            "count": 97,
            "value": "PDR-1-G"
          },
          {
            "count": 95,
            "value": "NCD-GEARY BOULEVARD"
          },
          {
            "count": 87,
            "value": "NC-2"
          },
          {
            "count": 85,
            "value": "NC-3"
          },
          {
            "count": 83,
            "value": "RTO-1"
          },
          {
            "count": 75,
            "value": "RTO-M"
          }
        ]
      },
      "datatype": "text",
      "description": "zoning",
      "field_name": "zoning",
      "name": "zoning",
      "position": 6,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 9709,
        "null_count": 908,
        "top": [
          {
            "count": 4507,
            "value": "209.1"
          },
          {
            "count": 1068,
            "value": "209.2"
          },
          {
            "count": 794,
            "value": "211"
          },
          {
            "count": 347,
            "value": "710.1"
          },
          {
            "count": 283,
            "value": "210.3"
          },
          {
            "count": 223,
            "value": "210.2"
          },
          {
            "count": 162,
            "value": "209.3"
          },
          {
            "count": 158,
            "value": "209.4"
          },
          {
            "count": 112,
            "value": "843"
          },
          {
            "count": 101,
            "value": "210.1"
          },
          {
            "count": 99,
            "value": "249.64"
          },
          {
            "count": 95,
            "value": "739"
          },
          {
            "count": 87,
            "value": "711.1"
          },
          {
            "count": 85,
            "value": "712.1"
          },
          {
            "count": 75,
            "value": "720"
          },
          {
            "count": 70,
            "value": "249.52"
          },
          {
            "count": 66,
            "value": "210.4"
          },
          {
            "count": 57,
            "value": "752"
          },
          {
            "count": 48,
            "value": "844"
          },
          {
            "count": 48,
            "value": "722.1"
          }
        ]
      },
      "datatype": "text",
      "description": "codesection",
      "field_name": "codesectio",
      "name": "codesection",
      "position": 7,
      "render_type": "text"
    }
  ],
  "created_at": "2019-12-26T19:04:34Z",
  "custom_fields": {
    "Department Metrics": {
      "Publishing Department": "Planning"
    },
    "Geospatial API Pre-release": {
      "Enabled": "true"
    },
    "Internal Management": {
      "Inventory ID": "CPC-0009"
    },
    "Publishing Details": {
      "Data change frequency": "Quarterly",
      "Geographic unit": "",
      "Program link": "",
      "Publishing frequency": "Quarterly"
    }
  },
  "description": "The Zoning Districts are a component of the Zoning Map which in turn is a key component of the San Francisco Planning Code. More information can be found here: https://sfplanning.org/zoning\n\nThe official zoning map can be found here: https://experience.arcgis.com/experience/573d02b43b7b46e381df04b7f225da95",
  "display_type": "table",
  "download_count": 3109,
  "id": "3i4a-hu95",
  "license": {
    "id": "PDDL",
    "name": "Open Data Commons Public Domain Dedication and License",
    "terms_link": "http://opendatacommons.org/licenses/pddl/1.0/"
  },
  "metadata_url": "https://data.sf.gov/api/views/3i4a-hu95.json",
  "name": "Zoning Map - Zoning Districts",
  "observed_at_ms": 1790056199439,
  "provenance": "official",
  "publication_date": "2019-12-26T19:07:58Z",
  "publishing_department": "Planning",
  "publishing_frequency": "Quarterly",
  "rows_updated_at": "2026-09-21T11:24:30Z",
  "source_url": "https://data.sf.gov/d/3i4a-hu95",
  "tags": [
    "planning",
    "zoning",
    "development"
  ],
  "view_count": 17577,
  "view_last_modified": "2026-09-21T11:24:23Z"
}
```

## API reference-derived contract

The following capability contract is generated from the same normalized Alexandria API reference exposed in the API spec.

### Dataset

- Capability: `open-data/dataset`
- Description: Metadata and the column list of one DataSF asset from /api/views/<4x4>.json: name, description, category, tags, attribution, license, provenance, creation/update timestamps, publishing department and frequency, custom metadata fields, and every column with its SoQL field_name (which can differ from the display name and may be truncated to 10 characters on legacy imports), datatype (text, number, calendar_date, point, multipolygon ...), description and cached value statistics (counts and top values). Also returns the landing source_url and the SODA api_url. Unknown ids are not_found.
- Instructions: Before `rows`: column field names and datatypes must come from here, not be guessed. Accepts a 4x4 id or any data.sf.gov / data.sfgov.org dataset URL.
- Cost: 5 credits per call
- Capability file: [Dataset](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/dataset)

Accepted options:
- `dataset_id` (string, required): 4x4 id (for example `3i4a-hu95`) or a portal URL containing it: https://data.sf.gov/d/<id>, .../<Category>/<Name>/<id>, .../resource/<id>.json (data.sfgov.org accepted). Example: `3i4a-hu95`

Response schema example:
```json
{
  "api_url": "https://data.sf.gov/resource/3i4a-hu95.json",
  "asset_type": "dataset",
  "attribution": "City and County of San Francisco Planning Department",
  "attribution_link": "https://sfplanning.org/zoning",
  "category": "Geographic Locations and Boundaries",
  "column_count": 7,
  "columns": [
    {
      "cached": null,
      "datatype": "multipolygon",
      "description": "the_geom",
      "field_name": "the_geom",
      "name": "the_geom",
      "position": 1,
      "render_type": "multipolygon"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 1872,
            "value": "RH-1"
          },
          {
            "count": 1454,
            "value": "RH-2"
          },
          {
            "count": 908,
            "value": "RTO-C"
          },
          {
            "count": 795,
            "value": "P"
          },
          {
            "count": 763,
            "value": "NCD"
          },
          {
            "count": 605,
            "value": "RM-1"
          },
          {
            "count": 591,
            "value": "RH-3"
          },
          {
            "count": 584,
            "value": "RH-1(D)"
          },
          {
            "count": 347,
            "value": "NC-1"
          },
          {
            "count": 285,
            "value": "NCT"
          },
          {
            "count": 216,
            "value": "RM-2"
          },
          {
            "count": 180,
            "value": "RM-3"
          },
          {
            "count": 130,
            "value": "RC-4"
          },
          {
            "count": 129,
            "value": "PDR-2"
          },
          {
            "count": 112,
            "value": "UMU"
          },
          {
            "count": 101,
            "value": "C-2"
          },
          {
            "count": 97,
            "value": "PDR-1-G"
          },
          {
            "count": 87,
            "value": "NC-2"
          },
          {
            "count": 85,
            "value": "NC-3"
          },
          {
            "count": 83,
            "value": "RTO-1"
          }
        ]
      },
      "datatype": "text",
      "description": "zoning_sim",
      "field_name": "zoning_sim",
      "name": "zoning_sim",
      "position": 2,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 1872,
            "value": "RESIDENTIAL- HOUSE, ONE FAMILY"
          },
          {
            "count": 1454,
            "value": "RESIDENTIAL- HOUSE, TWO FAMILY"
          },
          {
            "count": 908,
            "value": "RESIDENTIAL TRANSIT ORIENTED DISTRICT - C"
          },
          {
            "count": 795,
            "value": "PUBLIC"
          },
          {
            "count": 605,
            "value": "RESIDENTIAL- MIXED, LOW DENSITY"
          },
          {
            "count": 591,
            "value": "RESIDENTIAL- HOUSE, THREE FAMILY"
          },
          {
            "count": 584,
            "value": "RESIDENTIAL- HOUSE, ONE FAMILY- DETACHED"
          },
          {
            "count": 347,
            "value": "NEIGHBORHOOD COMMERCIAL, CLUSTER"
          },
          {
            "count": 216,
            "value": "RESIDENTIAL- MIXED, MODERATE DENSITY"
          },
          {
            "count": 180,
            "value": "RESIDENTIAL- MIXED, MEDIUM DENSITY"
          },
          {
            "count": 130,
            "value": "RESIDENTIAL- COMMERCIAL, HIGH DENSITY"
          },
          {
            "count": 129,
            "value": "PDR PRODUCTION, DISTRIBUTION, AND REPAIR"
          },
          {
            "count": 112,
            "value": "URBAN MIXED USE"
          },
          {
            "count": 101,
            "value": "COMMUNITY BUSINESS"
          },
          {
            "count": 97,
            "value": "PRODUCTION, DISTRIBUTION & REPAIR - 1 - GENERAL"
          },
          {
            "count": 95,
            "value": "GEARY BOULEVARD NEIGHBORHOOD COMMERCIAL DISTRICT"
          },
          {
            "count": 87,
            "value": "NEIGHBORHOOD COMMERCIAL, SMALL SCALE"
          },
          {
            "count": 85,
            "value": "NEIGHBORHOOD COMMERCIAL, MODERATE SCALE"
          },
          {
            "count": 75,
            "value": "EXCELSIOR OUTER MISSION STREET NEIGHBORHOOD COMMERCIAL DISTRICT"
          },
          {
            "count": 75,
            "value": "RESIDENTIAL TRANSIT ORIENTED- MISSION"
          }
        ]
      },
      "datatype": "text",
      "description": "districtname",
      "field_name": "districtna",
      "name": "districtname",
      "position": 3,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 4506,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20077"
          },
          {
            "count": 1068,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-56337"
          },
          {
            "count": 908,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-20086"
          },
          {
            "count": 790,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-50175"
          },
          {
            "count": 347,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25492"
          },
          {
            "count": 282,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20123"
          },
          {
            "count": 222,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20120"
          },
          {
            "count": 162,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20083"
          },
          {
            "count": 158,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20086"
          },
          {
            "count": 112,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-67810"
          },
          {
            "count": 101,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20117"
          },
          {
            "count": 99,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-34612"
          },
          {
            "count": 95,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-62706"
          },
          {
            "count": 87,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25507"
          },
          {
            "count": 85,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25522"
          },
          {
            "count": 75,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-25623"
          },
          {
            "count": 73,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-21366"
          },
          {
            "count": 66,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-19790#rid-0-0-0-20132"
          },
          {
            "count": 57,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-25360#rid-0-0-0-57664"
          },
          {
            "count": 48,
            "value": "https://codelibrary.amlegal.com/codes/san_francisco/latest/sf_planning/0-0-0-70715"
          }
        ]
      },
      "datatype": "text",
      "description": "url",
      "field_name": "url",
      "name": "url",
      "position": 4,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 5894,
            "value": "Residential"
          },
          {
            "count": 2214,
            "value": "Mixed Use"
          },
          {
            "count": 1292,
            "value": "Commercial"
          },
          {
            "count": 836,
            "value": "Public"
          },
          {
            "count": 378,
            "value": "Industrial"
          },
          {
            "count": 3,
            "value": "Mixed"
          }
        ]
      },
      "datatype": "text",
      "description": "gen",
      "field_name": "gen",
      "name": "gen",
      "position": 5,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 10617,
        "null_count": 0,
        "top": [
          {
            "count": 1872,
            "value": "RH-1"
          },
          {
            "count": 1454,
            "value": "RH-2"
          },
          {
            "count": 908,
            "value": "RTO-C"
          },
          {
            "count": 795,
            "value": "P"
          },
          {
            "count": 605,
            "value": "RM-1"
          },
          {
            "count": 591,
            "value": "RH-3"
          },
          {
            "count": 584,
            "value": "RH-1(D)"
          },
          {
            "count": 347,
            "value": "NC-1"
          },
          {
            "count": 216,
            "value": "RM-2"
          },
          {
            "count": 180,
            "value": "RM-3"
          },
          {
            "count": 130,
            "value": "RC-4"
          },
          {
            "count": 128,
            "value": "PDR-2"
          },
          {
            "count": 112,
            "value": "UMU"
          },
          {
            "count": 101,
            "value": "C-2"
          },
          {
            "count": 97,
            "value": "PDR-1-G"
          },
          {
            "count": 95,
            "value": "NCD-GEARY BOULEVARD"
          },
          {
            "count": 87,
            "value": "NC-2"
          },
          {
            "count": 85,
            "value": "NC-3"
          },
          {
            "count": 83,
            "value": "RTO-1"
          },
          {
            "count": 75,
            "value": "RTO-M"
          }
        ]
      },
      "datatype": "text",
      "description": "zoning",
      "field_name": "zoning",
      "name": "zoning",
      "position": 6,
      "render_type": "text"
    },
    {
      "cached": {
        "cardinality": 10617,
        "count": 10617,
        "non_null_count": 9709,
        "null_count": 908,
        "top": [
          {
            "count": 4507,
            "value": "209.1"
          },
          {
            "count": 1068,
            "value": "209.2"
          },
          {
            "count": 794,
            "value": "211"
          },
          {
            "count": 347,
            "value": "710.1"
          },
          {
            "count": 283,
            "value": "210.3"
          },
          {
            "count": 223,
            "value": "210.2"
          },
          {
            "count": 162,
            "value": "209.3"
          },
          {
            "count": 158,
            "value": "209.4"
          },
          {
            "count": 112,
            "value": "843"
          },
          {
            "count": 101,
            "value": "210.1"
          },
          {
            "count": 99,
            "value": "249.64"
          },
          {
            "count": 95,
            "value": "739"
          },
          {
            "count": 87,
            "value": "711.1"
          },
          {
            "count": 85,
            "value": "712.1"
          },
          {
            "count": 75,
            "value": "720"
          },
          {
            "count": 70,
            "value": "249.52"
          },
          {
            "count": 66,
            "value": "210.4"
          },
          {
            "count": 57,
            "value": "752"
          },
          {
            "count": 48,
            "value": "844"
          },
          {
            "count": 48,
            "value": "722.1"
          }
        ]
      },
      "datatype": "text",
      "description": "codesection",
      "field_name": "codesectio",
      "name": "codesection",
      "position": 7,
      "render_type": "text"
    }
  ],
  "created_at": "2019-12-26T19:04:34Z",
  "custom_fields": {
    "Department Metrics": {
      "Publishing Department": "Planning"
    },
    "Geospatial API Pre-release": {
      "Enabled": "true"
    },
    "Internal Management": {
      "Inventory ID": "CPC-0009"
    },
    "Publishing Details": {
      "Data change frequency": "Quarterly",
      "Geographic unit": "",
      "Program link": "",
      "Publishing frequency": "Quarterly"
    }
  },
  "description": "The Zoning Districts are a component of the Zoning Map which in turn is a key component of the San Francisco Planning Code. More information can be found here: https://sfplanning.org/zoning\n\nThe official zoning map can be found here: https://experience.arcgis.com/experience/573d02b43b7b46e381df04b7f225da95",
  "display_type": "table",
  "download_count": 3109,
  "id": "3i4a-hu95",
  "license": {
    "id": "PDDL",
    "name": "Open Data Commons Public Domain Dedication and License",
    "terms_link": "http://opendatacommons.org/licenses/pddl/1.0/"
  },
  "metadata_url": "https://data.sf.gov/api/views/3i4a-hu95.json",
  "name": "Zoning Map - Zoning Districts",
  "observed_at_ms": 1790056199439,
  "provenance": "official",
  "publication_date": "2019-12-26T19:07:58Z",
  "publishing_department": "Planning",
  "publishing_frequency": "Quarterly",
  "rows_updated_at": "2026-09-21T11:24:30Z",
  "source_url": "https://data.sf.gov/d/3i4a-hu95",
  "tags": [
    "planning",
    "zoning",
    "development"
  ],
  "view_count": 17577,
  "view_last_modified": "2026-09-21T11:24:23Z"
}
```

### Datasets

- Capability: `open-data/datasets`
- Description: Search the DataSF catalog through the Socrata Discovery API (search_context=data.sf.gov): free-text query, asset type, category, tags and sort order, or look up one asset by its 4x4 id. Each result carries the 4x4 dataset id, name, type (dataset, map, filter, href, chart, story ...), description, category, tags, timestamps, column field names and datatypes, download and view counts, the landing link, permalink and, for tabular datasets, the SODA api_url to pass to `rows`. Paged by `limit` and an opaque `cursor`. An unknown `dataset_id` is not_found; a query with no match is a successful empty result.
- Instructions: Start here when the 4x4 dataset id is unknown: find the dataset, then call `dataset` for its columns and `rows` for its data. Only results with type `dataset` (and a non-null api_url) have rows.
- Cost: 5 credits per call
- Capability file: [Datasets](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/datasets)

Accepted options:
- `category` (string): Exact portal category as returned by `facets` (for example `Housing and Buildings`). Example: `<category>`
- `cursor` (string): Opaque `next_cursor` from the previous page; send it with the same search parameters. Example: `next_cursor`
- `dataset_id` (string): Look up one asset by 4x4 id (for example `3i4a-hu95`) or by a data.sf.gov / data.sfgov.org URL containing it. Unknown ids are not_found. Example: `3i4a-hu95`
- `limit` (number): Results per page (1-100). Example: `20`
- `only` (string): Restrict to one asset type. `datasets` are the tabular assets that `rows` can query. Example: `datasets`
- `order` (string): Sort order. `relevance` (default) needs a `query`; the others are descending except `name`. Example: `relevance`
- `query` (string): Free-text search over names, descriptions, tags and columns, for example `zoning` or `building permits`. Example: `<query>`
- `tags` (string[]): Portal tags as returned by `facets`; an asset must carry all of them. Example: `[]`

Response schema example:
```json
{
  "count": 1,
  "datasets": [
    {
      "api_url": "https://data.sf.gov/resource/3i4a-hu95.json",
      "attribution": "City and County of San Francisco Planning Department",
      "attribution_link": "https://sfplanning.org/zoning",
      "category": "Geographic Locations and Boundaries",
      "columns": [
        {
          "datatype": "Text",
          "field_name": "zoning_sim",
          "name": "zoning_sim"
        },
        {
          "datatype": "Text",
          "field_name": "gen",
          "name": "gen"
        },
        {
          "datatype": "Text",
          "field_name": "url",
          "name": "url"
        },
        {
          "datatype": "Text",
          "field_name": "districtna",
          "name": "districtname"
        },
        {
          "datatype": "Text",
          "field_name": "zoning",
          "name": "zoning"
        },
        {
          "datatype": "Text",
          "field_name": "codesectio",
          "name": "codesection"
        },
        {
          "datatype": "MultiPolygon",
          "field_name": "the_geom",
          "name": "the_geom"
        }
      ],
      "created_at": "2019-12-26T19:04:34.000Z",
      "data_updated_at": "2026-09-21T11:24:30.000Z",
      "description": "The Zoning Districts are a component of the Zoning Map which in turn is a key component of the San Francisco Planning Code. More information can be found here: https://sfplanning.org/zoning\n\nThe official zoning map can be found here: https://experience.arcgis.com/experience/573d02b43b7b46e381df04b7f225da95",
      "domain": "data.sf.gov",
      "download_count": 3109,
      "id": "3i4a-hu95",
      "license": "Open Data Commons Public Domain Dedication and License",
      "link": "https://data.sf.gov/Geographic-Locations-and-Boundaries/Zoning-Map-Zoning-Districts/3i4a-hu95",
      "metadata_updated_at": "2026-09-21T11:24:23.000Z",
      "name": "Zoning Map - Zoning Districts",
      "page_views_total": 17577,
      "parent_ids": [],
      "permalink": "https://data.sf.gov/d/3i4a-hu95",
      "provenance": "official",
      "tags": [
        "zoning",
        "development",
        "planning"
      ],
      "type": "dataset",
      "updated_at": "2026-09-21T11:24:30.000Z"
    }
  ],
  "next_cursor": null,
  "observed_at_ms": 1790056196312,
  "portal": "data.sf.gov",
  "query": null,
  "source_url": "https://api.us.socrata.com/api/catalog/v1?search_context=data.sf.gov&ids=3i4a-hu95&limit=20&offset=0",
  "total_count": 1
}
```

### Facets

- Capability: `open-data/facets`
- Description: The DataSF portal's category or tag facets with asset counts, from the Discovery API domain_categories / domain_tags endpoints scoped to data.sf.gov. Use the values as `category` / `tags` inputs to `datasets`.
- Instructions: Discover how the portal organises its assets before searching by category or tag.
- Cost: 5 credits per call
- Capability file: [Facets](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/facets)

Accepted options:
- `facet` (string, required): facet Example: `categories`

Response schema example:
```json
{
  "count": 12,
  "facet": "categories",
  "observed_at_ms": 1790056209125,
  "portal": "data.sf.gov",
  "source_url": "https://api.us.socrata.com/api/catalog/v1/domain_categories?search_context=data.sf.gov",
  "values": [
    {
      "count": 260,
      "value": "City Management and Ethics"
    },
    {
      "count": 178,
      "value": "Transportation"
    },
    {
      "count": 167,
      "value": "City Infrastructure"
    },
    {
      "count": 126,
      "value": "Geographic Locations and Boundaries"
    },
    {
      "count": 101,
      "value": "Housing and Buildings"
    },
    {
      "count": 89,
      "value": ""
    },
    {
      "count": 68,
      "value": "Public Safety"
    },
    {
      "count": 65,
      "value": "Economy and Community"
    },
    {
      "count": 58,
      "value": "Health and Social Services"
    },
    {
      "count": 38,
      "value": "Culture and Recreation"
    },
    {
      "count": 27,
      "value": "Energy and Environment"
    },
    {
      "count": 10,
      "value": "COVID-19"
    }
  ]
}
```

### Row count

- Capability: `open-data/row_count`
- Description: Number of rows of a DataSF dataset matching optional `where`, `q` and `filters`, from `$select=count(*)` on the SODA endpoint. Returns the integer count and the exact request URL. An unknown dataset id is not_found; a SoQL error is invalid_input.
- Instructions: Size a `rows` query before paging, or answer a pure how-many question.
- Cost: 5 credits per call
- Capability file: [Row count](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/row_count)

Accepted options:
- `dataset_id` (string, required): 4x4 id or a data.sf.gov / data.sfgov.org URL containing it. Example: `<dataset_id>`
- `filters` (object): Bare equality filters sent as `field=value` query parameters. Example: `{}`
- `q` (string): SoQL $q full-text search. Example: `<q>`
- `where` (string): SoQL $where predicate. Example: `<where>`

Response schema example:
```json
{
  "count": 10617,
  "data_last_modified": "Mon, 21 Sep 2026 11:24:25 GMT",
  "dataset_id": "3i4a-hu95",
  "observed_at_ms": 1790056206070,
  "q": null,
  "source_url": "https://data.sf.gov/resource/3i4a-hu95.json?%24select=count%28*%29",
  "where": null
}
```

### Rows

- Capability: `open-data/rows`
- Description: Query rows of any DataSF dataset through the SODA 2.1 endpoint https://data.sf.gov/resource/<4x4>.json with SoQL: `select` (columns, aggregates such as count(*)), `where` (SoQL predicates incl. like, between, intersects(the_geom,'POINT(lon lat)'), within_circle(point, lat, lon, meters), within_box), `order`, `group`, `q` (full text) and `filters` (bare field=value equality parameters), paged with `limit` (1-50000, default 100) and `cursor` (row offset). Without `order` (and without `group`) the program orders by the row id `:id` so pages are stable. Rows come back exactly as published: numbers and dates are strings, geometry is GeoJSON; `columns` lists the returned field names and Socrata types from the X-SODA2-Fields/Types headers. An unknown dataset id is not_found; a SoQL error (unknown column, bad syntax) is invalid_input carrying the portal's message; an empty page is a successful result with count 0.
- Instructions: Any question that needs actual records from a DataSF dataset. Get the 4x4 id from `datasets` and the column field names from `dataset` first. Use `row_count` to size a query before paging.
- Cost: 5 credits per call
- Capability file: [Rows](https://firecrawl.dev/alexandria/agents/providers/data-sf-gov/open-data/rows)

Accepted options:
- `cursor` (string): Row offset to start from: the `next_cursor` of the previous page. Pattern: ^[0-9]{1,12}$. Example: `next_cursor`
- `dataset_id` (string, required): 4x4 id (for example `3i4a-hu95`) or a data.sf.gov / data.sfgov.org URL containing it. Example: `3i4a-hu95`
- `filters` (object): Bare equality filters sent as `field=value` query parameters (for example {"blklot": "3720009"}); keys must be column field names, values strings. Example: `{}`
- `group` (string): SoQL $group; pair with aggregates in `select`. Example: `<group>`
- `limit` (number): Rows per page. The portal caps a request at 50000; wide datasets with geometry should use far less. Example: `100`
- `order` (string): SoQL $order, for example `filed_date DESC` or `count(*) DESC`. Default `:id` when no `group` is given. Example: `filed_date DESC`
- `q` (string): SoQL $q full-text search across all text columns. Example: `<q>`
- `select` (string): SoQL $select, for example `zoning_sim,districtna` or `zoning_sim,count(*)`. Default: all columns. Example: `zoning_sim,districtna`
- `where` (string): SoQL $where, for example `zoning_sim like 'RH-1%'`, `filed_date between '2026-09-01T00:00:00' and '2026-09-02T00:00:00'`, `intersects(the_geom,'POINT(-122.3966 37.7897)')`, `within_circle(point,37.7897,-122.3966,50)`. Example: `zoning_sim like 'RH-1%'`

Response schema example:
```json
{
  "columns": [
    {
      "datatype": "text",
      "field_name": "zoning_sim"
    },
    {
      "datatype": "text",
      "field_name": "districtna"
    },
    {
      "datatype": "text",
      "field_name": "gen"
    }
  ],
  "count": 1,
  "data_last_modified": "Mon, 21 Sep 2026 11:24:25 GMT",
  "dataset_id": "3i4a-hu95",
  "limit": 5,
  "next_cursor": null,
  "observed_at_ms": 1790056202526,
  "offset": 0,
  "rows": [
    {
      "districtna": "DOWNTOWN- OFFICE (SPECIAL DEVELOPMENT)",
      "gen": "Commercial",
      "zoning_sim": "C-3-O(SD)"
    }
  ],
  "source_url": "https://data.sf.gov/resource/3i4a-hu95.json?%24select=zoning_sim%2Cdistrictna%2Cgen&%24where=intersects%28the_geom%2C%27POINT%28-122.3966+37.7897%29%27%29&%24order=%3Aid&%24limit=5"
}
```
