Introduction
The WeatherXM Pro API is designed to provide you with enhanced tools for exploring weather station observations, hyperlocal forecasts, and historical weather data. It allows you to seamlessly integrate WeatherXM's high-quality data into your applications.
You can explore the full API reference here: WeatherXM Pro API Documentation.
What You Can Do with the API
With the WeatherXM Pro API, you can:
- Retrieve weather stations in specific areas using bounding boxes or proximity searches.
- Access historical observation data for specific weather stations.
- Fetch forecasts, both hourly and daily, for specific geospatial areas (H3 cells).
- Monitor station metadata, including location, health, and data quality scores.
Authentication
The WeatherXM Pro API uses an API key for authentication. You'll need to include your key in the X-API-KEY header for every request.
-H "X-API-KEY: YOUR_API_KEY"
You can find and copy your API key on the API Management page.
Example Use Case: Get the Latest Weather Data from a Station in a Specific Area
Here’s an example demonstrating how to retrieve weather stations within a bounding box and fetch the latest observation data from one of the retrieved stations.
Step 1: Get a List of Stations Within a Bounding Box
Endpoint:GET /stations/bounds
This step retrieves weather stations within a bounding box defined by latitude and longitude.
Request Example
curl -X GET "https://pro.weatherxm.com/api/stations/bounds?min_lat=40.76&min_lon=-73.98&max_lat=40.79&max_lon=-73.94" \ -H "X-API-KEY: YOUR_API_KEY"
Query Parameters
-
min_lat: Minimum latitude of the bounding box. -
min_lon: Minimum longitude of the bounding box. -
max_lat: Maximum latitude of the bounding box. -
max_lon: Maximum longitude of the bounding box.
Example Response
{
"stations": [
{
"id": "3355b780-438d-11ef-8e8d-b55568dc8e66",
"name": "Scrawny Magnolia Sunset",
"lastDayQod": 0.9990059523809524,
"cellId": "872a10089ffffff",
"createdAt": "2024-09-06T00:01:49.685Z",
"location": {
"lat": 40.77334213256836,
"lon": -73.94979095458984
}
},
{
"id": "efae5a90-8db9-11ec-900c-abdec1c57354",
"name": "Odd Foggy Noreaster",
"lastDayQod": 0,
"cellId": "872a10089ffffff",
"createdAt": "2022-03-21T09:04:35.157Z",
"location": {
"lat": 40.782613,
"lon": -73.96528
}
}
]
}
Step 2: Fetch the Latest Observation Data for a Station
Using the first station from the previous response (3355b780-438d-11ef-8e8d-b55568dc8e66), this step retrieves the latest observation data for that station.
Endpoint:GET /stations/{station_id}/latest
Request Example
curl -X GET "https://pro.weatherxm.com/api/stations/3355b780-438d-11ef-8e8d-b55568dc8e66/latest" \ -H "X-API-KEY: YOUR_API_KEY"
Path Parameters
-
station_id: The unique identifier of the station.
Example Response
{
"observation": {
"timestamp": "2025-01-17T15:42:20.248Z",
"temperature": 1.4,
"feels_like": 1.4,
"dew_point": -1.1717342238520458,
"humidity": 83,
"precipitation_rate": 0,
"wind_speed": 0,
"wind_gust": 0,
"wind_direction": 180,
"uv_index": 0,
"pressure": 975.33,
"solar_irradiance": 2.6,
"created_at": "2025-01-17T15:42:20.248Z"
},
"health": {
"timestamp": "2025-01-16T00:00:00.000Z",
"data_quality": { "score": 0.9527791666666667 },
"location_quality": { "score": 1, "reason": "-" }
}
}
Feedback and Support
If you have any questions or need assistance, here are three ways to get support:
- Use our AI agent: ask our AI agent for faster responses and help with using the API.
- Open a Ticket: Use our Support Site to open a ticket and receive help from our team.
- Send Feedback: Share your thoughts about the app or API via our Feedback Form.
Comments
0 comments
Article is closed for comments.