Facts API
The Facts API provides tons of random interesting facts about science, literature, philosophy and other cool topics.
Available endpoints:
- /v1/facts - Get random facts
- /v1/factoftheday - Get today's fact (updated every day)
From 5,234 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 333ms | 372ms | 399ms | 577ms | 1165ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/facts GET
https://api.api-ninjas.com/v1/facts
Returns one (or more) random facts. Free users have access to 100 facts - premium users have access to over 500,000 facts.
Parameters
limitoptional premium onlyHow many results to return. Must be between
1and100. Default is1.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
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/facts?limit=1Headers
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/facts?limit=3" \
-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.
/v1/factoftheday GET
https://api.api-ninjas.com/v1/factoftheday
Returns a single fact for the current day. The same fact is returned for all requests on the same day, and changes each day. Perfect for displaying on your website or app. No parameters are available for this endpoint to ensure everyone sees the same fact of the day.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
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/factofthedayHeaders
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/factoftheday" \
-H "X-Api-Key: YOUR_API_KEY"Frequently Asked Questions
Can I use the Facts API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Facts 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 Facts 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 Facts 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.What's the difference between the /v1/facts and /v1/factoftheday endpoints?
The/v1/factsendpoint returns one or more random facts and accepts alimitparameter, while/v1/factofthedayreturns a single fact that is the same for every request on a given day and changes daily. The fact-of-the-day endpoint takes no parameters so that everyone sees the same fact, making it ideal for a daily widget on your site or app. See the full API catalog for related content endpoints.How do I request multiple facts at once?
Use thelimitparameter on the/v1/factsendpoint to control how many facts are returned; it must be between1and100and defaults to1. Note thatlimitis a premium-only parameter.How much fact data does the API cover, and what does the response include?
The database holds over 500,000 interesting facts spanning science, literature, philosophy, and other topics; free users can access 100 facts while premium users get the full set. Each result is a JSON object containing a singlefactfield with the fact text.What are some use cases for the Facts API?
It's great for powering a daily fact widget with/v1/factoftheday, surfacing random trivia in apps, or filling chatbots and social posts with interesting content. You can pair it with the Trivia API, Quotes API, or Day in History API for richer entertainment features.