# Socrata

> Read open data from any Socrata portal (Tyler Data & Insights), used by hundreds of cities and governments: search datasets across portals, read rows with filters and sorting, and count them.

App · 8 actions. Web page: https://docs.lodol.com/docs/integrations/socrata

## Actions

### Count rows

Count how many of a dataset's rows match a filter, or all of them.

**Inputs**

- Portal (`portal`, text, required): The portal's web address, such as data.cityofnewyork.us. A link to any page on the portal works too.
- Dataset (`dataset`, text, required): Pick a dataset, or enter its id (such as erm2-nwe9), or paste a link to its page. The list shows the portal's most viewed datasets.
- Exact matches (`filters`, object): Only rows whose column holds exactly this value, by field name, such as borough = BRONX.
- Filter (`where`, text): Only rows meeting this condition, written in SoQL with column field names, such as created_date > '2026-01-01' AND borough = 'BRONX'.
- Search words (`query`, text): Only rows containing these words in any text column.

**Outputs**

- `count` (number): How many rows match.
- `dataset_id` (text): The dataset that was counted.

**Example output**

```json
{
  "count": 140327,
  "dataset_id": "erm2-nwe9"
}
```

### Count rows by value

Count how many rows hold each value of a column, such as complaints per borough, most common first.

**Inputs**

- Portal (`portal`, text, required): The portal's web address, such as data.cityofnewyork.us. A link to any page on the portal works too.
- Dataset (`dataset`, text, required): Pick a dataset, or enter its id (such as erm2-nwe9), or paste a link to its page. The list shows the portal's most viewed datasets.
- Column (`column`, text, required): The column whose values to count.
- Exact matches (`filters`, object): Only rows whose column holds exactly this value, by field name, such as borough = BRONX.
- Filter (`where`, text): Only rows meeting this condition, written in SoQL with column field names, such as created_date > '2026-01-01' AND borough = 'BRONX'.
- Search words (`query`, text): Only rows containing these words in any text column.
- Values (`limit`, number): How many of the most common values to return. From 1 to 1000. Default: `20`.

**Outputs**

- `column` (text): The column whose values were counted.
- `count` (number): How many values are listed.
- `dataset_id` (text): The dataset that was counted.
- `groups` (list): Each value and how many rows hold it, most common first.

**Example output**

```json
{
  "column": "borough",
  "count": 3,
  "dataset_id": "erm2-nwe9",
  "groups": [
    {
      "count": 45952,
      "value": "BROOKLYN"
    },
    {
      "count": 33583,
      "value": "QUEENS"
    },
    {
      "count": 29824,
      "value": "MANHATTAN"
    }
  ]
}
```

### Find portals

Find the Socrata portals that publish data about a place or topic, with how many matching datasets each has.

**Inputs**

- Search words (`query`, text, required): A place or topic, such as chicago or restaurant inspections.
- Region (`region`, text): Which catalogue to search. Portals in Europe are listed only in the European one. One of: `us` (North America and worldwide), `eu` (Europe). Default: `us`.
- Results (`limit`, number): How many portals to return. From 1 to 200. Default: `20`.

**Outputs**

- `count` (number): How many portals are listed.
- `datasets_searched` (number): How many matching datasets were grouped (at most the first 1,000).
- `portals` (list): The portals, the one with most matching datasets first.

**Example output**

```json
{
  "count": 2,
  "datasets_searched": 1000,
  "portals": [
    {
      "example_dataset": "Chicago Street Names",
      "example_dataset_id": "i6bp-fvbx",
      "matching_datasets": 906,
      "portal": "data.cityofchicago.org",
      "url": "https://data.cityofchicago.org"
    },
    {
      "example_dataset": "Assessor [Archived 05-11-2022] - Residential Modeling Characteristics (Chicago)",
      "example_dataset_id": "8f9d-wy2d",
      "matching_datasets": 46,
      "portal": "datacatalog.cookcountyil.gov",
      "url": "https://datacatalog.cookcountyil.gov"
    }
  ]
}
```

### Get a dataset

Get a dataset's details and its columns, with each column's field name and type for filtering and sorting.

**Inputs**

- Portal (`portal`, text, required): The portal's web address, such as data.cityofnewyork.us. A link to any page on the portal works too.
- Dataset (`dataset`, text, required): Pick a dataset, or enter its id (such as erm2-nwe9), or paste a link to its page. The list shows the portal's most viewed datasets.

**Outputs**

- `api_endpoint` (text): The address its rows can be read from, for datasets.
- `attribution` (text): Who the data is credited to.
- `category` (text): The portal's category for it.
- `columns` (list): Its columns. Map-join columns are left out.
- `created_at` (text): When it was published (ISO 8601, UTC).
- `description` (text): The dataset's description, which may contain HTML.
- `downloads` (number): How many times it has been downloaded.
- `id` (text): The dataset's id, two groups of four characters such as erm2-nwe9.
- `license` (text): The licence the data is published under, when it names one.
- `name` (text): The dataset's name.
- `page_url` (text): The dataset's page on the portal.
- `portal` (text): The portal that publishes it, such as data.cityofnewyork.us.
- `tags` (list): The portal's tags for it.
- `type` (text): What it is: dataset, map, chart, filter, file, href or story.
- `updated_at` (text): When its data last changed (ISO 8601, UTC).
- `views` (number): How many times its page has been viewed.

**Example output**

```json
{
  "api_endpoint": "https://data.cityofnewyork.us/resource/erm2-nwe9.json",
  "attribution": "311",
  "category": "Social Services",
  "columns": [
    {
      "description": "Unique identifier of a Service Request (SR) in the open data set",
      "field_name": "unique_key",
      "name": "Unique Key",
      "type": "text"
    },
    {
      "description": "Date SR  was created",
      "field_name": "created_date",
      "name": "Created Date",
      "type": "calendar_date"
    },
    {
      "description": "Provided by the submitter and confirmed by geovalidation.",
      "field_name": "borough",
      "name": "Borough",
      "type": "text"
    }
  ],
  "created_at": "2011-10-10T05:52:17Z",
  "description": "311 responds to thousands of inquiries, comments and requests from customers every single day.",
  "downloads": 608960,
  "id": "erm2-nwe9",
  "license": null,
  "name": "311 Service Requests from 2020 to Present",
  "page_url": "https://data.cityofnewyork.us/d/erm2-nwe9",
  "portal": "data.cityofnewyork.us",
  "tags": [
    "311",
    "311 service requests",
    "city government",
    "pothole",
    "rodent"
  ],
  "type": "dataset",
  "updated_at": "2026-10-15T01:38:22Z",
  "views": 1327802
}
```

### Get rows

Read a dataset's rows: choose columns, filter, search, sort and page through them.

**Inputs**

- Portal (`portal`, text, required): The portal's web address, such as data.cityofnewyork.us. A link to any page on the portal works too.
- Dataset (`dataset`, text, required): Pick a dataset, or enter its id (such as erm2-nwe9), or paste a link to its page. The list shows the portal's most viewed datasets.
- Columns (`columns`, list): The columns to return. Leave empty for all.
- Exact matches (`filters`, object): Only rows whose column holds exactly this value, by field name, such as borough = BRONX.
- Filter (`where`, text): Only rows meeting this condition, written in SoQL with column field names, such as created_date > '2026-01-01' AND borough = 'BRONX'.
- Search words (`query`, text): Only rows containing these words in any text column.
- Sort by column (`sort_column`, text): The column to sort the rows by.
- Sort direction (`sort_direction`, text): Which way to sort. One of: `asc` (Ascending (A to Z, oldest or smallest first)), `desc` (Descending (Z to A, newest or largest first)). Default: `asc`.
- Rows (`limit`, number): How many rows to return. From 1 to 5000. Default: `100`.
- Skip (`offset`, number): How many rows to skip first, to page through them. From 0 to 10000000. Default: `0`.

**Outputs**

- `count` (number): How many rows are on this page.
- `dataset_id` (text): The dataset the rows came from.
- `has_more` (true/false): True when this page was full, so more rows may follow.
- `rows` (list): The rows, each keyed by column field name. Socrata sends numbers and dates as text.

**Example output**

```json
{
  "count": 2,
  "dataset_id": "erm2-nwe9",
  "has_more": true,
  "rows": [
    {
      "borough": "BRONX",
      "complaint_type": "Noise - Residential",
      "created_date": "2026-10-14T01:49:14.000",
      "unique_key": "70739944"
    },
    {
      "borough": "BRONX",
      "complaint_type": "Noise - Residential",
      "created_date": "2026-10-14T01:45:37.000",
      "unique_key": "70749193"
    }
  ]
}
```

### List categories

List a portal's dataset categories, with how many datasets are in each.

**Inputs**

- Portal (`portal`, text, required): The portal's web address, such as data.cityofnewyork.us. A link to any page on the portal works too.

**Outputs**

- `categories` (list): The portal's categories, largest first.
- `count` (number): How many categories there are.

**Example output**

```json
{
  "categories": [
    {
      "count": 906,
      "name": "City Government"
    },
    {
      "count": 653,
      "name": "Education"
    },
    {
      "count": 369,
      "name": "Transportation"
    }
  ],
  "count": 3
}
```

### List tags

List a portal's most used tags, with how many datasets carry each.

**Inputs**

- Portal (`portal`, text, required): The portal's web address, such as data.cityofnewyork.us. A link to any page on the portal works too.
- Results (`limit`, number): How many tags to return. From 1 to 1000. Default: `100`.

**Outputs**

- `count` (number): How many tags are listed.
- `tags` (list): The portal's most used tags, most used first.

**Example output**

```json
{
  "count": 3,
  "tags": [
    {
      "count": 149,
      "name": "doe"
    },
    {
      "count": 122,
      "name": "dcp"
    },
    {
      "count": 105,
      "name": "parks"
    }
  ]
}
```

### Search datasets

Search the datasets of every Socrata portal at once, or of one portal, by words, category and tag.

**Inputs**

- Search words (`query`, text): Words to look for in names, descriptions and columns. Leave empty to list a portal's datasets.
- Portal (`portal`, text): Only this portal's datasets, such as data.cityofnewyork.us. Leave empty to search every portal.
- Category (`category`, text): Only datasets in this category of the portal.
- Tag (`tag`, text): Only datasets with this tag on the portal.
- Type (`asset_type`, text): What kind of item to find. One of: `dataset` (Datasets), `map` (Maps), `chart` (Charts), `filter` (Filtered views), `file` (Files and documents), `href` (External datasets (links)), `story` (Stories), `all` (Everything). Default: `dataset`.
- Sort by (`order`, text): The order of the results. Best match needs search words; without them the most viewed come first. One of: `relevance` (Best match), `most_viewed` (Most viewed), `recently_updated` (Recently updated), `name` (Name A to Z). Default: `relevance`.
- Region (`region`, text): Which catalogue to search. Portals in Europe are listed only in the European one. One of: `us` (North America and worldwide), `eu` (Europe). Default: `us`.
- Results (`limit`, number): How many to return. From 1 to 100. Default: `10`.
- Skip (`offset`, number): How many matches to skip first, to page through them. From 0 to 9999. Default: `0`.

**Outputs**

- `count` (number): How many match in all, beyond this page.
- `datasets` (list): The matches on this page.
- `has_more` (true/false): True when more matches follow; raise Skip to see them.

**Example output**

```json
{
  "count": 23,
  "datasets": [
    {
      "api_endpoint": "https://data.cityofnewyork.us/resource/erm2-nwe9.json",
      "attribution": "311",
      "category": "Social Services",
      "columns": [
        {
          "description": "Incident location zip code, provided by geo validation.",
          "field_name": "incident_zip",
          "name": "Incident Zip",
          "type": "text"
        },
        {
          "description": "Provided by the submitter and confirmed by geovalidation.",
          "field_name": "borough",
          "name": "Borough",
          "type": "text"
        }
      ],
      "created_at": "2011-10-10T05:52:17.000Z",
      "description": "311 responds to thousands of inquiries, comments and requests from customers every single day.",
      "downloads": 608960,
      "id": "erm2-nwe9",
      "license": null,
      "name": "311 Service Requests from 2020 to Present",
      "page_url": "https://data.cityofnewyork.us/Social-Services/311-Service-Requests-from-2020-to-Present/erm2-nwe9",
      "portal": "data.cityofnewyork.us",
      "tags": [
        "311",
        "311 service requests",
        "city government",
        "pothole",
        "rodent"
      ],
      "type": "dataset",
      "updated_at": "2026-10-15T01:38:22.000Z",
      "views": 1327802
    }
  ],
  "has_more": true
}
```
