meteoblue offers APIs for on-demand access to weather data via simple HTTP APIs. Customers can request weather data in multiple formats or ready-to-use visualizations. The API serves requests almost instantaneously and can be integrated into automated systems, websites or applications.
Weather data can be retrieved by coordinates with latitude and longitude for every place world wide. By using now-casting based on measurement stations, radar and satellite telemetry the forecast is always up to date. meteoblue's unique approach to combine multiple weather models with machine learning algorithms produces the best possible weather forecast.
The following API URL retrieves the current weather forecast in 1 hour resolution for Basel, Switzerland: http://my.meteoblue.com/packages/basic-1h?lat=47.56&lon=7.57&asl=279&apikey=DEMOKEY
meteoblue offers different types of APIs:
|API||Description||Link to documentation|
|Package API||Data packages as CSV or JSON for forecast and historical weather data||Packages API|
|Images API||Charts as PNG images like meteograms, pictoprints or cross sections||Images API|
|Maps||Weather maps, satellite and radar images||Weather maps, Satellite and Radar|
|Environmental||Access to meteoblue weather archive||Environmental Datasets|
|Location API||World-wide location search||Location Search API|
To access the meteoblue API you need to get an API Key. Please contact firstname.lastname@example.org to apply for an free API Key trial. We offer demand-based or flat-rate pricing.
The API Key must be appended to all API calls. The example API URL above uses
&apikey=DEMOKEY. An API Key should be kept private to prevent misuse. The meteoblue API also offers signature mechanisms to protect the API Key in dynamic web applications or mobile apps.
An API Key is typically limited to the number of calls per day for individual data package, image or weather map. Without further agreement, we impose a rate limit of 500 calls per minute.
meteoblue APIs are designed for high availability with an uptime of more than 99.99% in the last years. meteoblue runs own weather models with initializations from American and European weather agencies. Additional weather models from over 10 national weather services are included. Our weather forecast APIs can easily handle outages from multiple sources and provide data constantly.
The current state of the meteoblue API, FTP and web-services is available here http://status.meteoblue.com/.
Although we are constantly improving the reliability of our systems, applications using our APIs should be designed to anticipate failures. The following simple approach can significantly increase the reliability while working with APIs:
- Call the meteoblue API with a timeout of 30 seconds
- If the timeout is reached or an error was returned, wait 30 seconds and retry
- After 10 retries, give up and log an error with debug information and contacts us if required
Signing URL Requests
API requests are only authorized by API keys. To prevent unauthorized access, we offer a signature mechanism with a shared secret. On request we will associate a shared secret with your API key and enforce the signature security policy.
To sign a request you have to add a Unix timestamp to your URL and calculate an SHA256 hash of the query string and the assigned shared secret. API queries can be signed with HMAC SHA-256. With PHP it is fairly simple:
$shared_secret = "MySharedSecret"; $query = "/packages/basic-1h?lat=47.1&lon=8.6&apikey=DEMOKEY&expire=1609416000"; $sig = hash_hmac("sha256", $query, $shared_secret); $signedUrl = "https://my.meteoblue.com" . $query . "&sig=" . $sig; // Result: http://my.meteoblue.com/packages/basic-1h?lat=47.1&lon=8.6&apikey=DEMOKEY&expire=1609416000&sig=ab37e89d7c724fd1a6c4025cb4d1fd07
A maximum expiration time (
&expire=1609416000, standing for 2020-12-31 12:00pm) can be specified to limit the validity of a request to a fixed unix timestamp. If it is not specified, the API query can be repeated indefinitely, but any modification to the URL will break the signature.
If UTF-8 characters are present in URL parameter, it is necessary to encode them before calculating the SHA256 HMAC signature. In PHP this can be done using the function urlencode().
$query = "/packages/basic-1h?lat=52.41&lon=16.93&city=" . urlencode("Poznań"); // Result /packages/basic-1h?lat=52.41&lon=16.93&city=Pozna%C5%84
This feature is intended to integrate meteoblue APIs directly into web-interfaces. We recommend a 10 minutes expire time. For more dynamic applications like mobile apps we recommend, that users are authorized on your systems and then signed URLs to the meteoblue APIs are returned.