Facts API Documentation
Explore the universe of random facts with our RESTful API
Base URL
https://facts.bobthecow.org
Authentication
No authentication required - this API is completely open!
Available Endpoints
GET
/random
Returns a random fact from our collection
https://facts.bobthecow.org/random
Response
{
"fact": "A group of flamingos is called a flamboyance."
}
GET
/count
Returns the total number of available facts
https://facts.bobthecow.org/count
Response
{
"count": 1006
}
GET
/all
Returns all available facts in an array
https://facts.bobthecow.org/all
Response
[
"Fact 1",
"Fact 2",
"Fact 3"
]
API Playground
GET
{
"response": "will appear here..."
}
Code Examples
fetch('https://facts.bobthecow.org/random')
.then(response => response.json())
.then(data => console.log(data.fact))
.catch(err => console.error('Error:', err));
import requests
response = requests.get('https://facts.bobthecow.org/random')
print(response.json()['fact'])
curl -X GET "https://facts.bobthecow.org/random" \
-H "Accept: application/json"
Error Handling
All error responses follow this format:
{
"error": "Error message",
"status": 400
}
Common status codes:
- 200 OK - Success!
- 400 Bad Request - Invalid parameters
- 404 Not Found - Resource doesn't exist
- 500 Internal Server Error - Something went wrong