Weather API

API is supplied for educational purposes only.
It isn't intended for general public use and may change or be removed without notice.

Information

This API gets weather from the National Weather Service. No authentication is required to access this API. All resources are fully open and available and return data in JSON format.

All requests to this API must use the following base URL: https://teapi.netlify.app/api/weather/{endpoint}

This is a consumption-only API—only the HTTP GET method is available for these resources. Documentation on the available endpoints follows. Throughout the documentation curly braces are used to indicate values that must be substituted.

Note: The API generates an error response if the National Weather Service data is unavailable. If this occurs, sample data can be obtained by using test in place of the latitude and longitude coordinates. The sample data in the response includes an additional alert property indicating the data isn't real.

Endpoint: Forecast Office

This gets a location's ForecastOffice . The location is specified using latitude and longitude.

Endpoint: /geo/{latitude,longitude}

Example

GET https://teapi.netlify.app/api/weather/geo/41.5194,-81.6421

{
    "id": "CLE",
    "name": "Cleveland, OH",
    "address": {
        "@type": "PostalAddress",
        "streetAddress": "925 Keynote Circle\nSuite 314",
        "addressLocality": "Brooklyn Heights",
        "addressRegion": "OH",
        "postalCode": "44131"
    },
    "telephone": "(216) 416-2900",
    "email": "nwscle@noaa.gov",
    "web": "https://www.weather.gov/cle"
}

Resource: ForecastOffice

NameDescriptionType
id The id for this resource. string
name The name for this resource. string
address The postal address for this forecast office. PostalAddress
telephone The telephone number for this forecast office. string
email The email address for this forecast office. string
web The web url for this forecast office. string

Current Forecast

This gets the current weather forecast for a location. The location is specified using latitude and longitude.

Endpoint: /geo/{latitude,longitude}/forecast

Example

GET https://teapi.netlify.app/api/weather/geo/41.5194,-81.6421/forecast

{
    "updated": "2024-01-23T20:50:16+00:00",
    "elevation": {
        "unitCode": "wmoUnit:m",
        "value": 193.8528
    },
    "forecast": {
        "number": 1,
        "name": "Tonight",
        "startTime": "2024-01-23T21:00:00-05:00",
        "endTime": "2024-01-24T06:00:00-05:00",
        "isDaytime": false,
        "temperature": {
            "unitCode": "wmoUnit:degC",
            "value": 3.3333333333333335
        },
        "temperatureTrend": null,
        "probabilityOfPrecipitation": {
            "unitCode": "wmoUnit:percent",
            "value": 60
        },
        "dewpoint": {
            "unitCode": "wmoUnit:degC",
            "value": 3.3333333333333335
        },
        "relativeHumidity": {
            "unitCode": "wmoUnit:percent",
            "value": 97
        },
        "windSpeed": {
            "unitCode": "wmoUnit:km_h-1",
            "maxValue": 11.112,
            "minValue": 3.704
        },
        "windGust": null,
        "windDirection": "E",
        "icon": "https://api.weather.gov/icons/land/night/rain_showers,60?size=medium",
        "shortForecast": "Rain Showers Likely",
        "detailedForecast": "Rain showers likely and patchy fog. Cloudy, with a low around 38. East wind 2 to 7 mph. Chance of precipitation is 60%. New rainfall amounts less than a tenth of an inch possible."
    }
}

Resource: Forecast

NameDescriptionType
updated The time the forecast was published. timestamp
elevation The elevation for this location. Measurement
forecast The forecast for this location appropriate for the current time. ForecastPeriod

Hourly Forecast

This gets the hourly forecast for a location. The location is specified using latitude and longitude.

Endpoint: /geo/{latitude,longitude}/forecast/hourly

Example

GET https://teapi.netlify.app/api/weather/geo/41.5194,-81.6421/forecast/hourly

{
    "updated": "2024-02-06T20:45:22+00:00",
    "elevation": {
        "unitCode": "wmoUnit:m",
        "value": 193.8528
    },
    "periods": [
        {
            "number": 1,
            "name": "",
            "startTime": "2024-02-06T19:00:00-05:00",
            "endTime": "2024-02-06T20:00:00-05:00",
            "isDaytime": false,
            "temperature": {
                "unitCode": "wmoUnit:degC",
                "value": 1.1111111111111112
            },
            "temperatureTrend": null,
            "probabilityOfPrecipitation": {
                "unitCode": "wmoUnit:percent",
                "value": 0
            },
            "dewpoint": {
                "unitCode": "wmoUnit:degC",
                "value": -3.3333333333333335
            },
            "relativeHumidity": {
                "unitCode": "wmoUnit:percent",
                "value": 72
            },
            "windSpeed": {
                "unitCode": "wmoUnit:km_h-1",
                "value": 11.112
            },
            "windGust": null,
            "windDirection": "NE",
            "icon": "https://api.weather.gov/icons/land/night/skc?size=small",
            "shortForecast": "Clear",
            "detailedForecast": ""
        },
        {
            "number": 2,
            "name": "",
            "startTime": "2024-02-06T20:00:00-05:00",
            "endTime": "2024-02-06T21:00:00-05:00",
            "isDaytime": false,
            "temperature": {
                "unitCode": "wmoUnit:degC",
                "value": 0.5555555555555556
            },
            "temperatureTrend": null,
            "probabilityOfPrecipitation": {
                "unitCode": "wmoUnit:percent",
                "value": 0
            },
            "dewpoint": {
                "unitCode": "wmoUnit:degC",
                "value": -3.3333333333333335
            },
            "relativeHumidity": {
                "unitCode": "wmoUnit:percent",
                "value": 74
            },
            "windSpeed": {
                "unitCode": "wmoUnit:km_h-1",
                "value": 7.408
            },
            "windGust": null,
            "windDirection": "NE",
            "icon": "https://api.weather.gov/icons/land/night/few?size=small",
            "shortForecast": "Mostly Clear",
            "detailedForecast": ""
        },
        {
            "number": 3,
            "name": "",
            "startTime": "2024-02-06T21:00:00-05:00",
            "endTime": "2024-02-06T22:00:00-05:00",
            "isDaytime": false,
            "temperature": {
                "unitCode": "wmoUnit:degC",
                "value": 0
            },
            "temperatureTrend": null,
            "probabilityOfPrecipitation": {
                "unitCode": "wmoUnit:percent",
                "value": 0
            },
            "dewpoint": {
                "unitCode": "wmoUnit:degC",
                "value": -3.888888888888889
            },
            "relativeHumidity": {
                "unitCode": "wmoUnit:percent",
                "value": 76
            },
            "windSpeed": {
                "unitCode": "wmoUnit:km_h-1",
                "value": 7.408
            },
            "windGust": null,
            "windDirection": "NE",
            "icon": "https://api.weather.gov/icons/land/night/few?size=small",
            "shortForecast": "Mostly Clear",
            "detailedForecast": ""
        }
    ]
}

Resource: ForecastHourly

NameDescriptionType
updated The time the forecast was published. timestamp
elevation The elevation for this location. Measurement
periods A list forecast periods for this location. list ForecastPeriod

Common Types

This section defines common types used by this API.

Type: PostalAddress

NameDescriptionType
streetAddress The street address. This may include multiple lines. string
addressLocality The locality for this address. For US addresses, this is typically the city. string
addressRegion The postal region for this address. For US addresses, this is typically the state. string
postalCode The postal code for this address. For US addresses, this is the 5-digit or 9-digit zip code. string

Type: Measurement

A Measurement will have either a single measured value or a range specified using minValue and maxValue.

NameDescriptionType
unitCode A string denoting a unit of measure, expressed in the format "{unit}" or "{namespace}:{unit}". Units with the namespace "wmo" or "wmoUnit" are defined in the World Meteorological Organization Codes Registry. Units with the namespace "nwsUnit" are currently custom and do not align to any standard. Units with no namespace or the namespace "uc" are compliant with the Unified Code for Units of Measure syntax. string
value The measurement value using the specified unit. number
maxValue The maximum value of the range of measurement values using the specified unit. number
minValue The minimum value of the range of measurement values using the specified unit. number

Type: ForecastPeriod

NameDescriptionType
number A sequential forecast period number. number
name A label for the forecast, typically representing the relevant period of time. This is not included in hourly forecasts. string
startTime The time marking the start of the time period when the forecast is valid. timestamp
endTime The time marking the end of the forecast period. timestamp
isDaytime Indicates whether or not the forecast period is in the daytime (true) or nighttime (false). boolean
temperature The temperature expected for the forecast period. Measurement
temperatureTrend If not null, indicates a non-diurnal temperature trend for the period (either rising temperature overnight, or falling temperature during the day). string
probabilityOfPrecipitation The probability of precipitation for the forecast period. Measurement
dewpoint The dewpoint for the forecast period. Measurement
relativeHumidity The relative humidity for the forecast period. Measurement
windSpeed The wind speed for the forecast period. Measurement
windGust If not null, indicates the peak wind gust for the forecast period. Measurement
windDirection The prevailing direction of the wind for the forecast period, using a 16-point compass. string
icon Deprecated. A URL for image that can be used for as an icon for the weather conditions. string
shortForecast A brief text summary of the forecast for this period. string
detailedForecast A detailed text description of the forecast for this period. string