{
  "openapi": "3.0.1",
  "info": {
    "title": "California Medical Facilities & Enforcement Actions",
    "description": "California medical facilities (public open data): the licensed-facility register (~10.9k hospitals/SNF/home-health/hospice/clinics) with category, status, beds and ER level; CDPH enforcement actions (~20.5k) with penalty class and appeals; and licensed/certified locations with CCN/NPI.",
    "version": "0.0",
    "x-build-id": "foIgi3cc1sBCDtylA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/j0401~ca-medical-facilities/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-j0401-ca-medical-facilities",
        "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~ca-medical-facilities/runs": {
      "post": {
        "operationId": "runs-sync-j0401-ca-medical-facilities",
        "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~ca-medical-facilities/run-sync": {
      "post": {
        "operationId": "run-sync-j0401-ca-medical-facilities",
        "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": "Corpus",
            "enum": [
              "facilities",
              "enforcement",
              "certified"
            ],
            "type": "string",
            "description": "facilities = the HCAI licensed-facility register (~10.9k). enforcement = CDPH state enforcement actions / penalties (~20.5k, 1997-present). certified = licensed-and-certified facility locations with CCN/NPI (~15.1k).",
            "default": "facilities"
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "rows",
              "aggregate"
            ],
            "type": "string",
            "description": "rows = records matching your filters (default). aggregate = one count row per group (see groupBy).",
            "default": "rows"
          },
          "groupBy": {
            "title": "Aggregate by",
            "enum": [
              "",
              "licenseCategory",
              "facilityStatus",
              "county",
              "erServiceLevel",
              "facilityLevel",
              "penaltyType",
              "disposition",
              "facilityType",
              "stateFiscalYear",
              "districtOffice",
              "appealed",
              "licensedCertified",
              "licenseStatus",
              "entityType",
              "deemed"
            ],
            "type": "string",
            "description": "Dimension to aggregate over (only used when mode=aggregate). Blank = the corpus's primary dimension. Must belong to the selected corpus: facilities -> licenseCategory / facilityStatus / county / erServiceLevel / facilityLevel; enforcement -> penaltyType / disposition / facilityType / stateFiscalYear / districtOffice / appealed; certified -> licensedCertified / licenseStatus / county / entityType / deemed.",
            "default": ""
          },
          "status": {
            "title": "Facility status (facilities)",
            "type": "string",
            "description": "facilities corpus only. Open / Suspense / Closed. Blank = any.",
            "default": ""
          },
          "licenseCategory": {
            "title": "License category (facilities)",
            "type": "string",
            "description": "facilities corpus only. Matches the licensing category: Hospital, Skilled Nursing, Home Health, Hospice, Community Clinic, Dialysis, Psychiatric, ... Blank = any.",
            "default": ""
          },
          "emergencyServicesOnly": {
            "title": "With emergency services only (facilities)",
            "type": "boolean",
            "description": "facilities corpus only. When on, returns only facilities that provide an emergency service level.",
            "default": false
          },
          "bedsMin": {
            "title": "Minimum beds (facilities)",
            "minimum": 0,
            "type": "integer",
            "description": "facilities corpus only. Only facilities licensed for at least this many beds. Bed counts are only present on bed-bearing types (hospitals, skilled nursing, psychiatric, congregate living). 0 = any.",
            "default": 0
          },
          "penaltyType": {
            "title": "Penalty type (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. Citation / Administrative Penalty / Failure to Report Penalty. Blank = any.",
            "default": ""
          },
          "disposition": {
            "title": "Disposition (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. Open / Closed. Blank = any.",
            "default": ""
          },
          "facilityType": {
            "title": "Facility type code (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. Exact source type code: SNF, GACH, ICFDDH, ICFDDN, CLHF, APH, HHA, HOSPICE, ... Blank = any.",
            "default": ""
          },
          "facility": {
            "title": "Facility name (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. Facility-name substring on the penalty record. Blank = any.",
            "default": ""
          },
          "issuedFrom": {
            "title": "Penalty issued on or after (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. Only penalties issued on/after this date (YYYY-MM-DD).",
            "default": ""
          },
          "issuedTo": {
            "title": "Penalty issued before (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. Only penalties issued before this date (YYYY-MM-DD).",
            "default": ""
          },
          "classAssessed": {
            "title": "Assessed class (enforcement)",
            "type": "string",
            "description": "enforcement corpus only. The class as initially assessed: AA, A, B (citation classes) or the penalty/failure-to-report routes (AP IJ, AP BR, AP NHPPD, AP NON-IJ, FTR AE, FTR BR, FTR RES, WF, NP, WO, RD). Blank = any.",
            "default": ""
          },
          "amountMin": {
            "title": "Minimum penalty amount (enforcement)",
            "minimum": 0,
            "type": "number",
            "description": "enforcement corpus only. Only penalties whose initial amount is at least this many dollars (numeric filter). 0 = any.",
            "default": 0
          },
          "amountMax": {
            "title": "Maximum penalty amount (enforcement)",
            "minimum": 0,
            "type": "number",
            "description": "enforcement corpus only. Only penalties whose initial amount is below this many dollars. 0 = any.",
            "default": 0
          },
          "deathRelated": {
            "title": "Death-related only (enforcement)",
            "type": "boolean",
            "description": "enforcement corpus only. When on, returns only penalties flagged as death-related.",
            "default": false
          },
          "appealed": {
            "title": "Appealed only (enforcement)",
            "type": "boolean",
            "description": "enforcement corpus only. When on, returns only penalties that were appealed.",
            "default": false
          },
          "licensedCertified": {
            "title": "Licensed/certified flag (certified)",
            "type": "string",
            "description": "certified corpus only. LICENSED AND CERTIFIED / LICENSED ONLY / CERTIFIED ONLY / NOT LICENSED/NOT CERTIFIED / EXEMPT FROM LICENSURE/NOT CERTIFIED. Blank = any.",
            "default": ""
          },
          "licenseStatus": {
            "title": "License status (certified)",
            "type": "string",
            "description": "certified corpus only. License-status substring: ACTIVE, INACTIVE - CAPEN DECISION, ... Blank = any.",
            "default": ""
          },
          "deemedOnly": {
            "title": "Deemed status only (certified)",
            "type": "boolean",
            "description": "certified corpus only. When on, returns only facilities with deemed (accreditation-based) Medicare status.",
            "default": false
          },
          "traumaCenter": {
            "title": "Trauma centers only (certified)",
            "type": "boolean",
            "description": "certified corpus only. When on, returns only designated trauma centers (level I-IV).",
            "default": false
          },
          "criticalAccess": {
            "title": "Critical-access hospitals only (certified)",
            "type": "boolean",
            "description": "certified corpus only. When on, returns only critical-access hospitals.",
            "default": false
          },
          "birthFacility": {
            "title": "Birthing facilities only (certified)",
            "type": "boolean",
            "description": "certified corpus only. When on, returns only facilities flagged as birthing facilities.",
            "default": false
          },
          "ccn": {
            "title": "CCN (certified)",
            "type": "string",
            "description": "certified corpus only. Exact Medicare/Medicaid provider number (CCN). Blank = any.",
            "default": ""
          },
          "npi": {
            "title": "NPI (certified)",
            "type": "string",
            "description": "certified corpus only. Exact National Provider Identifier. Blank = any.",
            "default": ""
          },
          "county": {
            "title": "County",
            "type": "string",
            "description": "County name substring, e.g. 'Los Angeles', 'Orange', 'San Diego'. Blank = any.",
            "default": ""
          },
          "city": {
            "title": "City",
            "type": "string",
            "description": "City substring (facilities / certified corpora). Blank = any.",
            "default": ""
          },
          "keywords": {
            "title": "Keywords",
            "type": "string",
            "description": "Free-text match on facility name (and license number for facilities, administrator / business name for certified). Blank = any.",
            "default": ""
          },
          "maxResults": {
            "title": "Max records",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the records pushed. 0 = the whole matching set (the request pages through the corpus, so a broad pull is complete, not truncated at a page). Each record is metered individually, so there is no per-run charge cap. An aggregate has at most a few hundred groups.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}