Travel Advisories API

Daily updated travel advisories with assessments for every country.

Quickstart

This is a simple REST API that replies with an UTF8 encoded JSON Object. This API provides you with a daily updated list of country advisories. These advisories contain a risk value which describes how dangerous a country is from a travellers perspective. This data is available for every country and as fresh as the website.

Terms of Service

First of all, the service is free to use. The API described on this page is free of charge. But to keep it that way, please comply with the following rules.

(1) This api comes without warranty or uptime promises. Uptime has been > 99,97% last year. However, servers can break. So you should not use this API to operate a nuclear reactor.

(2) Though I try to put great care in the coding, official travel advisories could be misinterpreted and show a wrong scoring. So you should not base potentially life threatening decisions on the API data alone.

(3) This API is designed for light traffic. If you wish to embed this data into your application, please consider a local and/or central caching. A few clients doing a few requests per day is totally fine. If it gets more, please contact me so I can provide you with a more scalable solution. We will work out a very fair pricing depending on your individual requirements. If in doubt, just ask.

(4) Attribution. Please refer to Travel-Advisory.info as source of data when you use the api in your application/website/app. It doesn't have to be a big bright badge, but it should be in context of the data shown. A page where you list contributors would also be totally fine.

Again: If possible, please cache your requests. The data is only updated once per day in the morning and doesn't change till the next day.

How to use

Essentially as simple as it gets.

Basic API Endpoint

https://www.travel-advisory.info/api

Calling this URL as GET will return the list of country we keep track of in JSON format.

You can also use the standard 'non-https' url http://www.travel-advisory.info/api at Port 80 if your client is not capable of handling SSL connections.

See example

Optional Parameter

https://www.travel-advisory.info/api?countrycode=AU

Using the api together with the optional parameter 'countrycode' and a single two-letter ISO countrycode will restrict the result list to a single country.

See Wikipedia for a comprehensive list of possible codes.

See example

Description of data structure

Here you see a list of the available fields, their format and meaning.

Node / Name Format Meaning
api reply JSON Object The general API reply
api_request object information about your request
request object applied filters to request
item string is a specific item (country) requested
reply object general information on the reply
cache string info on cache status ('renewed' or 'cached')
code integer equivalent to http status code
status string descriptive status code
note string short info on health status of the api
count integer number of elements in 'data' node

data array list of single country advisory data
[countrycode] object key of element is 2-letter iso country code
iso_alpha2 char(2) string ISO 2 letter country code
name string English name of the country
continent char(2) string Shortcode for continent of country
Advisory object contains actualy advisory data
score float value between 0 and 5.0, representing degree of risk
sources_active integer how many advisories have been found
message string language description of risk level
updated timestamp when was the data last updated
source url URL of full country advisory

Example Code

		

		{
		  "api_status": {
			"request": {
			  "item": "de"
			},
			"reply": {
			  "cache": "renewed",
			  "code": 200,
			  "status": "ok",
			  "note": "The api works, we could match requested country code.",
			  "count": 1
			}
		  },
		  "data": {
			"DE": {
			  "iso_alpha2": "DE",
			  "name": "Germany",
			  "continent": "EU",
			  "advisory": {
				"score": 1.5,
				"sources_active": 4,
				"message": "Germany has a current risk level of 1.5 (out of 5). We Advise: Travelling Germany is (relatively) safe.",
				"updated": "2019-02-12 19:53:38",
				"source": "https:\/\/www.travel-advisory.info\/germany"
			  }
			}
		  }
		}