{
  "openapi": "3.0.1",
  "info": {
    "title": "Philadelphia L&I - Code Violations, Inspections & Complaints",
    "description": "Philadelphia L&I enforcement records (public open data, 5.2M rows, three linked tables): violation notices, inspector visit outcomes and resident complaints, with violation code and title, case status, dates, address, owner, parcel and geocode.",
    "version": "0.0",
    "x-build-id": "wgfjNrrKhPYYTdIdq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/j0401~philly-li-violations/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-j0401-philly-li-violations",
        "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~philly-li-violations/runs": {
      "post": {
        "operationId": "runs-sync-j0401-philly-li-violations",
        "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~philly-li-violations/run-sync": {
      "post": {
        "operationId": "run-sync-j0401-philly-li-violations",
        "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": {
          "corpus": {
            "title": "Record set",
            "enum": [
              "violations",
              "investigations",
              "complaints"
            ],
            "type": "string",
            "description": "Which of the three linked L&I tables to read. violations = the notices themselves (2,019,604). investigations = inspector visits and outcomes (2,117,950). complaints = what a resident reported (1,063,295). Filters and groupBy dimensions differ per record set; an unsupported combination is rejected rather than silently ignored.",
            "default": "violations"
          },
          "caseNumber": {
            "title": "Case number (contains)",
            "type": "string",
            "description": "Substring match on the L&I case number, e.g. 'CF-2026-073037'. The same number links a violation to its inspections. Blank = any.",
            "default": ""
          },
          "status": {
            "title": "Status",
            "type": "string",
            "description": "Exact status of the chosen record set, matched against that set's own vocabulary (violations: COMPLIED / CLOSED / OPEN / SVN ISSUED / ...; investigations: PASSED / FAILED / CLOSED / ...; complaints: CLOSED / UNDER INVESTIGATION / IN REVIEW / ...). A value that does not belong to the chosen set is rejected. Blank = any.",
            "default": ""
          },
          "caseStatus": {
            "title": "Case status (violations, complaints)",
            "enum": [
              "",
              "CLOSED",
              "IN VIOLATION",
              "COMPLIED, BALANCE DUE",
              "IN VIOLATION - COURT",
              "SVN ISSUED, BALANCE DUE",
              "UNDER INVESTIGATION",
              "CANCELLED",
              "STOP WORK"
            ],
            "type": "string",
            "description": "Case-level status, available on the violations and complaints record sets. Blank = any.",
            "default": ""
          },
          "caseType": {
            "title": "Case type (violations)",
            "enum": [
              "",
              "NOTICE OF VIOLATION",
              "SITE VIOLATION NOTICE",
              "WARNING",
              "VENDING CONFISCATION",
              "CODE VIOLATION NOTICE"
            ],
            "type": "string",
            "description": "Type of notice, on the violations record set only. Blank = any.",
            "default": ""
          },
          "violationNumber": {
            "title": "Violation number (contains)",
            "type": "string",
            "description": "Substring match on the violation number (violations record set). Blank = any.",
            "default": ""
          },
          "violationCode": {
            "title": "Violation code (contains)",
            "type": "string",
            "description": "Substring match on the violation code (violations record set). Blank = any.",
            "default": ""
          },
          "detail": {
            "title": "Violation title (contains)",
            "type": "string",
            "description": "Substring match on the human-readable violation code title (violations record set). Blank = any.",
            "default": ""
          },
          "investigationType": {
            "title": "Investigation type (contains)",
            "type": "string",
            "description": "Substring match on the inspection type, e.g. 'HCEU', 'PRECOURT' (investigations record set). Blank = any.",
            "default": ""
          },
          "complaintNumber": {
            "title": "Complaint number (contains)",
            "type": "string",
            "description": "Substring match on the complaint number (complaints record set). Blank = any.",
            "default": ""
          },
          "complaintCode": {
            "title": "Complaint code (contains)",
            "type": "string",
            "description": "Substring match on the complaint code (complaints record set). Blank = any.",
            "default": ""
          },
          "complaint": {
            "title": "Complaint type (contains)",
            "type": "string",
            "description": "Substring match on the complaint code's name, e.g. 'VACANT', 'MAINTENANCE' (complaints record set). Blank = any.",
            "default": ""
          },
          "ticket311": {
            "title": "311 ticket number (contains)",
            "type": "string",
            "description": "Substring match on the linked Philly311 ticket number. Present on 27% of complaints. Blank = any.",
            "default": ""
          },
          "address": {
            "title": "Address (contains)",
            "type": "string",
            "description": "Substring match on the property address. Blank = any.",
            "default": ""
          },
          "owner": {
            "title": "Owner of record (contains)",
            "type": "string",
            "description": "Substring match on the owner of record. Blank = any.",
            "default": ""
          },
          "zip": {
            "title": "ZIP (prefix)",
            "type": "string",
            "description": "ZIP or ZIP prefix. Blank = any.",
            "default": ""
          },
          "councilDistrict": {
            "title": "Council district",
            "minimum": 0,
            "type": "integer",
            "description": "City council district (1-10). Available on the violations and complaints record sets; the investigations layer has the column but every row is empty, so it is rejected there rather than returning zero rows. Blank = any."
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "Earliest date for the chosen record set: violation date for violations, completed date for investigations, complaint date for complaints. YYYY-MM-DD. Blank = any.",
            "default": ""
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Latest date, YYYY-MM-DD. Blank = any.",
            "default": ""
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "rows",
              "aggregate"
            ],
            "type": "string",
            "description": "rows = records of the chosen record set matching your filters (default). aggregate = one count row per group (see groupBy).",
            "default": "rows"
          },
          "groupBy": {
            "title": "Aggregate by",
            "enum": [
              "",
              "caseStatus",
              "caseType",
              "complaintCode",
              "complaintYear",
              "completedYear",
              "councilDistrict",
              "investigationType",
              "status",
              "violationYear"
            ],
            "type": "string",
            "description": "Which dimension to aggregate over (mode=aggregate). Blank = status. Dimensions are per record set: violations has status / caseStatus / caseType / councilDistrict / violationYear; investigations has status / investigationType / completedYear; complaints has status / complaintCode / councilDistrict / complaintYear. An unsupported pair is rejected. Every group is returned.",
            "default": ""
          },
          "maxResults": {
            "title": "Max records",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of records pushed in rows mode (0 = default 50; up to 2,000 per run). Each record is metered individually, so there is no per-run charge cap. Aggregate mode returns every group.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}