Real-time weather observations and conditions.
Endpoints¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /current/weather/file | List current weather files |
| GET | /current/weather/file/{file_id} | Download a current weather file |
| GET | /current/weather/point | Get current weather at a point |
List Current Weather Files¶
GET /current/weather/fileRetrieve a list of available current weather condition files.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
time | string | No | ISO 8601 timestamp or time range |
regions | string | No | Comma-separated list of regions |
Example Request¶
Shell
Python
Node.js
curl -X GET \
'https://api.wx.spire.com/current/weather/file' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/current/weather/file",
headers={"spire-api-key": "YOUR_API_KEY"},
)
data = response.json()const response = await fetch(
"https://api.wx.spire.com/current/weather/file",
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);
const data = await response.json();Example Response¶
{
"meta": {
"count": 5
},
"files": [
"cwc.20240115.t16z.0p027.basic.global.grib2",
"cwc.20240115.t15z.0p027.basic.global.grib2"
]
}Download Current Weather File¶
GET /current/weather/file/{file_id}Download a specific current weather file.
Path Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | The filename to download |
Example Request¶
Shell
Python
Node.js
curl -OJL -X GET \
'https://api.wx.spire.com/current/weather/file/cwc.20240115.t16z.0p027.basic.global.grib2' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/current/weather/file/cwc.20240115.t16z.0p027.basic.global.grib2",
headers={"spire-api-key": "YOUR_API_KEY"},
allow_redirects=True,
)
with open("cwc.20240115.t16z.0p027.basic.global.grib2", "wb") as f:
f.write(response.content)import { createWriteStream } from "fs";
import { Readable } from "stream";
const response = await fetch(
"https://api.wx.spire.com/current/weather/file/cwc.20240115.t16z.0p027.basic.global.grib2",
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);
const fileStream = createWriteStream("cwc.20240115.t16z.0p027.basic.global.grib2");
Readable.fromWeb(response.body).pipe(fileStream);Get Current Weather at Point¶
GET /current/weather/pointRetrieve current weather conditions for a specific location.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
lat | number | Yes | Latitude (-90 to 90) |
lon | number | Yes | Longitude (-180 to 180) |
time | string | No | ISO 8601 timestamp or time range |
unit_system | string | No | si (default) or us |
tz | string | No | Timezone identifier |
Headers¶
| Header | Description |
|---|---|
X-Fields | Field Mask for response filtering |
Example Request¶
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'import requests
response = requests.get(
"https://api.wx.spire.com/current/weather/point",
params={"lat": 40.0, "lon": -105.0},
headers={"spire-api-key": "YOUR_API_KEY"},
)
data = response.json()const response = await fetch(
"https://api.wx.spire.com/current/weather/point?lat=40.0&lon=-105.0",
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);
const data = await response.json();Example Response¶
{
"meta": {
"unit_system": "si"
},
"data": [
{
"location": {
"coordinates": {
"lat": 40.0,
"lon": -105.0
}
},
"times": {
"observation_time": "2024-01-15T16:00:00Z"
},
"values": {
"air_temperature": 275.5,
"relative_humidity": 65.2,
"wind_speed": 5.3,
"wind_direction": 225.0
}
}
]
}Field Filtering¶
Use the X-Fields header to request specific fields:
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' \
-H 'X-Fields: {data{values{air_temperature,wind_speed}}}'import requests
response = requests.get(
"https://api.wx.spire.com/current/weather/point",
params={"lat": 40.0, "lon": -105.0},
headers={
"spire-api-key": "YOUR_API_KEY",
"X-Fields": "{data{values{air_temperature,wind_speed}}}",
},
)
data = response.json()const response = await fetch(
"https://api.wx.spire.com/current/weather/point?lat=40.0&lon=-105.0",
{
headers: {
"spire-api-key": "YOUR_API_KEY",
"X-Fields": "{data{values{air_temperature,wind_speed}}}",
},
}
);
const data = await response.json();