Historical Events API

The Historical Events API allows you search the famous famous events in history. From ancient antiquity to modern times, events from all parts of human civilization are recorded.

/v1/historicalevents

HTTP GET

Returns a list of up to 10 events that match the search parameters.

Parameters

At least one of the following parameters is required: text, year, month, day.

text (optional) - query text to search events by. Use keywords or short phrases for best match results.

year (optional) - 4-digit year (e.g. 1776). For BC/BCE years, use a negative integer (e.g. -351 for 351 BC).

month (optional) - integer month (e.g. 3 for March).

day (optional) - calendar day of the month.

offset (optional) - number of results to offset (for pagination).

Headers

X-Api-Key (required) - API Key associated with your account.

Sample Request URL

Live Demo!

https://api.api-ninjas.com/v1/historicalevents?text=

Sample Response

[
  {
    "year": "-45",
    "month": "01",
    "day": "01",
    "event": "The Julian calendar takes effect as the civil calendar of the Roman Empire, establishing January 1 as the new date of the new year."
  },
  {
    "year": "366",
    "month": "01",
    "day": "02",
    "event": "The Alemanni cross the frozen Rhine in large numbers, invading the Roman Empire."
  },
  {
    "year": "250",
    "month": "01",
    "day": "03",
    "event": "Emperor Decius orders everyone in the Roman Empire (except Jews) to make sacrifices to the Roman gods."
  },
  {
    "year": "-27",
    "month": "01",
    "day": "16",
    "event": "Gaius Julius Caesar Octavianus is granted the title Augustus by the Roman Senate, marking the beginning of the Roman Empire."
  },
  {
    "year": "379",
    "month": "01",
    "day": "19",
    "event": "Emperor Gratian elevates Flavius Theodosius at Sirmium to Augustus, and gives him authority over all the eastern provinces of the Roman Empire."
  },
  {
    "year": "1719",
    "month": "01",
    "day": "23",
    "event": "The Principality of Liechtenstein is created within the Holy Roman Empire."
  },
  {
    "year": "98",
    "month": "01",
    "day": "27",
    "event": "Trajan succeeds his adoptive father Nerva as Roman emperor; under his rule the Roman Empire will reach its maximum extent."
  },
  {
    "year": "1018",
    "month": "01",
    "day": "30",
    "event": "Poland and the Holy Roman Empire conclude the Peace of Bautzen."
  },
  {
    "year": "421",
    "month": "02",
    "day": "08",
    "event": "Constantius III becomes co-Emperor of the Western Roman Empire."
  },
  {
    "year": "55",
    "month": "02",
    "day": "11",
    "event": "The death under mysterious circumstances of Tiberius Claudius Caesar Britannicus, heir to the Roman empire, on the eve of his coming of age clears the way for Nero to become Emperor."
  }
]

import requests

text = 'roman empire'
api_url = 'https://api.api-ninjas.com/v1/historicalevents?text={}'.format(text)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
    print(response.text)
else:
    print("Error:", response.status_code, response.text)
var text = 'roman empire'
$.ajax({
    method: 'GET',
    url: 'https://api.api-ninjas.com/v1/historicalevents?text=' + text,
    headers: { 'X-Api-Key': 'YOUR_API_KEY'},
    contentType: 'application/json',
    success: function(result) {
        console.log(result);
    },
    error: function ajaxError(jqXHR) {
        console.error('Error: ', jqXHR.responseText);
    }
});
const request = require('request');
var text = 'roman empire';
request.get({
  url: 'https://api.api-ninjas.com/v1/historicalevents?text=' + text,
  headers: {
    'X-Api-Key': 'YOUR_API_KEY'
  },
}, function(error, response, body) {
  if(error) return console.error('Request failed:', error);
  else if(response.statusCode != 200) return console.error('Error:', response.statusCode, body.toString('utf8'));
  else console.log(body)
});
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import com.fasterxml.jackson.databind.ObjectMapper;

URL url = new URL("https://api.api-ninjas.com/v1/historicalevents?text=roman empire");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("accept", "application/json");
InputStream responseStream = connection.getInputStream();
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(responseStream);
System.out.println(root.path("fact").asText());
let text = "roman empire".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
let url = URL(string: "https://api.api-ninjas.com/v1/historicalevents?text=" + text!)!
var request = URLRequest(url: url)
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-Api-Key")
let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
    guard let data = data else { return }
    print(String(data: data, encoding: .utf8)!)
}
task.resume()
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.