{
  "openapi": "3.0.1",
  "info": {
    "title": "Extract WAQI Air Quality Data with Forecasts",
    "description": "Extract real-time WAQI AQI, pollutant readings, weather, station coordinates, attribution, and forecasts for cities, stations, searches, and map bounds.",
    "version": "1.0",
    "x-build-id": "A7y4Ye5Yh4RX3bOv2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/muhammadafzal~waqi-air-quality-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-muhammadafzal-waqi-air-quality-scraper",
        "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/muhammadafzal~waqi-air-quality-scraper/runs": {
      "post": {
        "operationId": "runs-sync-muhammadafzal-waqi-air-quality-scraper",
        "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/muhammadafzal~waqi-air-quality-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-muhammadafzal-waqi-air-quality-scraper",
        "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": {
          "locations": {
            "title": "Cities or station IDs",
            "type": "array",
            "description": "Use this for one or more WAQI city names, station names, station IDs such as @12345, or geo strings such as geo:31.23;121.47. Use coordinates for latitude/longitude and searchQueries when you want WAQI station search. Defaults to Shanghai.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "default": [
              "Shanghai"
            ]
          },
          "searchQueries": {
            "title": "Search station names",
            "type": "array",
            "description": "Use this when you want WAQI to find matching stations by name, city, country, or native-language text. The actor then fetches full AQI and pollutant data for matching stations. Do not use this for an exact station ID; use locations instead.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "default": []
          },
          "coordinates": {
            "title": "Latitude and longitude",
            "type": "array",
            "description": "Use this for one or more geographic points. Each item must contain latitude and longitude, for example [{\"latitude\": 31.2304, \"longitude\": 121.4737}]. The actor uses WAQI's nearest-station geo feed.",
            "items": {
              "type": "object",
              "properties": {
                "latitude": {
                  "title": "Latitude",
                  "description": "Decimal latitude from -90 to 90.",
                  "type": "number",
                  "minimum": -90,
                  "maximum": 90
                },
                "longitude": {
                  "title": "Longitude",
                  "description": "Decimal longitude from -180 to 180.",
                  "type": "number",
                  "minimum": -180,
                  "maximum": 180
                }
              },
              "required": [
                "latitude",
                "longitude"
              ]
            },
            "default": []
          },
          "bounds": {
            "title": "Map bounds",
            "type": "array",
            "description": "Use this to list stations inside bounding boxes formatted as south,west,north,east, for example 22.01,112.69,22.37,113.02. This is useful for map or regional station inventories; use locations for a single city feed.",
            "items": {
              "type": "string",
              "pattern": "^-?\\d+(?:\\.\\d+)?,-?\\d+(?:\\.\\d+)?,-?\\d+(?:\\.\\d+)?,-?\\d+(?:\\.\\d+)?$"
            },
            "default": []
          },
          "startUrls": {
            "title": "WAQI or AQICN URLs",
            "type": "array",
            "description": "Use this when you already have a WAQI API feed URL or a public AQICN city URL. API URLs are used directly; public /city/{slug} pages are converted to the official WAQI feed endpoint. This supplements locations and searchQueries.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "title": "URL",
                  "description": "Absolute WAQI API or AQICN city URL.",
                  "type": "string"
                }
              },
              "required": [
                "url"
              ]
            },
            "default": []
          },
          "maxResults": {
            "title": "Maximum records",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Use this to cap total unique station or city records returned across all inputs. Enter 1 to 1000; defaults to 10. This is a result cap, not a per-query cap.",
            "default": 10
          },
          "includeForecast": {
            "title": "Include daily forecast",
            "type": "boolean",
            "description": "Use this when you need WAQI daily pollutant forecasts in addition to current AQI and readings. Defaults to true. Set false for a smaller current-conditions-only dataset.",
            "default": true
          },
          "requestDelayMs": {
            "title": "Delay between API requests (ms)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Use this to add respectful pacing between WAQI API calls. Defaults to 250 milliseconds; use 0 only for small authorized test runs.",
            "default": 250
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}