{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil Health Facilities (CNES, CNPJ, phone)",
    "description": "360k Brazilian hospitals, clinics, labs and pharmacies from DATASUS CNES: CNPJ, facility type, public/private sphere, SUS, beds, address, geo, phone, role e-mail, verified website, joined to the CNPJ registry. Company data only.",
    "version": "0.1",
    "x-build-id": "FEesw4AY9fVwgRfs7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/latsouth~brazil-health-facilities/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-latsouth-brazil-health-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/latsouth~brazil-health-facilities/runs": {
      "post": {
        "operationId": "runs-sync-latsouth-brazil-health-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/latsouth~brazil-health-facilities/run-sync": {
      "post": {
        "operationId": "run-sync-latsouth-brazil-health-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": {
          "states": {
            "title": "States (UF)",
            "type": "array",
            "description": "Leave empty for all of Brazil. Selecting states makes runs faster.",
            "items": {
              "type": "string",
              "enum": [
                "AC",
                "AL",
                "AM",
                "AP",
                "BA",
                "CE",
                "DF",
                "ES",
                "GO",
                "MA",
                "MG",
                "MS",
                "MT",
                "PA",
                "PB",
                "PE",
                "PI",
                "PR",
                "RJ",
                "RN",
                "RO",
                "RR",
                "RS",
                "SC",
                "SE",
                "SP",
                "TO"
              ],
              "enumTitles": [
                "AC - Acre",
                "AL - Alagoas",
                "AM - Amazonas",
                "AP - Amapa",
                "BA - Bahia",
                "CE - Ceara",
                "DF - Distrito Federal",
                "ES - Espirito Santo",
                "GO - Goias",
                "MA - Maranhao",
                "MG - Minas Gerais",
                "MS - Mato Grosso do Sul",
                "MT - Mato Grosso",
                "PA - Para",
                "PB - Paraiba",
                "PE - Pernambuco",
                "PI - Piaui",
                "PR - Parana",
                "RJ - Rio de Janeiro",
                "RN - Rio Grande do Norte",
                "RO - Rondonia",
                "RR - Roraima",
                "RS - Rio Grande do Sul",
                "SC - Santa Catarina",
                "SE - Sergipe",
                "SP - Sao Paulo",
                "TO - Tocantins"
              ]
            }
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "City names as in CNES, accents optional (e.g. Sao Paulo, Campinas, Belo Horizonte).",
            "items": {
              "type": "string"
            }
          },
          "facility_categories": {
            "title": "Facility categories",
            "type": "array",
            "description": "Broad groups of CNES unit types. Combined with the unit types below using OR. Leave both empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "hospital",
                "primary_care",
                "outpatient",
                "diagnostics",
                "pharmacy",
                "emergency",
                "services",
                "management",
                "public_health",
                "mobile",
                "other"
              ],
              "enumTitles": [
                "Hospitals (general, specialized, day hospital, birth center, mixed unit)",
                "Primary care (UBS, health posts, family health)",
                "Outpatient (specialty clinics, polyclinics, medical/dental offices, CAPS)",
                "Diagnostics (labs, imaging, blood banks)",
                "Pharmacies",
                "Emergency (UPA, emergency units, ambulances, dispatch)",
                "Services (home care, telehealth, staffing cooperatives, orthopedic workshops)",
                "Health management and regulation centers",
                "Public health (surveillance, immunization)",
                "Mobile units",
                "Other"
              ]
            }
          },
          "facility_types": {
            "title": "CNES unit types",
            "type": "array",
            "description": "Official CNES establishment types (TP_UNIDADE), e.g. 05 General hospital, 39 Diagnostic support unit, 43 Pharmacy.",
            "items": {
              "type": "string",
              "enum": [
                "01",
                "02",
                "04",
                "05",
                "07",
                "15",
                "16",
                "20",
                "21",
                "22",
                "32",
                "36",
                "39",
                "40",
                "42",
                "43",
                "50",
                "60",
                "61",
                "62",
                "64",
                "65",
                "67",
                "68",
                "69",
                "70",
                "71",
                "72",
                "73",
                "74",
                "75",
                "76",
                "77",
                "78",
                "79",
                "80",
                "81",
                "82",
                "83",
                "84",
                "85"
              ],
              "enumTitles": [
                "01 - Health post",
                "02 - Primary care health center (UBS)",
                "04 - Polyclinic",
                "05 - General hospital",
                "07 - Specialized hospital",
                "15 - Mixed unit (primary care with beds)",
                "16 - Other (CNES type 16, mostly outpatient clinics)",
                "20 - General emergency unit",
                "21 - Specialized emergency unit",
                "22 - Standalone medical/dental office",
                "32 - River mobile unit",
                "36 - Specialty clinic / specialty center",
                "39 - Diagnostic and therapy support unit (lab / imaging)",
                "40 - Land mobile unit",
                "42 - Pre-hospital emergency mobile unit (ambulance)",
                "43 - Pharmacy",
                "50 - Health surveillance unit",
                "60 - Health workforce cooperative or staffing company",
                "61 - Standalone birth center",
                "62 - Standalone day hospital",
                "64 - Health services regulation center",
                "65 - Health complex / health network",
                "67 - Central public health laboratory (LACEN)",
                "68 - Health management center",
                "69 - Blood bank / hematology center",
                "70 - Psychosocial care center (CAPS)",
                "71 - Family health support center",
                "72 - Indigenous health care unit",
                "73 - Urgent care unit (UPA / walk-in emergency)",
                "74 - Health gym hub (Academia da Saude)",
                "75 - Telehealth unit",
                "76 - Emergency medical dispatch center",
                "77 - Home care service",
                "78 - Residential care unit",
                "79 - Orthopedic workshop (prosthetics / orthotics)",
                "80 - Public health laboratory",
                "81 - Access regulation center",
                "82 - Organ procurement and distribution center",
                "83 - Disease prevention and health promotion hub",
                "84 - Supply center",
                "85 - Immunization center"
              ]
            }
          },
          "spheres": {
            "title": "Administrative sphere",
            "type": "array",
            "description": "From the legal nature of the facility's CNPJ. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "private_for_profit",
                "private_nonprofit",
                "municipal",
                "state",
                "federal",
                "other_public",
                "international"
              ],
              "enumTitles": [
                "Private, for-profit",
                "Private, non-profit (philanthropic hospitals, foundations, associations)",
                "Municipal",
                "State",
                "Federal",
                "Other public (public companies, consortia, public funds)",
                "International organization"
              ]
            }
          },
          "private_only": {
            "title": "Private facilities only",
            "type": "boolean",
            "description": "Keep only private facilities (for-profit and non-profit), i.e. drop municipal, state and federal units.",
            "default": false
          },
          "sus": {
            "title": "SUS (public health system)",
            "enum": [
              "any",
              "sus_only",
              "non_sus_only"
            ],
            "type": "string",
            "description": "Based on the payers each facility declares in CNES.",
            "default": "any"
          },
          "accepts_health_plans": {
            "title": "Only facilities that accept health plans",
            "type": "boolean",
            "description": "Keep only facilities that declare private or own health plans / insurers as payers.",
            "default": false
          },
          "min_beds": {
            "title": "Minimum beds",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum number of existing hospital beds (only hospitals and some clinics report beds)."
          },
          "keyword": {
            "title": "Keyword",
            "type": "string",
            "description": "Case- and accent-insensitive substring searched in the legal and trade names and the facility type (e.g. oncologia, cardio, laboratorio, odonto)."
          },
          "only_with_phone": {
            "title": "Only facilities with a phone",
            "type": "boolean",
            "description": "Keep only facilities with a valid registered phone (+55, DDD checked).",
            "default": false
          },
          "only_with_email": {
            "title": "Only facilities with a role e-mail",
            "type": "boolean",
            "description": "Keep only facilities with a role/generic e-mail (contato@, faturamento@, saude@ ...) on their own domain. Personal and Gmail/Hotmail addresses are never output.",
            "default": false
          },
          "only_with_website": {
            "title": "Only facilities with a verified website",
            "type": "boolean",
            "description": "Keep only facilities whose website answered an HTTP check (2xx/3xx, not parked).",
            "default": false
          },
          "only_with_contact": {
            "title": "Only facilities with a phone or e-mail",
            "type": "boolean",
            "description": "Keep only facilities with at least one company contact (phone or role e-mail).",
            "default": false
          },
          "sort_by": {
            "title": "Sort by",
            "enum": [
              "beds_desc",
              "services_desc",
              "updated_desc",
              "cnes"
            ],
            "type": "string",
            "description": "Order of results. Most beds first surfaces the largest hospitals.",
            "default": "beds_desc"
          },
          "max_results": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 400000,
            "type": "integer",
            "description": "You pay per facility returned (US$0.005 each: 1,000 facilities = US$5). The run also stops at your spending limit. Default 1,000 when called via API without this field.",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}