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¶
| Field | Type | Description |
|---|---|---|
meta | object | Response metadata |
meta.unit_system | string | Unit system used (SI Units or US Units) |
meta.forecast | string | Forecast product name |
data | array | Array of forecast records |
data[].location | object | Location information |
data[].location.coordinates.lat | number | Latitude |
data[].location.coordinates.lon | number | Longitude |
data[].times | object | Temporal information |
data[].times.issuance_time | string | Forecast model run time (Issuance Time) |
data[].times.valid_time | string | Forecast Valid Time |
data[].values | object | Weather 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¶
| Field | Type | Description |
|---|---|---|
meta | object | Response metadata |
meta.count | integer | Number of files |
files | array | List 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¶
| Field | Type | Required | Description |
|---|---|---|---|
route | object | Yes | Route definition |
route.name | string | Yes | Name for the route |
route.waypoints | array | Yes | Array of waypoints (max 120) |
route.waypoints[].lat | number | Yes | Latitude |
route.waypoints[].lon | number | Yes | Longitude |
route.waypoints[].time | string | Yes | ISO 8601 timestamp |
bundles | string | No | Comma-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¶
| Field | Type | Description |
|---|---|---|
atcf_id | string | ATCF ID storm identifier |
storm_name | string | Storm name (empty until named) |
basin | string | Ocean basin code |
subbasin | string | Sub-basin code |
season | integer | Storm season year |
is_active | boolean | Whether storm is currently active |
max_development_category | string | Maximum intensity category |
max_sustained_wind | number | Maximum sustained winds (knots) |
min_mslp | number | Minimum sea-level pressure (hPa) |
dates_active | object | Start and end dates |
observed_track | array | Array of observed positions |
forecast_track | array | Array of forecast positions |
track[].category_code | string | Storm category at position |
track[].max_sustained_wind | number | Sustained wind speed (knots) |
track[].min_mslp | number | Central pressure (hPa) |
track[].wind_extent_radii | object | Wind 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¶
| Field | Type | Description |
|---|---|---|
meta.unit_system | string | Unit system (SI Units or US Units) |
data[].date | string | Calendar date |
data[].high.time | string | Time of high tide |
data[].high.values.tide_height | number | High tide height relative to MSL (Tidal Datum) |
data[].low.time | string | Time of low tide |
data[].low.values.tide_height | number | Low 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:
| Status | Description |
|---|---|
CREATED | Job submitted, queued for processing |
RESTORING_FILES | Retrieving archived data from storage |
RESTORE_COMPLETED | Archived data retrieved, ready for extraction |
INITIATED | Extraction process initiated |
PROCESSING | Data extraction in progress |
COMPLETED | Data ready for download |
FAILED | Job failed |
UNKNOWN | Status could not be determined |
Error Response¶
Standard error response format.
{
"error": {
"code": "INVALID_PARAMETER",
"message": "Latitude must be between -90 and 90"
}
}Error Codes¶
| Code | Description |
|---|---|
INVALID_PARAMETER | Invalid query parameter |
MISSING_PARAMETER | Required parameter missing |
NOT_FOUND | Resource not found |
UNAUTHORIZED | Invalid or missing API key |
RATE_LIMITED | Rate limit exceeded |
INTERNAL_ERROR | Server 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
)