Endpoint
Request Parameters
Parameter | Description |
---|---|
lat |
Required Latitude of the location (-90 to 90) |
lon |
Required Longitude of the location (-180 to 180) |
start |
Required Start time (Unix timestamp) |
end |
Required End time (Unix timestamp) |
units |
Optional
Unit system for response values:
|
Request Examples
Basic request with query parameter API key:
https://historical.weatherxu.com/v1/history?lat=40.7128&lon=-74.0060
&start=1704880800&end=1704970800
&api_key=YOUR_API_KEY
Basic request with header API key:
curl https://historical.weatherxu.com/v1/history?lat=40.7128&lon=-74.0060 \
&start=1704880800&end=1704970800 \
-H 'X-API-KEY: YOUR_API_KEY'
Request with imperial units:
curl https://historical.weatherxu.com/v1/history?lat=34.0522&lon=-118.2437&units=imperial \
&start=1704880800&end=1704970800 \
-H 'X-API-KEY: YOUR_API_KEY'
Response Example
Below is an abbreviated response for Los Angeles (34.0522°N, -118.2437°W) using metric units. The response includes hourly historical weather data between January 10, 2024 at 10am to January 11, 2024 at 11am.
Sample response (metric)
https://historical.weatherxu.com/v1/history?lat=34.0522&lon=-118.2437&start=1704880800&end=1704970800
Sample response (imperial)
https://historical.weatherxu.com/v1/history?lat=34.0522&lon=-118.2437&start=1704880800&end=1704970800&units=imperial
{
"success": true,
"data": {
"latitude": 40.7128,
"longitude": -74.006,
"units": "metric",
"timezone": "America/New_York",
"timezone_abbreviation": "EST",
"timezone_offset": -18000,
"dt": 1704880800,
"hourly": {
"data": [
{
"forecastStart": 1704880800,
"apparentTemperature": 10.82,
"cloudCover": 0.46,
"dewPoint": 8.35,
"pressure": 981,
"humidity": 0.81,
"precipIntensity": 0,
"temperature": 11.5,
"windGust": 46.08,
"windSpeed": 17.08,
"windDirection": 252,
"icon": "partly_cloudy"
},
// Additional hourly forecasts
]
}
}
}
Response Parameters
Please take a look at Units for a complete list of available units for each parameter.
Core
Parameter | Type | Description |
---|---|---|
latitude |
string | Latitude of the location (-90 to 90) |
longitude |
string | Longitude of the location (-180 to 180) |
units |
string | Unit system for response values. Learn more |
timezone |
string | IANA timezone identifier (e.g., "America/Los_Angeles") |
timezone_abbreviation |
string | Timezone abbreviation (e.g., "PDT") |
timezone_offset |
number | Offset from UTC in seconds |
dt |
number | Unix timestamp for the start of request |
Hourly
Array containing hour-by-hour forecast. Each hour contains:
[Array] |
|