{
  "openapi": "3.0.1",
  "info": {
    "title": "Tap Water Quality Data England & Wales: Lead, Nitrate, E. coli",
    "description": "Drinking water test results from 15 water companies in one table: lead, nitrate, E. coli, iron, pesticides and more, by postcode, council or company. Each result is compared with the legal standard. Open data from Stream.",
    "version": "0.1",
    "x-build-id": "9JbW8t1ymhRiIUHNR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/thomasjacks~tap-water-quality-england-wales/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-thomasjacks-tap-water-quality-england-wales",
        "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/thomasjacks~tap-water-quality-england-wales/runs": {
      "post": {
        "operationId": "runs-sync-thomasjacks-tap-water-quality-england-wales",
        "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/thomasjacks~tap-water-quality-england-wales/run-sync": {
      "post": {
        "operationId": "run-sync-thomasjacks-tap-water-quality-england-wales",
        "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": {
          "output": {
            "title": "Output",
            "enum": [
              "results",
              "summary"
            ],
            "type": "string",
            "description": "Results: one row per laboratory result. Summary: one row per company, council, parameter and year, with the number of samples, how many were above the standard, the highest and the median.",
            "default": "results"
          },
          "parameters": {
            "title": "Parameters",
            "type": "array",
            "description": "What was measured, for example lead, nitrate, e. coli, iron, pH, hardness, pesticides or pfas (PFAS results are from Affinity Water only so far). Regulated parameters are matched by their Drinking Water Inspectorate code, other words by name. A DWI code such as C009 also works. Leave empty for every parameter.",
            "default": [
              "lead"
            ],
            "items": {
              "type": "string"
            }
          },
          "years": {
            "title": "Years",
            "type": "array",
            "description": "Calendar years such as 2024, 'latest' for the last complete year, or 'all'. Most companies publish a year at a time, some months after it ends. Data starts in 2016 for some companies and 2021 or 2022 for most.",
            "default": [
              "latest"
            ],
            "items": {
              "type": "string"
            }
          },
          "postcodes": {
            "title": "Postcodes",
            "type": "array",
            "description": "Results from the neighbourhood (LSOA, about 1,500 people) around each postcode, for example LS1 4AP. Samples are located to the neighbourhood, not the address.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "localAuthorities": {
            "title": "Councils",
            "type": "array",
            "description": "Results from a council area, for example Birmingham, Cornwall or Leeds. Use the current council name.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "lsoaCodes": {
            "title": "LSOA codes",
            "type": "array",
            "description": "ONS neighbourhood codes such as E01033620 (2011 or 2021 codes).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "companies": {
            "title": "Water companies",
            "type": "array",
            "description": "Leave empty for all companies with data. Thames Water and a few smaller companies do not publish tap water results on Stream.",
            "items": {
              "type": "string",
              "enum": [
                "Affinity Water",
                "Anglian Water",
                "Cambridge Water",
                "Dŵr Cymru Welsh Water",
                "Hafren Dyfrdwy",
                "Northumbrian Water",
                "Portsmouth Water",
                "SES Water",
                "Severn Trent Water",
                "South Staffs Water",
                "South West Water",
                "Southern Water",
                "United Utilities",
                "Wessex Water",
                "Yorkshire Water"
              ]
            },
            "default": []
          },
          "aboveStandardOnly": {
            "title": "Only results above the legal standard",
            "type": "boolean",
            "description": "Keep only results above the standard or indicator value in the Water Supply (Water Quality) Regulations. With no parameter chosen this checks every regulated parameter.",
            "default": false
          },
          "detectedOnly": {
            "title": "Only detected results",
            "type": "boolean",
            "description": "Leave out results reported as 'less than' the detection limit, and zeros. Useful for PFAS and pesticides.",
            "default": false
          },
          "dateFrom": {
            "title": "From date",
            "pattern": "^$|^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Keep samples taken on or after this date, as YYYY-MM-DD. If no years are given, the dates decide which years are read.",
            "default": ""
          },
          "dateTo": {
            "title": "To date",
            "pattern": "^$|^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Keep samples taken on or before this date, as YYYY-MM-DD.",
            "default": ""
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "highest",
              "newest",
              "oldest",
              "none"
            ],
            "type": "string",
            "description": "Highest: results above the standard first, then by how close they are to it. None is fastest and is the choice for large exports: rows are saved as they arrive and the run stops at the row limit.",
            "default": "highest"
          },
          "maxResults": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 10000000,
            "type": "integer",
            "description": "Stop after this many rows. With a sort order the limit is applied after sorting (up to 200,000 rows).",
            "default": 1000
          },
          "datasetTitleContains": {
            "title": "Only these source datasets (advanced)",
            "type": "array",
            "description": "Read only Stream datasets whose title contains this text, for example 'Southern Water Drinking Water Quality 2022_2026'. This switches off the rule that reads only one of two overlapping datasets.",
            "default": [],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}