{
  "openapi": "3.0.1",
  "info": {
    "title": "Socrata Open Data API Query (SoQL) for Government Portals",
    "description": "Returns rows from any dataset on a Socrata open-data portal (NYC, Chicago, Seattle, CDC, state portals) via the official SODA API with SoQL filters, plus dataset metadata and columns, or a keyword search of 500+ portal catalogs. Honours robots.txt. Priced per 100 rows.",
    "version": "0.1",
    "x-build-id": "h53o2WhoUtFBxiLnJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lathewright~socrata-open-data-query/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lathewright-socrata-open-data-query",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/lathewright~socrata-open-data-query/runs": {
      "post": {
        "operationId": "runs-sync-lathewright-socrata-open-data-query",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/lathewright~socrata-open-data-query/run-sync": {
      "post": {
        "operationId": "run-sync-lathewright-socrata-open-data-query",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "query",
              "datasetInfo",
              "catalogSearch"
            ],
            "type": "string",
            "description": "`query` pulls rows from one dataset. `datasetInfo` returns its metadata, columns and row count. `catalogSearch` finds datasets across portals.",
            "default": "query"
          },
          "domain": {
            "title": "Portal domain",
            "type": "string",
            "description": "Host of the portal, e.g. `data.cityofnewyork.us`, `data.cityofchicago.org`, `data.seattle.gov`, `data.cdc.gov`, `data.ny.gov`."
          },
          "datasetId": {
            "title": "Dataset ID",
            "type": "string",
            "description": "The 4x4 identifier from the dataset URL, e.g. `erm2-nwe9` (NYC 311 service requests)."
          },
          "select": {
            "title": "$select",
            "type": "string",
            "description": "Columns or aggregates, e.g. `unique_key, created_date, complaint_type, incident_zip` or `complaint_type, count(*)`. Empty = all columns."
          },
          "where": {
            "title": "$where",
            "type": "string",
            "description": "SoQL filter, e.g. `created_date > '2026-10-01T00:00:00' AND complaint_type = 'Noise - Residential'`."
          },
          "q": {
            "title": "$q (full-text search) / catalog query",
            "type": "string",
            "description": "Full-text search across the dataset's text columns in `query` mode, or the search words in `catalogSearch` mode."
          },
          "order": {
            "title": "$order",
            "type": "string",
            "description": "Sort, e.g. `created_date DESC`."
          },
          "group": {
            "title": "$group",
            "type": "string",
            "description": "Group-by columns for aggregates in `$select`."
          },
          "having": {
            "title": "$having",
            "type": "string",
            "description": "Filter on aggregates, e.g. `count(*) > 10`."
          },
          "maxRows": {
            "title": "Max rows (or datasets)",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Row cap for `query` (billed per started block of 100) or dataset cap for `catalogSearch`.",
            "default": 25
          },
          "pageSize": {
            "title": "Page size",
            "minimum": 100,
            "maximum": 10000,
            "type": "integer",
            "description": "Rows per request to the portal.",
            "default": 1000
          },
          "offset": {
            "title": "Start offset",
            "minimum": 0,
            "type": "integer",
            "description": "Skip this many rows first (continue a previous pull with its `nextOffset`).",
            "default": 0
          },
          "domains": {
            "title": "Catalog: portal domains",
            "type": "array",
            "description": "Restrict `catalogSearch` to these portals.",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Catalog: categories",
            "type": "array",
            "description": "Restrict `catalogSearch` to portal categories such as `Public Safety`, `Transportation`, `Health`.",
            "items": {
              "type": "string"
            }
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Your free application token (any Socrata portal > Developer settings). Raises the per-IP throttling limits."
          },
          "compactOutput": {
            "title": "Compact output",
            "type": "boolean",
            "description": "Return only the key fields (smaller, cheaper for AI agents to read).",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}