NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Facts API

The Facts API provides tons of random interesting facts about science, literature, philosophy and other cool topics.

Available endpoints:

(4.1)

From 5,234 users

3,400+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
333ms372ms399ms577ms1165ms

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

  • limit  optional premium only

    How many results to return. Must be between 1 and 100. Default is 1.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

limit premium

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=1

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      fact:"After the Eiffel Tower was built, one person was killed during the installation of the lifts. No one was killed during the actual construction of the tower"
    }
]

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-Key  required

    API Key associated with your account.

Response

Same response format as /v1/facts (always returns a single fact), or an error if the request is unsuccessful.

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/factoftheday

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      fact:"Octopuses have three hearts"
    }
]

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/factoftheday" \ -H "X-Api-Key: YOUR_API_KEY"

Frequently Asked Questions

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • The /v1/facts endpoint returns one or more random facts and accepts a limit parameter, while /v1/factoftheday returns 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.
  • Use the limit parameter on the /v1/facts endpoint to control how many facts are returned; it must be between 1 and 100 and defaults to 1. Note that limit is a premium-only parameter.
  • 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 single fact field with the fact text.
  • 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.