12 free and fun APIs you must use in your side project
Tags: webdev, programming, beginners, api
Published: 2023-12-20 23:24:55

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!


![FUN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3g1ukwv3dz0q612famk.gif)

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](https://thecatapi.com/)**

![The Cat API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4og96fiwztnynty16nu.png)

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)**
```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}`);
  });
```
[The Cat API](https://thecatapi.com/)

**2. [JokeAPI](https://github.com/Sv443/JokeAPI)**

![JokeAPI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7qiwanu46c67bsn31251.png)

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)**
```javascript
fetch('https://v2.jokeapi.dev/joke/Any')
  .then(response => response.json())
  .then(data => {
    console.log(`Joke: ${data.joke}`);
  });
```
[JokeAPI](https://github.com/Sv443/JokeAPI)

**3. [Pexels API](https://www.pexels.com/api/)**

![Pexels API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rsv8v2uf3ai184sqtam0.png)

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)**
```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}`);
  });
```
[Pexels API](https://www.pexels.com/api/)

**4. [Advice Slip API](https://api.adviceslip.com/)**

![Advice Slip API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p2y17z945k9f97biodn.png)

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)**
```javascript
fetch('https://api.adviceslip.com/advice')
  .then(response => response.json())
  .then(data => {
    const advice = data.slip.advice;
    console.log(`Advice: ${advice}`);
  });
```
[Advice Slip API](https://api.adviceslip.com/)

**5. [Giphy API](https://developers.giphy.com/docs/api/)**

![Giphy API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lh9tur3mwj5cbd15i7y.png)

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)**
```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}`);
  });
```
[Giphy API](https://developers.giphy.com/docs/api/)

**6. [Fun Translation API](https://funtranslations.com/api/)**

![Fun Translation API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p20atvdhtm9lhixxy71y.png)

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)**
```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}`);
  });
```
[Fun Translation API](https://funtranslations.com/api/)

**7. [Open Trivia Database API](https://opentdb.com/api_config.php)**

![Open Trivia Database API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9j6ogjorvvjct5fbu5o.png)

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)**
```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}`);
  });
```
[Open Trivia Database API](https://opentdb.com/api_config.php)

**8. [Jikan API](https://github.com/jikan-me/jikan)**

![Jikan API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ok3rky60q9ggah2e6z0w.png)

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)**
```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}`);
  });
```
[Jikan API](https://github.com/jikan-me/jikan)

**9. [Cocktail DB API](https://www.thecocktaildb.com/api.php)**

![Cocktail DB API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/btwy5aqzau7dex4lcc93.png)

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)**
```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}`);
  });
```
[Cocktail DB API](https://www.thecocktaildb.com/api.php)

**10. [Dad Jokes API](https://github.com/DadJokes-io/Dad_Jokes_API)**

![Dad Jokes API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jz3zkm75mbpbvaslyw1b.png)

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)**
```javascript
fetch('https://icanhazdadjoke.com/', {
  headers: {
    Accept: 'application/json',
  },
})
  .then(response => response.json())
  .then(data => {
    const dadJoke = data.joke;
    console.log(`Dad Joke: ${dadJoke}`);
  });
```
[Dad Jokes API](https://github.com/DadJokes-io/Dad_Jokes_API)

**11. [SpaceX API](https://github.com/sumi14sept/SpaceX-API)**

![SpaceX API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5kbayuyhwjuh8tbgcjs.png)

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)**
```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}`);
  });
```
[SpaceX API](https://github.com/sumi14sept/SpaceX-API)

**12. [Recipe Puppy API](https://github.com/sumi14sept/RecipePuppy)**

![Recipe Puppy API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8k4n34tdul6ny59bbhyp.png)

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)**
```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}`);
  });
```
[Recipe Puppy API](https://github.com/sumi14sept/RecipePuppy)

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!