meteoblue API documentation

The API is designed to provide easy access via HTTP-URLs to all types of weather data. Various weather variables are grouped into packages.

Lets assume we want to request the 7 day weather forecast with hourly data for Basel, Switzerland. Basel is located at 47.57° North / 7.6° East and 263m above mean sea level. The URL would look like the following:

 http://my.meteoblue.com/packages/basic-1h?name=Basel&lat=47.57&lon=7.6&asl=263&tz=Europe%2FZurich&apikey=<em>personalAPIkey</em>

To break it down:

  • http://my.meteoblue.com/packages/basic-1h?: This identifies the address and our basic data package.
  • http://my.meteoblue.com/visimage/meteogram_14day?: This shows the address for images like our meteogaram 14day.
  • &lat=47.57&lon=7.6&asl=263: Coordinates and altitude for Basel
  • &apikey=PersonalAPIKey: This is your personal API key

Possible options:

  • &name=Basel: City name shown on images
  • &tz=Europe%2Zurich: Time zone of selected place
  • &lang=en: Select language for images (iso2 code)
  • &temperature=C: Select temperature unit
  • &windspeed=ms-1: Select wind speed unit
  • &winddirection=degree: Select wind direction unit
  • &precipitationamount=mm: Select precipitation amount unit
  • &timeformat=Y-M-D: Select time format
  • &format=json: Select output format

More information about the API URL parameters.

If you open this URL in a web browser it will produce an output as follows. Please note, that this API key is not valid.

This approach makes it easy and cost-efficient to integrate our API into automated systems or web applications. All data can be accessed on demand and processed further. 

Advanced security options

As you may have noticed your API request is only authorised by your API key. To prevent unauthorized access and "reply attacs" 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 an unix timestamp to your url and calculate a MD5 hash of the whole request string and the assigned shared secret. The request will expire after 5 minutes. In PHP the mechanism is trivial:

$shared_secret = 'MY_SHARED_SECRET';
$params = array(
  'apikey' => 'MY_API_KEY', 
  'mac' => 'feed', 
  'paramtype' => 'picto',
  'type' => 'json_7day_3h', 
  'tz' => 'Europe_Zurich',
  'lat' => 47.5667, 
  'lon' => 7.6, 
  'asl' => 263,
  'ts' => time()
);
$query_string = '/dataApi/dispatch.pl?'.http_build_query($params);
$url = 'http://my.meteoblue.com' . $query_string . "&sig=" . md5( $query_string . "&secret=" . $shared_secret);

For mobile applications we recommend a proxy for authorisation and cache.

URL parameters Description Format Default
secret Private key used to calculate the signature. Provided by meteoblue on request String -
ts Current unix timestamp unix timestamp, Integer -
sig Hash Hash, String -

Technical documentation 

Technical documentation of the meteoblue API: 

meteoblue_API_data-packages_images_documentation_EN_v2.2.pdf (1.76 MB)