Embark on a journey of random trivia and amusing tidbits with the Useless Facts API—a compact yet endlessly entertaining dataset designed to keep users captivated. Dive into a collection of over 1000+ quirky and mostly useless facts, thoughtfully curated from various corners of the web.
From bizarre historical anecdotes to curious scientific oddities, this API is your gateway to a treasure trove of information that’s as fascinating as it is frivolous. Perfect for those moments when you crave a mental escape or simply want to sprinkle some quirky knowledge into your day.
Contents
1. Object Properties
A useless fact object has the following properties.
Property | Description |
text | The useless fact text. |
source | The source domain text. |
url | The source hyperlink. |
html | The useless fact in pre-formatted HTML. |
Example Response {object}
{
"text": "The useless fact text will be displayed here.",
"source": "www.example.com",
"url": "https://www.example.com/some-page/",
"html": "<blockquote>Pre-formatted HTML<footer>Source</footer></blockquote>"
}
2. Operating Modes
There are various API modes depending on the type of data you want to retrieve.
i. Stats Mode
https://api.viewbits.com/v1/uselessfacts?mode=stats
Use this call to return information like current version and the number of useless facts in the database.
Response:
{"info":"Useless Facts v1.0","entries":1050}
ii. Random Mode
https://api.viewbits.com/v1/uselessfacts?mode=random
Use this call to return a single random fact object.
Response:
{object}
iii. Batch Mode
https://api.viewbits.com/v1/uselessfacts?mode=batch
When operating in batch mode, the API will return an array of random fact objects. This is mainly used when you want to cache your facts locally within your app.
The default limit is 50 items. When no API key is provided, the batch is limited to 10 entries.
Response:
[ {object},{object},...{object} ]
iv. Useless Fact of The Day
https://api.viewbits.com/v1/uselessfacts?mode=today
Each day we feature a single fact from our database, which you can call using the [today] mode. To reduce server load, this response should be loaded into your app cache and refreshed daily rather than making a call each time you want to display the quote in your project. New quote is generated at midnight server time (00:00 CST).
Response:
{object}
3. Use Limits
When no API key is provided, calls are limited to 5 per 30 second period. Its recommended that you use batch mode to cache the data in a local file, then updating only as needed. To increase rate limits and disable CORS, you must provide an API key by adding &key=[YOUR_KEY] to the end of your call.
Example: https://api.viewbits.com/v1/uselessfacts?mode=random&key=[YOUR_KEY]