Save over 30% when you subscribe to an annual subscription plan!

Facts API

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

Available endpoints:

Checking API status...

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

https://api.api-ninjas.com/v1/facts

Headers

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

Sample Response

JSON
1 2 3 4 5 [ { "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)

Sample Request Live Demo!

https://api.api-ninjas.com/v1/factoftheday

Headers

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

Sample Response

JSON
1 2 3 4 5 [ { "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"