On This Day API Documentation

The On This Day API by ZenQuotes.io is an incredibly easy to use historical event data feed for your website or app. Responses are supplied in JSON format, making it easy for experienced developers to get up in running.

In this guide we will go over how to make an API call and work with the response. No API key is required but requests will be limited to 5 per 30 second period by IP, if you have an active ZenQuotes subscription, your key will work across all of our services.

Contents

  1. Basic API Structure
  2. How to fetch historical events for your website or app
  3. Response
  4. API Usage Limits and Attribution

1. Basic API Structure

On This Day API calls are designed to be easy to use and understand. The response data is formatted as a JSON object array. Pre-formatted HTML output is available in addition to raw text values.

The basic elements of an API call are as follows:

https://today.zenquotes.io/[month]/[day]/[your_key]

where:

https://today.zenquotes.io/api/ = On This Day API URL. Required.
[month] = Numerical representation of month 1-12.
[day] = Numerical representation of day 1-31.
[key] = API key for use with premium subscriptions, be sure to obfuscate or hide this in your source code to prevent hijacking.

Alternative GET request formats are also provided: https://today.zenquotes.io?api=true&month=[month]&day=[day]&key=[your_key]

2. How to fetch historical events for your website or app

The most efficient way for developers to load historical data is to cache the response into a local JSON file within your app rather than calling the API each time you want to display data. This will keep a cache of events that you can iterate through locally and allow you to have data on hand in the event that the API service is down.

Sample Requests

3. Response

The resulting data is formatted as a JSON object array, grouped by event type. A timestamp is also provided for cache updating.

{
  "info": "OnThisDay API",
  "date": "January_1",
  "updated": "1618064326",
  "data": {
    "Events": [
      {
        "text": "1527 – Croatian nobles elect Ferdinand I of Austria as King of Croatia in the Parliament on Cetin.[12]",
        "html": "<a href=\"https://wikipedia.org/wiki/1527\" title=\"1527\">1527</a> &#8211; Croatian nobles elect <a href=\"https://wikipedia.org/wiki/Ferdinand_I,_Holy_Roman_Emperor\" title=\"Ferdinand I, Holy Roman Emperor\">Ferdinand I</a> of Austria as <a href=\"https://wikipedia.org/wiki/List_of_rulers_of_Croatia#King_of_Croatia\" title=\"List of rulers of Croatia\">King of Croatia</a> in the <a href=\"https://wikipedia.org/wiki/Parliament_on_Cetin\" class=\"mw-redirect\" title=\"Parliament on Cetin\">Parliament on Cetin</a>.",
        "links": {
          "0": {
            "0": "<a href=\"https://wikipedia.org/wiki/1527\" title=\"1527\">1527</a>",
            "1": "https://wikipedia.org/wiki/1527",
            "2": "1527"
          },
          "1": {
            "0": "<a href=\"https://wikipedia.org/wiki/Ferdinand_I,_Holy_Roman_Emperor\" title=\"Ferdinand I, Holy Roman Emperor\">Ferdinand I</a>",
            "1": "https://wikipedia.org/wiki/Ferdinand_I,_Holy_Roman_Emperor",
            "2": "Ferdinand I"
          },
          "2": {
            "0": "<a href=\"https://wikipedia.org/wiki/List_of_rulers_of_Croatia#King_of_Croatia\" title=\"List of rulers of Croatia\">King of Croatia</a>",
            "1": "https://wikipedia.org/wiki/List_of_rulers_of_Croatia#King_of_Croatia",
            "2": "King of Croatia"
          },
          "3": {
            "0": "<a href=\"https://wikipedia.org/wiki/Parliament_on_Cetin\" class=\"mw-redirect\" title=\"Parliament on Cetin\">Parliament on Cetin</a>",
            "1": "https://wikipedia.org/wiki/Parliament_on_Cetin",
            "2": "Parliament on Cetin"
          }
        }
      }
    ],
    "Births": [
      {
        "text": "1600 &#8211; Friedrich Spanheim, Dutch theologian and academic (d. 1649)&#91;104&#93;",
        "html": "<a href=\"https://wikipedia.org/wiki/1600\" title=\"1600\">1600</a> &#8211; <a href=\"https://wikipedia.org/wiki/Friedrich_Spanheim\" title=\"Friedrich Spanheim\">Friedrich Spanheim</a>, Dutch theologian and academic (d. 1649)",
        "links": {
          "0": {
            "0": "<a href=\"https://wikipedia.org/wiki/1600\" title=\"1600\">1600</a>",
            "1": "https://wikipedia.org/wiki/1600",
            "2": "1600"
          },
          "1": {
            "0": "<a href=\"https://wikipedia.org/wiki/Friedrich_Spanheim\" title=\"Friedrich Spanheim\">Friedrich Spanheim</a>",
            "1": "https://wikipedia.org/wiki/Friedrich_Spanheim",
            "2": "Friedrich Spanheim"
          }
        }
      }
    ],
    "Deaths": [
      {
        "text": "1560 &#8211; Joachim du Bellay, French poet and critic (b. 1522)&#91;312&#93;",
        "html": "<a href=\"https://wikipedia.org/wiki/1560\" title=\"1560\">1560</a> &#8211; <a href=\"https://wikipedia.org/wiki/Joachim_du_Bellay\" title=\"Joachim du Bellay\">Joachim du Bellay</a>, French poet and critic (b. 1522)",
        "links": {
          "0": {
            "0": "<a href=\"https://wikipedia.org/wiki/1560\" title=\"1560\">1560</a>",
            "1": "https://wikipedia.org/wiki/1560",
            "2": "1560"
          },
          "1": {
            "0": "<a href=\"https://wikipedia.org/wiki/Joachim_du_Bellay\" title=\"Joachim du Bellay\">Joachim du Bellay</a>",
            "1": "https://wikipedia.org/wiki/Joachim_du_Bellay",
            "2": "Joachim du Bellay"
          }
        }
      }
    ]
  }
}
  • “Events” = Significant historical events occurring on the input day.
  • “Births” = Notable births from popular figures occurring on the input date.
  • “Deaths” = Notable deaths from popular figures occurring on the input date.

Each object group contains raw text, pre-formatted HTML, and anchor link arrays.

  • “text” = Raw text data.
  • “html” = Pre-formatted HTML data.
  • “links” = Anchor link array, contains anchor tag, raw text, and raw URL.

4. API Usage Limits and Attribution

Requests are restricted to 5 per 30 second period by default. An API key or registered IP is required for unlimited access and to enable Access-Control-Allow-Origin headers. We require that you show attribution with a link back to https://zenquotes.io/ when using the free version of this API.

Historical data provided by <a href="https://zenquotes.io/" target="_blank">ZenQuotes API</a>

Back to Guide Contents

Subscribe