12 free and fun APIs you must use in your side project
Mukesh Kuiry
Posted on December 20, 2023
Tired of the same old projects? Looking for a spark of creativity and inspiration? ✨
APIs (Application Programming Interfaces) are like magical gateways that unlock a vast world of data and functionality. And the best part? Many of them are free and super fun to use!
In this blog, I'll introduce you to 13 awesome APIs that can add a whole new dimension to your side projects. Get ready to explore, experiment, and create something truly unique!
1. The Cat API
Fetch random cat images, facts, or specific breeds to add a touch of feline fun to your project.
"Time spent with cats is never wasted." - Sigmund Freud
Example Code (JavaScript)
fetch('https://api.thecatapi.com/v1/images/search')
.then(response => response.json())
.then(data => {
const imageUrl = data[0].url;
console.log(`Here's a random cat image: ${imageUrl}`);
});
2. JokeAPI
Inject humor into your project with JokeAPI. Retrieve jokes on various topics or create a customized joke experience for your users.
"Laughter is an instant vacation." - Milton Berle
Example Code (JavaScript)
fetch('https://v2.jokeapi.dev/joke/Any')
.then(response => response.json())
.then(data => {
console.log(`Joke: ${data.joke}`);
});
3. Pexels API
Access a vast library of high-quality, royalty-free images through the Pexels API. Perfect for projects requiring stunning visuals.
"A picture is worth a thousand words." - Unknown
Example Code (JavaScript)
const apiKey = 'your_api_key_here';
const url = `https://api.pexels.com/v1/curated?per_page=1`;
fetch(url, {
headers: {
Authorization: apiKey,
},
})
.then(response => response.json())
.then(data => {
const imageUrl = data.photos[0].src.original;
console.log(`Here's a curated image: ${imageUrl}`);
});
Get random pieces of advice with the Advice Slip API. An amusing addition to keep users entertained and informed.
"The best way to predict the future is to create it." - Peter Drucker
Example Code (JavaScript)
fetch('https://api.adviceslip.com/advice')
.then(response => response.json())
.then(data => {
const advice = data.slip.advice;
console.log(`Advice: ${advice}`);
});
5. Giphy API
Add some animated flair to your projects with the Giphy API. Fetch trending GIFs or search for specific ones to elevate your user experience.
"Life is short, make it gif-worthy." - Unknown
Example Code (JavaScript)
const apiKey = 'your_api_key_here';
const searchTerm = 'excited';
fetch(`https://api.giphy.com/v1/gifs/random?api_key=${apiKey}&tag=${searchTerm}`)
.then(response => response.json())
.then(data => {
const gifUrl = data.data.images.original.url;
console.log(`Excitement GIF: ${gifUrl}`);
});
Transform text with various fun translations using the Fun Translation API. Spice up your content with amusing language conversions.
"Language is the road map of a culture." - Rita Mae Brown
Example Code (JavaScript)
const apiKey = 'your_api_key_here';
const textToTranslate = 'Hello, World!';
fetch(`https://api.funtranslations.com/translate/yoda.json?text=${textToTranslate}`, {
headers: {
'X-Funtranslations-Api-Secret': apiKey,
},
})
.then(response => response.json())
.then(data => {
const translatedText = data.contents.translated;
console.log(`Yoda Translation: ${translatedText}`);
});
Challenge your users with trivia using the Open Trivia Database API. Fetch random questions or tailor your queries for a customized trivia experience.
"Knowledge is power." - Francis Bacon
Example Code (JavaScript)
fetch('https://opentdb.com/api.php?amount=1&type=multiple')
.then(response => response.json())
.then(data => {
const question = data.results[0].question;
console.log(`Trivia Question: ${question}`);
});
8. Jikan API
For anime enthusiasts, the Jikan API provides access to extensive anime and manga data. Retrieve details about series, characters, and more.
"Anime is not a genre, it's an art form." - Unknown
Example Code (JavaScript)
const animeTitle = 'One Piece';
fetch(`https://api.jikan.moe/v3/search/anime?q=${animeTitle}&page=1`)
.then(response => response.json())
.
then(data => {
const animeDetails = data.results[0];
console.log(`Anime Title: ${animeDetails.title}`);
});
Bring mixology into your side project with the Cocktail DB API. Access a wealth of cocktail recipes, ingredients, and more for the perfect drink inspiration.
"Life is brewtiful." - Unknown
Example Code (JavaScript)
fetch('https://www.thecocktaildb.com/api/json/v1/1/random.php')
.then(response => response.json())
.then(data => {
const cocktailName = data.drinks[0].strDrink;
console.log(`Random Cocktail: ${cocktailName}`);
});
10. Dad Jokes API
Inject some dad humor into your project with the Dad Jokes API. Retrieve a variety of dad jokes to keep your users entertained.
"A day without laughter is a day wasted." - Charlie Chaplin
Example Code (JavaScript)
fetch('https://icanhazdadjoke.com/', {
headers: {
Accept: 'application/json',
},
})
.then(response => response.json())
.then(data => {
const dadJoke = data.joke;
console.log(`Dad Joke: ${dadJoke}`);
});
11. SpaceX API
Explore the wonders of space with the SpaceX API. Access data on launches, rockets, capsules, and more from SpaceX, a key player in space exploration.
"The Earth is the cradle of humanity, but mankind cannot stay in the cradle forever." - Konstantin Tsiolkovsky
Example Code (JavaScript)
fetch('https://api.spacexdata.com/v4/launches/next')
.then(response => response.json())
.then(data => {
const missionName = data.name;
console.log(`Next SpaceX Launch: ${missionName}`);
});
12. Recipe Puppy API
Bring culinary delights to your side project with the Recipe Puppy API. Access a vast collection of recipes and cooking inspiration.
"Cooking is love made visible." - Unknown
Example Code (JavaScript)
const ingredient = 'chicken';
fetch(`http://www.recipepuppy.com/api/?i=${ingredient}&p=1`)
.then(response => response.json())
.then(data => {
const recipeTitle = data.results[0].title;
console.log(`Chicken Recipe: ${recipeTitle}`);
});
Stay tuned for more amazing APIs in the next part of this blog! We'll delve into predicting ages from names, generating art from text, and much more. Get ready to unlock endless possibilities with the power of APIs!
Let's hear from you! Have you used any of these APIs before? What kind of cool projects do you have in mind? Share your thoughts in the comments below!
Posted on December 20, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.