{
  "openapi": "3.1.0",
  "info": {
    "title": "Weather API",
    "version": "1.0.0",
    "description": "Current conditions, 48-hour hourly and 9-day daily forecasts for any coordinates, metric or imperial.\n\nCurrent conditions, hourly forecasts up to 48 hours and daily summaries up to 9 days for any coordinates worldwide — temperature, humidity, wind, pressure, cloud cover, precipitation and condition codes with plain-English text and day/night flags. Choose metric or imperial units and a UTC offset so daily summaries follow the local calendar day. Powered by MET Norway's global forecast model (CC BY 4.0), cached per location until the forecast expires.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/weather.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/weather"
  },
  "servers": [
    {
      "url": "https://api-weather.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Data",
      "description": "Weather API belongs to the Data category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/sources": {
      "get": {
        "operationId": "dataSources",
        "summary": "Data Sources",
        "description": "Data Sources endpoint of the Weather API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/weather/data-sources"
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "sources": [
                    {
                      "slug": "met-norway-locationforecast",
                      "name": "MET Norway (api.met.no)",
                      "url": "https://api.met.no/weatherapi/locationforecast/2.0/compact",
                      "license": "CC BY 4.0",
                      "license_url": "https://creativecommons.org/licenses/by/4.0/",
                      "cadence": "model runs every ~1-6h; edge-cached per location until MET's Expires header"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/weather": {
      "get": {
        "operationId": "getForecast",
        "summary": "Get Forecast",
        "description": "Get Forecast endpoint of the Weather API. Costs 10 tokens per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/weather/get-forecast"
        },
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "3"
          },
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2"
          },
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "40.71"
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "-74.0"
          },
          {
            "name": "units",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "metric"
          },
          {
            "name": "utc_offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "-4"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "latitude": 40.71,
                  "longitude": -74,
                  "units": "metric",
                  "utc_offset_hours": -4,
                  "updated_at": "2026-09-12T01:23:45Z",
                  "expires_at": "2026-09-12T02:18:32.000Z",
                  "current": {
                    "time": "2026-09-12T01:00:00Z",
                    "temperature_c": 22.5,
                    "humidity_pct": 49.9,
                    "wind_speed_ms": 2.3,
                    "wind_direction_deg": 314.9,
                    "pressure_hpa": 1015.9,
                    "cloud_cover_pct": 0,
                    "precipitation_mm": 0,
                    "condition": "clearsky_night",
                    "condition_text": "Clear sky",
                    "is_day": false
                  },
                  "source": "MET Norway (api.met.no)",
                  "license": "CC BY 4.0",
                  "license_url": "https://creativecommons.org/licenses/by/4.0/",
                  "hourly": [
                    {
                      "time": "2026-09-12T01:00:00Z",
                      "temperature_c": 22.5,
                      "humidity_pct": 49.9,
                      "wind_speed_ms": 2.3,
                      "wind_direction_deg": 314.9,
                      "pressure_hpa": 1015.9,
                      "cloud_cover_pct": 0,
                      "precipitation_mm": 0,
                      "condition": "clearsky_night",
                      "condition_text": "Clear sky",
                      "is_day": false
                    }
                  ],
                  "daily": [
                    {
                      "date": "2026-09-11",
                      "temp_min_c": 20.9,
                      "temp_max_c": 22.5,
                      "precipitation_mm": 0,
                      "condition": "clearsky_night",
                      "condition_text": "Clear sky",
                      "is_day": false,
                      "samples": 3,
                      "partial": true
                    },
                    {
                      "date": "2026-09-12",
                      "temp_min_c": 17.1,
                      "temp_max_c": 26,
                      "precipitation_mm": 0,
                      "condition": "cloudy",
                      "condition_text": "Cloudy",
                      "is_day": null,
                      "samples": 24,
                      "partial": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 10 tokens per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}