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.

Reference for common data structures in API responses.

Point Forecast Response

The standard response format for point-based endpoints.

{
  "meta": {
    "unit_system": "si",
    "forecast": "Spire Operational Forecast"
  },
  "data": [
    {
      "location": {
        "coordinates": {
          "lat": 40.0,
          "lon": -105.0
        }
      },
      "times": {
        "issuance_time": "2024-01-15T00:00:00",
        "valid_time": "2024-01-15T06:00:00"
      },
      "values": {
        "air_temperature": 275.5,
        "relative_humidity": 65.0,
        "wind_speed": 5.2,
        "wind_direction": 225
      }
    }
  ]
}

Schema

FieldTypeDescription
metaobjectResponse metadata
meta.unit_systemstringUnit system used (SI Units or US Units)
meta.forecaststringForecast product name
dataarrayArray of forecast records
data[].locationobjectLocation information
data[].location.coordinates.latnumberLatitude
data[].location.coordinates.lonnumberLongitude
data[].timesobjectTemporal information
data[].times.issuance_timestringForecast model run time (Issuance Time)
data[].times.valid_timestringForecast Valid Time
data[].valuesobjectWeather values

File List Response

Response format for file listing endpoints.

{
  "meta": {
    "count": 29
  },
  "files": [
    "sof-d.20240115.t00z.0p25.basic.global.f000.grib2",
    "sof-d.20240115.t00z.0p25.basic.global.f006.grib2"
  ]
}

Schema

FieldTypeDescription
metaobjectResponse metadata
meta.countintegerNumber of files
filesarrayList of filenames

Route Schema

Format for route-based requests (used by /forecast/route, /archive/route, and /insights/maritime/route).

{
  "route": {
    "name": "my_route",
    "waypoints": [
      {
        "lat": 40.7,
        "lon": -74.0,
        "time": "2024-01-15T12:00:00Z"
      },
      {
        "lat": 38.5,
        "lon": -70.0,
        "time": "2024-01-16T00:00:00Z"
      }
    ]
  },
  "bundles": "basic,maritime"
}

Schema

FieldTypeRequiredDescription
routeobjectYesRoute definition
route.namestringYesName for the route
route.waypointsarrayYesArray of waypoints (max 120)
route.waypoints[].latnumberYesLatitude
route.waypoints[].lonnumberYesLongitude
route.waypoints[].timestringYesISO 8601 timestamp
bundlesstringNoComma-separated Bundle names

Storm Track Response

Response format for storm tracking endpoints. Wind speeds are in knots and pressures in hPa.

[
  {
    "atcf_id": "AL022024",
    "storm_name": "Beryl",
    "basin": "NA",
    "subbasin": "CS",
    "season": 2024,
    "is_active": false,
    "advisory_number": null,
    "advisory_issuance_time": null,
    "max_development_category": "TC5",
    "max_sustained_wind": 143.0,
    "min_mslp": 934.0,
    "dates_active": {
      "start": "2024-06-28",
      "end": "2024-07-09"
    },
    "observed_track": [
      {
        "lat": 10.5,
        "lon": -45.2,
        "category_code": "TD",
        "basin": "NA",
        "subbasin": "MM",
        "wind_gusts": null,
        "max_sustained_wind": 30.0,
        "min_mslp": 1006.0,
        "movement_direction": 280.0,
        "movement_speed": 18.0,
        "wind_extent_radii": {},
        "time": "2024-06-28T00:00:00+00:00"
      }
    ],
    "forecast_track": []
  }
]

Schema

FieldTypeDescription
atcf_idstringATCF ID storm identifier
storm_namestringStorm name (empty until named)
basinstringOcean basin code
subbasinstringSub-basin code
seasonintegerStorm season year
is_activebooleanWhether storm is currently active
max_development_categorystringMaximum intensity category
max_sustained_windnumberMaximum sustained winds (knots)
min_mslpnumberMinimum sea-level pressure (hPa)
dates_activeobjectStart and end dates
observed_trackarrayArray of observed positions
forecast_trackarrayArray of forecast positions
track[].category_codestringStorm category at position
track[].max_sustained_windnumberSustained wind speed (knots)
track[].min_mslpnumberCentral pressure (hPa)
track[].wind_extent_radiiobjectWind Radii at 34/50/64 kt in NE/SE/NW/SW quadrants (nautical miles)

Tidal Extrema Response

Response format for tidal extrema endpoint. Results are grouped by date, with each entry containing the high and low tide for that calendar day.

{
  "meta": {
    "unit_system": "si",
    "message": null
  },
  "data": [
    {
      "date": "2024-01-15",
      "high": {
        "time": "2024-01-15T03:24:00",
        "values": {
          "tide_height": 1.52
        }
      },
      "low": {
        "time": "2024-01-15T09:47:00",
        "values": {
          "tide_height": -0.35
        }
      }
    }
  ]
}

Schema

FieldTypeDescription
meta.unit_systemstringUnit system (SI Units or US Units)
data[].datestringCalendar date
data[].high.timestringTime of high tide
data[].high.values.tide_heightnumberHigh tide height relative to MSL (Tidal Datum)
data[].low.timestringTime of low tide
data[].low.values.tide_heightnumberLow tide height relative to MSL

Status Response

Response for status-checking endpoints.

{
  "status": "available",
  "issuance_time": "2024-01-15T00:00:00Z",
  "bundles": ["basic", "maritime"]
}

Job Response

Response for asynchronous job submissions.

{
  "job_uuid": "abc123-def456-789xyz",
  "status": "pending"
}

Status Values

Archive jobs progress through multiple stages:

StatusDescription
CREATEDJob submitted, queued for processing
RESTORING_FILESRetrieving archived data from storage
RESTORE_COMPLETEDArchived data retrieved, ready for extraction
INITIATEDExtraction process initiated
PROCESSINGData extraction in progress
COMPLETEDData ready for download
FAILEDJob failed
UNKNOWNStatus could not be determined

Error Response

Standard error response format.

{
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "Latitude must be between -90 and 90"
  }
}

Error Codes

CodeDescription
INVALID_PARAMETERInvalid query parameter
MISSING_PARAMETERRequired parameter missing
NOT_FOUNDResource not found
UNAUTHORIZEDInvalid or missing API key
RATE_LIMITEDRate limit exceeded
INTERNAL_ERRORServer error

Python Data Classes

from dataclasses import dataclass
from typing import List, Optional
from datetime import datetime

@dataclass
class Coordinates:
    lat: float
    lon: float

@dataclass
class Location:
    coordinates: Coordinates

@dataclass
class Times:
    issuance_time: datetime
    valid_time: datetime

@dataclass
class ForecastRecord:
    location: Location
    times: Times
    values: dict

@dataclass
class ForecastResponse:
    meta: dict
    data: List[ForecastRecord]

def parse_forecast_response(json_data: dict) -> ForecastResponse:
    """Parse JSON response into typed data structure."""
    records = []
    for item in json_data['data']:
        record = ForecastRecord(
            location=Location(
                coordinates=Coordinates(
                    lat=item['location']['coordinates']['lat'],
                    lon=item['location']['coordinates']['lon']
                )
            ),
            times=Times(
                issuance_time=datetime.fromisoformat(item['times']['issuance_time']),
                valid_time=datetime.fromisoformat(item['times']['valid_time'])
            ),
            values=item['values']
        )
        records.append(record)

    return ForecastResponse(
        meta=json_data['meta'],
        data=records
    )