Day in History API
The Day in History API provides historical events that happened on a specific date. Free users receive events for today's date only - premium users can specify custom dates and control pagination.
From 6,043 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 321ms | 365ms | 388ms | 543ms | 1015ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/dayinhistory GET
https://api.api-ninjas.com/v1/dayinhistory
Returns historical events that occurred on a specific date. If no date parameters are provided, returns events for today's date.
Parameters
monthoptional premiumThe month of the historical events to retrieve. Must be between
1and12. If specified,daymust also be provided. If both are omitted, today's date is used.dayoptional premiumThe day of the month for the historical events to retrieve. Must be between
1and31. If specified,monthmust also be provided. If both are omitted, today's date is used.offsetoptional premiumThe number of results to skip. Must be zero or a positive integer. Default is
0.limitoptional premiumThe maximum number of results to return. Must be between
1and30. Default is1.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
yearThe year of the historical event.
monthThe month of the historical event (1-12).
dayThe day of the month of the historical event.
eventA description of the historical event.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/dayinhistory?month=7&day=20Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/dayinhistory" \
-H "X-Api-Key: YOUR_API_KEY"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.
Frequently Asked Questions
Can I use the Day in History API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Day in History API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Day in History API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Day in History API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.How do I look up events for a specific date with the Day in History API?
Pass both themonth(1-12) andday(1-31) query parameters to retrieve events for that calendar date; if you omit them, the endpoint returns events for today's date. Custom dates are a premium feature, while free users always receive today's events.What fields does the Day in History API response include?
Each call returns a JSON array of event objects with ayear,month,day, and aneventfield describing what happened. See the error codes page for what is returned when a request is unsuccessful.How many events can I get back per request, and how do I paginate?
Use thelimitparameter (between1and30, default1) to control how many events return, and theoffsetparameter to skip results for pagination. Both are premium parameters.What are some use cases for the Day in History API?
It is great for building 'on this day' widgets, daily history newsletters, trivia games, or educational apps that surface events tied to the current date. For related content you can pair it with the Historical Events API, Historical Figures API, or Trivia API.