Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This guide will help you make your first API calls to retrieve weather data.

Prerequisites

Your First Request

Let’s retrieve a Point Forecast for Boulder, Colorado:

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/forecast/point?lat=40.018672&lon=-105.250537&bundles=basic' \
  -H 'spire-api-key: YOUR_API_KEY'

Example Response

{
  "meta": {
    "unit_system": "si",
    "forecast": "Spire SOF-D Forecast",
    "units": {
      "relative_humidity": "%",
      "air_temperature": "degreeK",
      "dew_point_temperature": "degreeK",
      "northward_wind": "m/s",
      "eastward_wind": "m/s"
    }
  },
  "data": [
    {
      "location": {
        "coordinates": {
          "lat": 40.018672,
          "lon": -105.250537,
          "elevation": 1655.0
        }
      },
      "times": {
        "issuance_time": "2024-01-15T00:00:00",
        "valid_time": "2024-01-15T00:00:00"
      },
      "values": {
        "relative_humidity": 75.67,
        "air_temperature": 258.00,
        "dew_point_temperature": 257.25,
        "northward_wind": 1.55,
        "eastward_wind": -1.97
      }
    }
  ]
}

Common Use Cases

Get Current Weather

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/current/weather/point?lat=40.0&lon=-105.0' \
  -H 'spire-api-key: YOUR_API_KEY'

List Available Forecast Files

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/forecast/file?bundles=basic&regions=global' \
  -H 'spire-api-key: YOUR_API_KEY'

Get Latest Forecast

Use the /forecast/latest/point endpoint to get the most recent forecast without specifying an Issuance Time:

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/forecast/latest/point?lat=40.0&lon=-105.0&bundles=basic' \
  -H 'spire-api-key: YOUR_API_KEY'

Selecting Data Bundles

Data is organized into bundles based on use case. Specify bundles in your request:

BundleDescription
basicStandard surface meteorological variables
cloudsCloud ceiling and low, mid and high cloud cover
precipitationPrecipitation type, snowfall and composite reflectivity
thunderstormConvective indices (CAPE, CIN, helicity, shear)
maritimeSea surface temperature, waves, currents, salinity
maritime-atmosWind at 50 m for offshore operations
maritime-waveWind-wave and swell components
maritime-wave-extMaximum wave height, peak and zero-crossing periods
agriculturalSoil moisture and temperature, surface fluxes
wind-energyWind and air density at 80, 100 and 120 m
solar-energyAccumulated shortwave and longwave radiation
upper-airIsobaric levels 1000 to 1 hPa (file endpoints only)
aviationFlight-level winds, turbulence and icing (file endpoint only)

The opt-in basic-accumulation, precipitation-accumulation and solar-energy-accumulation bundles add windowed 1-, 3- and 6-hour amounts at the point endpoint. See the Data Bundles & Variables reference for every field in every bundle.

Request multiple bundles by comma-separating:

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/forecast/point?lat=40.0&lon=-105.0&bundles=basic,maritime' \
  -H 'spire-api-key: YOUR_API_KEY'

Unit Systems

By default, responses use SI Units. Request US Units with the unit_system parameter. us returns temperatures in Celsius, pressure in hPa, wind in mph and visibility in miles; us-f is the same with temperatures in Fahrenheit:

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/forecast/point?lat=40.0&lon=-105.0&unit_system=us' \
  -H 'spire-api-key: YOUR_API_KEY'

See Units Reference for complete unit details.

Next Steps