# City Open Data (Socrata) - Any Dataset from Any Portal (`alaudinburki/socrata-open-data`) Actor

Read any Socrata open-data dataset - New York 311 complaints, Chicago crimes, SF permits and hundreds more - as flat rows. Free public API, no key on most portals.

- **URL**: https://apify.com/alaudinburki/socrata-open-data.md
- **Developed by:** [alaudin burki](https://apify.com/alaudinburki) (community)
- **Categories:** Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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

## City Open Data (Socrata) — Any Dataset from Any Portal

Read **any Socrata open-data dataset** — New York 311 complaints, Chicago crimes, SF permits, and
hundreds more — as flat rows. Free public API, no key on most portals.

**One Actor for every city**, because the portal and dataset are both template values rather than a
hardcoded URL.

### What you get

`createdAt`, `agency`, `complaintType`, `descriptor`, `status`, `communityBoard`, `policePrecinct`,
`locationType`, `latitude`, `longitude`, `address`, `borough`, `closedAt`, `id`.

Fields that a given dataset does not have come back as **null**, so the same schema works across
portals.

### Sample output

```json
{ "createdAt": "2026-10-17T00:00:00.000", "complaintType": "Noise - Residential",
  "agency": "New York City Police Department", "borough": "MANHATTAN",
  "latitude": "40.7128", "longitude": "-74.0060" }
```

### Limitations

- **Socrata is a platform, not a schema.** Column names differ per dataset, so only the ~13 common
  ones are mapped; use `where` to filter and the raw API for anything else.
- **There is no universal id.** Each dataset names its own key, so the Actor tries the common ones
  (`unique_key`, `id`, `case_number`, `objectid`, `permit_number`) and falls back to a composite of the
  first few values. On an unusual dataset the id is stable but not meaningful.
- **Some portals need an app token** for heavy use; without one you share an anonymous quota and large
  sweeps may be throttled.
- `$limit` caps a single request at 1,000 rows; paging handles the rest.

### Pricing

Pay per result.

### Fields

| Field | Type | What it holds |
|---|---|---|
| `createdAt` | string | ISO 8601 timestamp of when this record was created upstream. |
| `agency` | string | Agency the record belongs to. |
| `complaintType` | string | Type of complaint the request was filed as, in the city's own vocabulary. |
| `descriptor` | string | More specific detail within the complaint type. Often empty, so the complaint type is the reliable field. |
| `status` | string | Outcome recorded for this row. |
| `communityBoard` | string | Community board the record falls in, as the city numbers them. A named administrative area, and its boundaries change. |
| `policePrecinct` | string | Police precinct covering the location, as the city numbers them. |
| `locationType` | string | What kind of location this is, as the source classifies it. |
| `latitude` | number | Latitude in decimal degrees (WGS 84). A STRING from some sources and a number from others — check the README per Actor. |
| `longitude` | number | Longitude in decimal degrees (WGS 84). A STRING from some sources and a number from others — check the README per Actor. |
| `address` | string | Street address as published. |
| `borough` | string | Borough name where the source returns a name, or its code where it returns one. |
| `closedAt` | string | When the item was closed. Absent while still open, which is not the same as an unknown time. |

# Actor input Schema

## `domain` (type: `string`):

The portal host, e.g. data.cityofnewyork.us, data.cityofchicago.org, data.sfgov.org.

## `datasetId` (type: `string`):

The four-by-four id from the dataset URL, e.g. erm2-nwe9 for NYC 311.

## `where` (type: `string`):

Optional SoQL filter, e.g. complaint_type='Noise - Residential'.

## `order` (type: `string`):

Optional SoQL ordering, e.g. created_date DESC.

## `maxItems` (type: `integer`):

Stop after this many rows.

## `maxPages` (type: `integer`):

Stop after this many pages.

## Actor input object example

```json
{
  "maxItems": 500,
  "maxPages": 5
}
```

# Actor output Schema

## `results` (type: `string`):

One row per item, with the 13 fields listed under Views.

# 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 = {
    "maxItems": 500,
    "maxPages": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("alaudinburki/socrata-open-data").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 = {
    "maxItems": 500,
    "maxPages": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("alaudinburki/socrata-open-data").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 '{
  "maxItems": 500,
  "maxPages": 5
}' |
apify call alaudinburki/socrata-open-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alaudinburki/socrata-open-data"
        }
    }
}
```

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/geshape7sd1O2Pvcp/builds/eUw4INegL1B40T4RF/openapi.json
