{
  "openapi": "3.0.1",
  "info": {
    "title": "NYC Business Licenses - Inspections, Violations, Complaints",
    "description": "NYC DCWP's licensing ecosystem (public open data): 72.5K licences, 65.9K applications, 278K field inspections, 137K violations with their Admin Code charge and hearing outcome, and 76.5K consumer complaints - all linked by business id, so one lookup returns a business's whole regulatory record.",
    "version": "0.0",
    "x-build-id": "j04oCJreFb0O3uTiL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/j0401~nyc-dcwp-licenses/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-j0401-nyc-dcwp-licenses",
        "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/j0401~nyc-dcwp-licenses/runs": {
      "post": {
        "operationId": "runs-sync-j0401-nyc-dcwp-licenses",
        "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/j0401~nyc-dcwp-licenses/run-sync": {
      "post": {
        "operationId": "run-sync-j0401-nyc-dcwp-licenses",
        "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",
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "",
              "licenses",
              "applications",
              "inspections",
              "violations",
              "complaints",
              "business",
              "aggregate"
            ],
            "type": "string",
            "description": "licenses = current licences (default). applications = licence applications. inspections = field inspections. violations = charges from those inspections (with hearing outcome). complaints = consumer complaints. business = EVERYTHING for one business id, in one response. aggregate = one count row per group.",
            "default": "licenses"
          },
          "corpus": {
            "title": "Aggregate table",
            "enum": [
              "",
              "licenses",
              "applications",
              "inspections",
              "violations",
              "complaints"
            ],
            "type": "string",
            "description": "Which table to aggregate - only used when mode=aggregate. Ignored otherwise.",
            "default": "licenses"
          },
          "groupBy": {
            "title": "Group by",
            "type": "string",
            "description": "Aggregate dimension, only used when mode=aggregate. Valid per table: licenses -> licenseStatus, licenseType, businessCategory, borough; applications -> applicationStatus, applicationType, intakeChannel, businessCategory; inspections -> inspectionType, inspectionStatus, borough; violations -> outcome, charge, cureEligible, businessCategory; complaints -> result, complaintCode, intakeChannel, businessCategory. Blank = a sensible default per table. Blank = a sensible default for the selected table - do not leave it set when switching corpus.",
            "default": ""
          },
          "businessId": {
            "title": "Business unique ID",
            "type": "string",
            "description": "Exact DCWP business id, e.g. 'BA-1305489-2022'. One id links the licence, applications, inspections, violations and complaints tables - this is the through-key. Blank = any. Use it with mode=business to pull one business's whole record.",
            "default": ""
          },
          "name": {
            "title": "Business name",
            "type": "string",
            "description": "Business name substring, e.g. 'GROCERY'. Blank = any.",
            "default": ""
          },
          "dba": {
            "title": "DBA / trade name",
            "type": "string",
            "description": "Doing-business-as name substring. Blank = any.",
            "default": ""
          },
          "category": {
            "title": "Business category",
            "type": "string",
            "description": "Category substring, e.g. 'Tobacco', 'Home Improvement'. Blank = any.",
            "default": ""
          },
          "borough": {
            "title": "Borough",
            "type": "string",
            "description": "Borough substring, e.g. 'Brooklyn'. Blank = any. Not available on the violations table.",
            "default": ""
          },
          "zip": {
            "title": "ZIP",
            "type": "string",
            "description": "ZIP prefix, e.g. '11216'. Blank = any. Not available on the violations table.",
            "default": ""
          },
          "licenseStatus": {
            "title": "Licence status",
            "enum": [
              "",
              "Active",
              "Expired",
              "Ready for Renewal",
              "Surrendered",
              "Voided",
              "Revoked",
              "Failed to Renew",
              "Suspended",
              "Out of Business",
              "Close"
            ],
            "type": "string",
            "description": "Exact licence status (licenses table only). Blank = any.",
            "default": ""
          },
          "licenseType": {
            "title": "Licence type",
            "type": "string",
            "description": "Licence-type substring (licenses / applications). Blank = any.",
            "default": ""
          },
          "applicationStatus": {
            "title": "Application status",
            "enum": [
              "",
              "Approved",
              "Closed",
              "Denied",
              "Additional Info Requested",
              "Submitted",
              "Withdrawn",
              "TOL Issued",
              "Additional Info Received",
              "FRU AIR Requested",
              "FRU AIR Received"
            ],
            "type": "string",
            "description": "Exact application status (applications table only). Blank = any.",
            "default": ""
          },
          "applicationType": {
            "title": "Application type",
            "enum": [
              "",
              "Renewal",
              "New"
            ],
            "type": "string",
            "description": "Exact application type (applications table only). Blank = any.",
            "default": ""
          },
          "intakeChannel": {
            "title": "Intake channel",
            "type": "string",
            "description": "How the case arrived - 'Online' / 'Walk-In' / '311' (applications / complaints). Blank = any.",
            "default": ""
          },
          "inspectionType": {
            "title": "Inspection type",
            "type": "string",
            "description": "Inspection-type substring (inspections table only), e.g. 'Tobacco'. Blank = any.",
            "default": ""
          },
          "inspectionStatus": {
            "title": "Inspection status",
            "enum": [
              "",
              "No Violation Issued",
              "Violation Issued",
              "Out of Business",
              "No Evidence of Activity",
              "Pass",
              "Closed",
              "Warning",
              "Fail",
              "Re-inspection",
              "Completed",
              "No Warning Issued",
              "Business Padlocked",
              "Unable to Locate",
              "NOH Withdrawn",
              "Posting Order Served"
            ],
            "type": "string",
            "description": "Exact inspection status (inspections table only). Blank = any.",
            "default": ""
          },
          "charge": {
            "title": "Violation charge",
            "type": "string",
            "description": "Charge-text substring (violations table only), e.g. 'FLAVORED', 'UNLICENSED'. Blank = any.",
            "default": ""
          },
          "outcome": {
            "title": "Violation outcome",
            "enum": [
              "",
              "Default Decision",
              "Pleaded",
              "Hearing Decision",
              "Charges Withdrawn",
              "Settlement (Pre-Hearing)",
              "Settlement (Post Hearing)",
              "Decision Dismissed"
            ],
            "type": "string",
            "description": "Exact hearing outcome (violations table only). Blank = any (many charges have no outcome yet).",
            "default": ""
          },
          "complaintResult": {
            "title": "Complaint result",
            "type": "string",
            "description": "Result-text substring (complaints table only), e.g. 'Referred'. Blank = any.",
            "default": ""
          },
          "issuedFrom": {
            "title": "Licence created from",
            "type": "string",
            "description": "Earliest licence creation date, YYYY-MM-DD (licenses only). Blank = any.",
            "default": ""
          },
          "issuedTo": {
            "title": "Licence created to",
            "type": "string",
            "description": "Latest licence creation date, YYYY-MM-DD (licenses only). Blank = any.",
            "default": ""
          },
          "submittedFrom": {
            "title": "Application submitted from",
            "type": "string",
            "description": "Earliest submission date, YYYY-MM-DD (applications only). Blank = any.",
            "default": ""
          },
          "submittedTo": {
            "title": "Application submitted to",
            "type": "string",
            "description": "Latest submission date, YYYY-MM-DD (applications only). Blank = any.",
            "default": ""
          },
          "inspectedFrom": {
            "title": "Inspected from",
            "type": "string",
            "description": "Earliest inspection date, YYYY-MM-DD (inspections only). Blank = any.",
            "default": ""
          },
          "inspectedTo": {
            "title": "Inspected to",
            "type": "string",
            "description": "Latest inspection date, YYYY-MM-DD (inspections only). Blank = any.",
            "default": ""
          },
          "violatedFrom": {
            "title": "Violated from",
            "type": "string",
            "description": "Earliest violation date, YYYY-MM-DD (violations only). Blank = any.",
            "default": ""
          },
          "violatedTo": {
            "title": "Violated to",
            "type": "string",
            "description": "Latest violation date, YYYY-MM-DD (violations only). Blank = any.",
            "default": ""
          },
          "receivedFrom": {
            "title": "Complaint received from",
            "type": "string",
            "description": "Earliest complaint intake date, YYYY-MM-DD (complaints only). Blank = any.",
            "default": ""
          },
          "receivedTo": {
            "title": "Complaint received to",
            "type": "string",
            "description": "Latest complaint intake date, YYYY-MM-DD (complaints only). Blank = any.",
            "default": ""
          },
          "maxResults": {
            "title": "Max records",
            "minimum": 0,
            "type": "integer",
            "description": "Cap records returned for this run. Default 50 keeps the daily auto-test fast. 0 = no cap (the full matching slice, up to 10,000).",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}