DEV Community

Cover image for ๐Ÿ”Œ Top 10 Free APIs Every Developer Needs (With Examples)
Doc-e.ai
Doc-e.ai

Posted on

๐Ÿ”Œ Top 10 Free APIs Every Developer Needs (With Examples)

In the world of modern software development, free APIs are like hidden gems. They let you pull in powerful data and features without spending a dime. Whether you're building an app, learning to code, or experimenting with side projects, these APIs can supercharge your work.

Letโ€™s look at the top 10 free APIs, complete with examples and sample code.
1. ๐ŸŒฆ๏ธ OpenWeatherMap API
Get real-time weather updates for any city.

Example (JavaScript Fetch):

javascript
Copy
Edit
fetch("https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY")
.then(res => res.json())
.then(data => console.log(data));
๐Ÿ“ Use it in travel apps, smart dashboards, or weather widgets.

2. ๐ŸŒ REST Countries API
Access data like population, languages, flags, and more.

Example:

javascript
Copy
Edit
fetch("https://restcountries.com/v3.1/name/canada")
.then(res => res.json())
.then(data => console.log(data[0].flags.png));
๐Ÿ–ผ๏ธ You can show flags and names in dropdowns or quizzes.

3. ๐Ÿ˜บ Cat & Dog APIs
Add some fun with random cat/dog images.

Example (Dog):

javascript
Copy
Edit
fetch("https://dog.ceo/api/breeds/image/random")
.then(res => res.json())
.then(data => console.log(data.message));
๐ŸŽ‰ Perfect for beginner projects or boredom-busting apps.

4. ๐Ÿช™ CoinGecko API
Track real-time cryptocurrency prices.

Example:

javascript
Copy
Edit
fetch("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd")
.then(res => res.json())
.then(data => console.log(data.bitcoin.usd));
๐Ÿ’ฐ Use it in crypto dashboards or portfolio apps.

5. ๐Ÿ“ก IPify
Get your public IP address.

javascript
Copy
Edit
fetch("https://api.ipify.org?format=json")
.then(res => res.json())
.then(data => console.log(data.ip));
๐Ÿ“ถ Useful for IP tracking, geolocation, or network tools.

6. ๐Ÿ˜‚ JokeAPI
Lighten the mood with programming jokes.

Example:

javascript
Copy
Edit
fetch("https://v2.jokeapi.dev/joke/Programming")
.then(res => res.json())
.then(data => console.log(data.joke || ${data.setup} - ${data.delivery}));
7. ๐Ÿš€ NASA API
Fetch space data and stunning images.

Example: Astronomy Picture of the Day

javascript
Copy
Edit
fetch("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY")
.then(res => res.json())
.then(data => console.log(data.url));
8. ๐ŸŽฎ PokeAPI
Access Pokรฉmon data for games and trivia apps.

javascript
Copy
Edit
fetch("https://pokeapi.co/api/v2/pokemon/pikachu")
.then(res => res.json())
.then(data => console.log(data.sprites.front_default));
9. ๐Ÿ“ท Unsplash API
Use beautiful, high-resolution images legally and for free.

10. ๐Ÿ” Public APIs Directory
Explore 100s of free APIs from all domains:
๐Ÿ‘‰ https://public-apis.io

โœ… Final Thoughts
These free APIs are not just toolsโ€”they're building blocks. Whether you're designing a product, creating a game, or simply learning to code, theyโ€™ll save time and spark ideas.

Top comments (0)