{
  "openapi": "3.0.3",
  "info": {
    "title": "weatherAI.io Decision API",
    "version": "1.0.0",
    "description": "One call turns the weather into a decision: a verdict, a 0-100 score, the best time windows and the risks for an activity at a place and date. 1,000 free calls every month, then £0.0012 per successful call from prepaid credit (VAT included). Failed calls are not charged. AI agents can also use the MCP server at https://api.weatherai.io/mcp."
  },
  "servers": [
    {
      "url": "https://api.weatherai.io"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Window": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "example": "2026-10-18 07:00"
          },
          "end": {
            "type": "string",
            "example": "2026-10-18 10:00"
          },
          "score": {
            "type": "integer",
            "example": 91
          }
        }
      },
      "Risk": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "rain"
          },
          "severity": {
            "type": "string",
            "enum": [
              "low",
              "moderate",
              "high",
              "severe",
              "extreme"
            ]
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "detail": {
            "type": "string",
            "example": "70% chance of rain"
          }
        }
      },
      "Decision": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              },
              "tz_id": {
                "type": "string"
              },
              "localtime": {
                "type": "string"
              }
            }
          },
          "activity": {
            "type": "string",
            "enum": [
              "running",
              "cycling",
              "outdoor-event",
              "beach",
              "laundry-drying",
              "stargazing",
              "hiking",
              "golf",
              "tennis",
              "dog-walking",
              "gardening",
              "fishing",
              "sailing",
              "drone-flying",
              "exterior-painting",
              "concrete-pour",
              "roofing",
              "crop-spraying",
              "outdoor-work",
              "driving",
              "solar-pv"
            ]
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "great",
              "good",
              "fair",
              "poor",
              "avoid"
            ]
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Quality of the best opportunity on that date (best window)."
          },
          "best_windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Window"
            }
          },
          "risks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Risk"
            }
          },
          "summary": {
            "type": "string",
            "example": "Great conditions for a run in London; best 07:00–10:00. Watch for rain from 14:00."
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Key figures for the hours considered (temperatures, rain, wind, UV, sunrise/sunset; moon for stargazing). When available: air quality (air_quality, air_quality_us_epa_max, pm2_5_max, pm10_max), pollen levels (pollen_tree, pollen_grass, pollen_weed, pollen_max: none/low/moderate/high/very high), sunshine_pct_avg, sunshine_hours, solar_ghi_max_wm2, solar_dni_max_wm2, solar_gti_max_wm2, solar_energy_kwh_m2, solar_panel_energy_kwh_m2, wetbulb_max, snow_total_cm (snow_total_in), pressure_mb (pressure_in), pressure_trend and wind_dir."
          },
          "hourly": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "time": {
                  "type": "string"
                },
                "score": {
                  "type": "integer"
                },
                "main_issue": {
                  "type": "string",
                  "nullable": true
                }
              }
            },
            "description": "Only with detail=hourly."
          },
          "billing": {
            "type": "object",
            "properties": {
              "charged": {
                "type": "string",
                "enum": [
                  "free",
                  "credit"
                ]
              },
              "cost_gbp": {
                "type": "string",
                "example": "0.0012"
              },
              "free_remaining": {
                "type": "integer"
              },
              "balance_gbp": {
                "type": "string"
              }
            }
          }
        }
      },
      "DayRanking": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "weekday": {
            "type": "string"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "great",
              "good",
              "fair",
              "poor",
              "avoid"
            ]
          },
          "score": {
            "type": "integer"
          },
          "best_window": {
            "$ref": "#/components/schemas/Window"
          },
          "top_risks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Risk"
            }
          },
          "summary": {
            "type": "string"
          }
        }
      },
      "BestDay": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object"
          },
          "activity": {
            "type": "string"
          },
          "days_checked": {
            "type": "integer"
          },
          "summary": {
            "type": "string"
          },
          "best": {
            "$ref": "#/components/schemas/DayRanking"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DayRanking"
            }
          },
          "billing": {
            "type": "object"
          }
        }
      },
      "RuleLimits": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "temp_min_c": {
            "type": "number"
          },
          "temp_max_c": {
            "type": "number"
          },
          "feels_like_min_c": {
            "type": "number"
          },
          "feels_like_max_c": {
            "type": "number"
          },
          "wind_max_kph": {
            "type": "number"
          },
          "wind_min_kph": {
            "type": "number"
          },
          "gust_max_kph": {
            "type": "number"
          },
          "rain_chance_max": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "precip_max_mm": {
            "type": "number"
          },
          "snow_chance_max": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "humidity_max": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "visibility_min_km": {
            "type": "number"
          },
          "uv_max": {
            "type": "number"
          },
          "no_thunder": {
            "type": "boolean"
          },
          "daylight_only": {
            "type": "boolean"
          }
        },
        "description": "Hard limits: an hour that breaks one scores 0. All optional; metric units."
      },
      "ProfileInput": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "base_activity": {
            "type": "string",
            "enum": [
              "running",
              "cycling",
              "outdoor-event",
              "beach",
              "laundry-drying",
              "stargazing",
              "hiking",
              "golf",
              "tennis",
              "dog-walking",
              "gardening",
              "fishing",
              "sailing",
              "drone-flying",
              "exterior-painting",
              "concrete-pour",
              "roofing",
              "crop-spraying",
              "outdoor-work",
              "driving",
              "solar-pv",
              "crane-lifting",
              "groundworks",
              "marquee",
              "outdoor-dining",
              "harvesting",
              "irrigation",
              "high-sided-vehicles",
              "field-service",
              "wind-power"
            ],
            "description": "Default outdoor-work"
          },
          "min_hours": {
            "type": "integer",
            "minimum": 1
          },
          "from_hour": {
            "type": "integer",
            "minimum": 0,
            "maximum": 23
          },
          "to_hour": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30
          },
          "limits": {
            "$ref": "#/components/schemas/RuleLimits"
          }
        }
      },
      "Profile": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProfileInput"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "prf_7KxQ2mWb9TzLp4"
              },
              "description": {
                "type": "string"
              },
              "created": {
                "type": "string",
                "format": "date-time"
              },
              "updated": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "AlertInput": {
        "type": "object",
        "required": [
          "name",
          "location"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "location": {
            "type": "string"
          },
          "activity": {
            "type": "string",
            "enum": [
              "running",
              "cycling",
              "outdoor-event",
              "beach",
              "laundry-drying",
              "stargazing",
              "hiking",
              "golf",
              "tennis",
              "dog-walking",
              "gardening",
              "fishing",
              "sailing",
              "drone-flying",
              "exterior-painting",
              "concrete-pour",
              "roofing",
              "crop-spraying",
              "outdoor-work",
              "driving",
              "solar-pv",
              "crane-lifting",
              "groundworks",
              "marquee",
              "outdoor-dining",
              "harvesting",
              "irrigation",
              "high-sided-vehicles",
              "field-service",
              "wind-power"
            ]
          },
          "profile": {
            "type": "string",
            "description": "prf_... instead of activity"
          },
          "days_ahead": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7,
            "default": 2
          },
          "notify_when": {
            "type": "string",
            "enum": [
              "change",
              "becomes_go",
              "becomes_no_go"
            ],
            "default": "change"
          },
          "interval_hours": {
            "type": "integer",
            "enum": [
              1,
              3,
              6,
              12
            ],
            "default": 3
          },
          "email": {
            "type": "boolean",
            "default": true
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "https only"
          }
        }
      },
      "Alert": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AlertInput"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "alr_Qm3xT8bKw2NcZr"
              },
              "place": {
                "type": "string"
              },
              "webhook_secret": {
                "type": "string",
                "description": "Full value only in the response to POST /v1/alerts"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "paused"
                ]
              },
              "pause_reason": {
                "type": "string"
              },
              "next_check": {
                "type": "string",
                "format": "date-time"
              },
              "last_checked": {
                "type": "string",
                "format": "date-time"
              },
              "last_notified": {
                "type": "string",
                "format": "date-time"
              },
              "notifications_sent": {
                "type": "integer"
              },
              "outlook": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string"
                    },
                    "go": {
                      "type": "boolean"
                    },
                    "verdict": {
                      "type": "string"
                    },
                    "score": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Widget": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "location": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            }
          },
          "activity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "theme": {
            "type": "string",
            "enum": [
              "auto",
              "light",
              "dark"
            ]
          },
          "best_date": {
            "type": "string",
            "nullable": true,
            "description": "The best go day when more than one day is shown."
          },
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "weekday": {
                  "type": "string"
                },
                "label": {
                  "type": "string",
                  "description": "\"Today\", \"Tomorrow\" or the short weekday, by the place's local date.",
                  "example": "Tomorrow"
                },
                "verdict": {
                  "type": "string"
                },
                "score": {
                  "type": "integer"
                },
                "go": {
                  "type": "boolean"
                },
                "window_start": {
                  "type": "string",
                  "nullable": true,
                  "example": "10:00"
                },
                "window_end": {
                  "type": "string",
                  "nullable": true
                },
                "summary": {
                  "type": "string"
                }
              }
            }
          },
          "updated_utc": {
            "type": "string",
            "format": "date-time"
          },
          "link": {
            "type": "string",
            "description": "Link for the required \"Powered by weatherAI.io\" credit."
          }
        }
      }
    }
  },
  "paths": {
    "/v1/decide": {
      "get": {
        "operationId": "decide",
        "summary": "Decide whether and when to do an activity",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "City name, 'lat,lon', postcode, zip code or IP address.",
            "example": "London"
          },
          {
            "name": "activity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "cycling",
                "outdoor-event",
                "beach",
                "laundry-drying",
                "stargazing",
                "hiking",
                "golf",
                "tennis",
                "dog-walking",
                "gardening",
                "fishing",
                "sailing",
                "drone-flying",
                "exterior-painting",
                "concrete-pour",
                "roofing",
                "crop-spraying",
                "outdoor-work",
                "driving",
                "solar-pv",
                "crane-lifting",
                "groundworks",
                "marquee",
                "outdoor-dining",
                "harvesting",
                "irrigation",
                "high-sided-vehicles",
                "field-service",
                "wind-power"
              ]
            },
            "description": "See GET /v1/activities. Aliases such as run, bike, bbq, wedding, laundry, crane and hgv are accepted. Required unless profile is given."
          },
          {
            "name": "profile",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^prf_[A-Za-z0-9]+$"
            },
            "description": "Id of one of your custom rules (see /v1/profiles), used instead of activity. Give activity or profile."
          },
          {
            "name": "when",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "today (default), tomorrow or yyyy-MM-dd, up to 13 days ahead.",
            "example": "tomorrow"
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23
            },
            "description": "Only consider hours from this hour (local time)."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 24
            },
            "description": "Only consider hours before this hour (local time)."
          },
          {
            "name": "units",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "metric",
                "imperial"
              ]
            }
          },
          {
            "name": "detail",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hourly"
              ]
            },
            "description": "Add an hour-by-hour score."
          },
          {
            "name": "pollen_sensitive",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "true for people with hay fever: moderate or higher pollen lowers the score. Without it pollen is only reported (risks and data)."
          }
        ],
        "responses": {
          "200": {
            "description": "Decision. Headers X-Free-Calls-Remaining, X-Credit-Balance-GBP and X-Call-Cost-GBP show billing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Decision"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Free calls used up and no credit left: top up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Email not verified or account suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Location not found (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "No forecast hours left for that date/time range (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests per second (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Weather data temporarily unavailable (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/best-day": {
      "get": {
        "operationId": "bestDay",
        "summary": "Which of the next days is best for an activity",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "City name, 'lat,lon', postcode, zip code or IP address.",
            "example": "London"
          },
          {
            "name": "activity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "cycling",
                "outdoor-event",
                "beach",
                "laundry-drying",
                "stargazing",
                "hiking",
                "golf",
                "tennis",
                "dog-walking",
                "gardening",
                "fishing",
                "sailing",
                "drone-flying",
                "exterior-painting",
                "concrete-pour",
                "roofing",
                "crop-spraying",
                "outdoor-work",
                "driving",
                "solar-pv",
                "crane-lifting",
                "groundworks",
                "marquee",
                "outdoor-dining",
                "harvesting",
                "irrigation",
                "high-sided-vehicles",
                "field-service",
                "wind-power"
              ]
            },
            "description": "See GET /v1/activities. Aliases such as run, bike, bbq, wedding, laundry, crane and hgv are accepted. Required unless profile is given."
          },
          {
            "name": "profile",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^prf_[A-Za-z0-9]+$"
            },
            "description": "Id of one of your custom rules (see /v1/profiles), used instead of activity. Give activity or profile."
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 14,
              "default": 7
            },
            "description": "How many days to compare, starting today."
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23
            },
            "description": "Only consider hours from this hour (local time)."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 24
            },
            "description": "Only consider hours before this hour (local time)."
          },
          {
            "name": "units",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "metric",
                "imperial"
              ]
            }
          },
          {
            "name": "pollen_sensitive",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "true for people with hay fever: moderate or higher pollen lowers the score. Without it pollen is only reported (risks and data)."
          }
        ],
        "responses": {
          "200": {
            "description": "The days ranked, with the best one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BestDay"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Free calls used up and no credit left: top up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Email not verified or account suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Location not found (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "No forecast hours left for that date/time range (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests per second (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Weather data temporarily unavailable (not charged)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Compares up to 14 days (default 7, starting today in local time) for one activity and ranks them. Costs one call however many days are compared."
      }
    },
    "/v1/activities": {
      "get": {
        "operationId": "listActivities",
        "summary": "List the activities and industry packs you can ask about (free, no key)",
        "responses": {
          "200": {
            "description": "Activities"
          }
        },
        "parameters": [
          {
            "name": "pack",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "construction",
                "events",
                "agriculture",
                "logistics",
                "energy"
              ]
            },
            "description": "Only list one industry pack's activities."
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "usage",
        "summary": "Free calls left this month and credit balance (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usage"
          },
          "401": {
            "description": "Invalid key"
          }
        }
      }
    },
    "/v1/profiles": {
      "get": {
        "operationId": "listProfiles",
        "summary": "List your custom rules (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Rules"
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createProfile",
        "summary": "Create a custom rule (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfileInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/profiles/{id}": {
      "get": {
        "operationId": "getProfile",
        "summary": "Get a custom rule (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateProfile",
        "summary": "Change a custom rule; fields left out keep their values (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfileInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteProfile",
        "summary": "Delete a custom rule (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts": {
      "get": {
        "operationId": "listAlerts",
        "summary": "List your alerts with their latest outlook (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts"
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAlert",
        "summary": "Create an alert: email/webhook when a day switches go/no-go. Checks are free; each notification costs one call.",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{id}": {
      "get": {
        "operationId": "getAlert",
        "summary": "Get an alert (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteAlert",
        "summary": "Delete an alert (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{id}/pause": {
      "post": {
        "operationId": "pauseAlert",
        "summary": "Pause an alert (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{id}/resume": {
      "post": {
        "operationId": "resumeAlert",
        "summary": "Resume an alert (free)",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/widget/{id}": {
      "get": {
        "operationId": "getWidget",
        "summary": "Public answer behind an embedded website widget (no key; the widget's owner pays one call per refresh, at most every 30 minutes)",
        "description": "Create widgets at https://www.weatherai.io/account/widgets. Only the websites listed for the widget (and their subdomains) may call it from a browser: other Origin or Referer hosts get 403 domain_not_allowed. Never includes account or billing details.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^wgt_[A-Za-z0-9]{4,20}$"
            },
            "description": "Widget id (wgt_...)."
          }
        ],
        "responses": {
          "200": {
            "description": "Widget data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Widget"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed on this website (domain_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or switched off (widget_not_found)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Forecast not available right now, e.g. the owner has no free calls or credit left (widget_unavailable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}
