[Integrations](https://spiral.ai/integrations) › [n8n](https://spiral.ai/integrations/n8n) › [DataSF record count](https://spiral.ai/integrations/n8n/datasf-record-count)

# How to Use DataSF record count in n8n

Returns the number of records matching a DataSF dataset query. Use it for a how-many question or to size an extraction, while checking whether several rows can describe the same permit or event.

|  |  |
| --- | --- |
| Model | DataSF record count |
| Available through | Alexandria |
| Category | Listings |
| Price | $0.00873 per call. |
| Returns | json |
| Runs | In the background |
| Setup | About 2 minutes, with a Spiral API key |

## Prompts to try with DataSF record count in n8n

- Every Monday, use DataSF record count to count San Francisco 311 Cases created in the previous complete week and compare that with the preceding week.
- Every Monday at 9am: use DataSF record count to look this up and give me the result as a table.
- Pull the latest numbers from DataSF record count and tell me what changed since last week.
- Check DataSF record count and summarize what you find in three bullet points.
- Pull the newest data from DataSF record count and give me the result as a table.

## How to set up DataSF record count in n8n

Pick the way that suits you. Each takes about two minutes.

### Use the Spiral skill

1. **Send n8n this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use Spiral's MCP server

1. **Create a key**: Create a key under API keys in the console.

2. **Add an MCP Client node**: In a workflow, add an MCP Client node (or, under an AI Agent node, an MCP Client Tool) and set:

```text
https://api.spiral.ai/mcp
```

3. **Pick a tool**: The node lists Spiral's tools. In an MCP Client node pick one, such as `run`, and give it its arguments:

```json
{
  "provider": "fal",
  "model": "fal-ai/flux/schnell",
  "input": { "prompt": "a lighthouse at dawn" },
  "wait": true
}
```

4. **Run DataSF record count in a workflow step**: Give the step an instruction like the ones below and run it on your trigger or schedule. Spiral finds DataSF record count, prices it and runs it each time the step fires.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run DataSF record count**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "alexandria",
    "model": "data-sf-gov/open-data/row_count",
    "input": {
      "dataset_id": "<dataset_id>"
    }
  }'
```

Then paste one of the prompts above: n8n finds DataSF record count on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/n8n

## DataSF record count tools and prices

- [DataSF open data portal · Row count](https://spiral.ai/tools/alexandria/data-sf-gov/open-data/row_count) (Alexandria): $0.00873 per call.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| q |  | — | SoQL $q full-text search. |
| where |  | — | SoQL $where predicate. |
| filters |  | — | Bare equality filters sent as `field=value` query parameters. |

## What can you do with DataSF record count in n8n?

Keep a recurring San Francisco civic briefing tied to the city's published sources. A scheduled agent can revisit catalog choices, check dataset definitions, and refresh counts and supporting records.

### Build a permit activity briefing

Find permit sources through the catalog's categories and tags, inspect their definitions, count the selected period, and retrieve records for a monthly construction briefing. Account for permits that cover multiple addresses.

### Compare neighborhood service requests

Locate the 311 source through catalog discovery, verify its neighborhood and date definitions, and compare matching record totals with a breakdown of requests. Label the result as service requests.

### Prepare a scoped data extraction

Discover relevant tables using the catalog vocabulary, inspect their schemas, and count matching records before retrieving a defined date range. Use the result to populate a civic analysis project.

### Audit sources behind a civic report

Review the categories, search results, and dataset definitions behind a housing or city services report. Recalculate its record totals and retrieve supporting records so the published figures can be checked.

### Check permit counting assumptions

Inspect the Building Permits documentation, count records for a selected period, and examine repeated permit numbers. Establish whether a report needs address-level rows or a deduplicated permit total.

## Overview

- [Alexandria](https://spiral.ai/providers/alexandria)
- [All n8n guides](https://spiral.ai/integrations/n8n)

## DataSF record count in other agents

- [Amp](https://spiral.ai/integrations/amp/datasf-record-count)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/datasf-record-count)
- [Claude](https://spiral.ai/integrations/claude-desktop/datasf-record-count)
- [Claude Code](https://spiral.ai/integrations/claude-code/datasf-record-count)
- [Cline](https://spiral.ai/integrations/cline/datasf-record-count)
- [Codex](https://spiral.ai/integrations/codex/datasf-record-count)
- [Cursor](https://spiral.ai/integrations/cursor/datasf-record-count)
- [Devin](https://spiral.ai/integrations/devin/datasf-record-count)
- [dots](https://spiral.ai/integrations/dots/datasf-record-count)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/datasf-record-count)
- [Gemini](https://spiral.ai/integrations/gemini/datasf-record-count)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/datasf-record-count)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/datasf-record-count)
- [goose](https://spiral.ai/integrations/goose/datasf-record-count)
- [Grok](https://spiral.ai/integrations/grok/datasf-record-count)
- [Grok Build](https://spiral.ai/integrations/grok-build/datasf-record-count)
- [Hermes](https://spiral.ai/integrations/hermes/datasf-record-count)
- [Instinct](https://spiral.ai/integrations/instinct/datasf-record-count)
- [Manus](https://spiral.ai/integrations/manus/datasf-record-count)
- [Muse](https://spiral.ai/integrations/muse/datasf-record-count)
- [Muse Code](https://spiral.ai/integrations/muse-code/datasf-record-count)
- [Notion](https://spiral.ai/integrations/notion/datasf-record-count)
- [OpenClaw](https://spiral.ai/integrations/openclaw/datasf-record-count)
- [opencode](https://spiral.ai/integrations/opencode/datasf-record-count)
- [Perplexity](https://spiral.ai/integrations/perplexity/datasf-record-count)
- [Raycast](https://spiral.ai/integrations/raycast/datasf-record-count)
- [VS Code](https://spiral.ai/integrations/vscode/datasf-record-count)
- [Windsurf](https://spiral.ai/integrations/windsurf/datasf-record-count)
- [Zapier](https://spiral.ai/integrations/zapier/datasf-record-count)

## More n8n guides

- [DataSF dataset search](https://spiral.ai/integrations/n8n/datasf-dataset-search)
- [Earth Search Sentinel-2 image clip](https://spiral.ai/integrations/n8n/earth-search-sentinel-2-image-clip)
- [DataSF dataset records](https://spiral.ai/integrations/n8n/datasf-dataset-records)
- [Earth Search Sentinel-2 imagery availability](https://spiral.ai/integrations/n8n/earth-search-sentinel-2-imagery-availability)
- [DataSF dataset details](https://spiral.ai/integrations/n8n/datasf-dataset-details)
- [Earth Search Sentinel-2 scene details](https://spiral.ai/integrations/n8n/earth-search-sentinel-2-scene-details)

## Questions about DataSF record count in n8n

**Can n8n use DataSF record count?**

Yes. Add Spiral to n8n as an MCP server, and n8n can find and run DataSF record count like any built-in tool.

**How much does DataSF record count cost in n8n?**

$0.00873 per call. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your n8n plan is separate.

**Do I need an Alexandria account to use DataSF record count in n8n?**

You need no Alexandria account. n8n uses one Spiral API key for every tool, and Spiral runs DataSF record count on its own Alexandria account.

**How long does it take to set up DataSF record count in n8n?**

About two minutes: create a key, then add an MCP Client node, then pick a tool.

**Does n8n wait while DataSF record count runs?**

DataSF record count runs in the background. n8n starts the run, checks on it and gives you the json when it's ready.

**Is every DataSF search result a dataset?**

No. The catalog can include tables, charts, maps, stories, and derived views. Check the result's type before choosing a source for record analysis.

**How fresh is DataSF data?**

Refresh schedules depend on the dataset. DataSF documents an approximately 10 a.m. daily refresh for 311 Cases, while DBI uploads Building Permits nightly.

**How much historical data is available?**

History depends on the selected dataset. For example, 311 Cases covers eligible cases created on July 1, 2008, or later.

**Does a row count equal the number of permits?**

Not necessarily. Building Permits can repeat one permit across multiple rows when it has multiple associated addresses, so counting rows can overstate the number of permits.

**Does DataSF guarantee the data is accurate?**

No. The city's terms say the data is subject to error and cannot be relied on without verification or a site inspection.

