Free APIs You Need to Know

APIs (Application Programming Interfaces) are essential tools for developers, allowing them to integrate third-party services into their applications. Here is an extensive list of free APIs available 2024 across various categories, along with website links, descriptions, and sample code for each.

What makes a good Free API?

Since open APIs are free to use and readily available to anyone, they won’t always be as polished as partner APIs (which are premium services). When browsing for open APIs to use, consider these criteria.

Documentation

No matter what API you’re working with, poor documentation is going to make you regret your choice. The best APIs, including those that are free, craft their documentation with care. These documents are also revisited and updated promptly.

Always skim an API’s documentation before diving in.

Security

Open APIs should, at the very least, employ basic authentication and authorization methods. Usually, you’ll be given a free key to use when making API calls. This prevents your calls from being intercepted and transformed by malicious actors.

Simplicity

When it comes to the topic of APIs, “simple” is always a relative term. However, a good free API structures its resources clearly and logically for easy-to-understand requests.

Performance

Free APIs may place lower limits on the number of requests allowed within a given period. However, performance should not suffer simply because the API is public.

Slow API performance hurts user experience and may push users away from your app. If you can’t find a well-performing API that does what you want, you might have to invest in a paid API instead.

To make your life easier, we’ve rounded up the best free APIs you can use for your projects.

Gaming APIs

Steam Community API

  • Websitesteamcommunity.com/dev
  • Description: The Steamworks Web API provides an interface to various Steam features such as user authentication, inventory management, and game data.

Sample Code

const fetch = require('node-fetch');

const steamApiKey = 'YOUR_STEAM_API_KEY';
const steamId = 'STEAM_USER_ID';
const url = `http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=${steamApiKey}&steamids=${steamId}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Riot Games API

  • Websitedeveloper.riotgames.com
  • Description: Access data for games like League of Legends, Teamfight Tactics, Valorant, and more. Provides data on matches, rankings, champions, and other game-related statistics.

Sample Code

const fetch = require('node-fetch');

const riotApiKey = 'YOUR_RIOT_API_KEY';
const summonerName = 'SUMMONER_NAME';
const url = `https://na1.api.riotgames.com/lol/summoner/v4/summoners/by-name/${summonerName}?api_key=${riotApiKey}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Language APIs

Evil Insult Generator API

  • Websiteevilinsult.com/api
  • Description: Generate random insults in various languages for fun or testing purposes.

Sample Code

const fetch = require('node-fetch');

const url = 'https://evilinsult.com/generate_insult.php?lang=en&type=json';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Fun Translations API

  • Websitefuntranslations.com/api
  • Description: Translate text into various fun languages like Yoda, Shakespeare, Minion speak, and more.

Sample Code

const fetch = require('node-fetch');

const text = 'Hello, world!';
const url = `https://api.funtranslations.com/translate/yoda.json?text=${encodeURIComponent(text)}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Music APIs

Spotify Web API

Sample Code

const fetch = require('node-fetch');

const accessToken = 'YOUR_SPOTIFY_ACCESS_TOKEN';
const url = 'https://api.spotify.com/v1/me/player/recently-played';

fetch(url, {
    headers: {
        'Authorization': `Bearer ${accessToken}`
    }
})
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Security APIs

Have I Been Pwned API

  • Websitehaveibeenpwned.com/API/v2
  • Description: Check if your email or username has been part of a data breach. Provides data on breaches, pastes, and password exposure.

Sample Code

const fetch = require('node-fetch');

const email = 'test@example.com';
const url = `https://haveibeenpwned.com/api/v2/breachedaccount/${email}`;

fetch(url, {
    headers: {
        'User-Agent': 'Node.js'
    }
})
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Shodan API

  • Websitedeveloper.shodan.io
  • Description: Shodan is a search engine for Internet-connected devices. It provides data on various servers, devices, and systems worldwide.

Sample Code

const fetch = require('node-fetch');

const shodanApiKey = 'YOUR_SHODAN_API_KEY';
const query = 'apache';
const url = `https://api.shodan.io/shodan/host/search?key=${shodanApiKey}&query=${query}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Science & Math APIs

NASA API

  • Websiteapi.nasa.gov
  • Description: Access data from NASA’s datasets including astronomy photos, planetary data, and more.

Sample Code

const fetch = require('node-fetch');

const nasaApiKey = 'YOUR_NASA_API_KEY';
const url = `https://api.nasa.gov/planetary/apod?api_key=${nasaApiKey}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Wolfram Alpha API

  • Websiteproducts.wolframalpha.com/api
  • Description: Provides access to the vast computational knowledge of Wolfram Alpha, including math calculations, data analysis, and more.

Sample Code

const fetch = require('node-fetch');

const wolframAppId = 'YOUR_WOLFRAM_APP_ID';
const query = 'integrate x^2';
const url = `http://api.wolframalpha.com/v2/query?input=${encodeURIComponent(query)}&appid=${wolframAppId}&output=json`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Open Science Framework API

  • Websitedeveloper.osf.io
  • Description: Access research data, project management tools, and other scientific resources from the Open Science Framework.

Sample Code

const fetch = require('node-fetch');

const url = 'https://api.osf.io/v2/nodes/';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Sports APIs

NBA API

Sample Code

const fetch = require('node-fetch');

const url = 'https://api-nba-v1.p.rapidapi.com/teams/league/standard';
const options = {
    method: 'GET',
    headers: {
        'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
        'X-RapidAPI-Host': 'api-nba-v1.p.rapidapi.com'
    }
};

fetch(url, options)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Web Apps APIs

Discord API

Sample Code

const fetch = require('node-fetch');

const discordToken = 'YOUR_DISCORD_BOT_TOKEN';
const url = 'https://discord.com/api/users/@me';

fetch(url, {
    headers: {
        'Authorization': `Bot ${discordToken}`
    }
})
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Slack API

  • Websiteapi.slack.com
  • Description: Access Slack features such as messaging, user data, and workspace management.

Sample Code

const fetch = require('node-fetch');

const slackToken = 'YOUR_SLACK_API_TOKEN';
const url = 'https://slack.com/api/conversations.list';

fetch(url, {
    headers: {
        'Authorization': `Bearer ${slackToken}`
    }
})
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Products and Things APIs

Car Query API

make, model, and year information.

Sample Code

const fetch = require('node-fetch');

const url = 'https://www.carqueryapi.com/api/0.3/?cmd=getMakes';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Yelp API

  • Websiteyelp.com/developers
  • Description: Access data on local businesses, including reviews, ratings, and business details.

Sample Code

const fetch = require('node-fetch');

const yelpApiKey = 'YOUR_YELP_API_KEY';
const url = 'https://api.yelp.com/v3/businesses/search?location=San Francisco';

fetch(url, {
    headers: {
        'Authorization': `Bearer ${yelpApiKey}`
    }
})
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Health APIs

Healthcare.gov API

  • Websitehealthcare.gov/developers
  • Description: Access data on healthcare plans, provider directories, and other health-related information.

Sample Code

const fetch = require('node-fetch');

const url = 'https://data.healthcare.gov/resource/xyz123.json';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Governments & Geography APIs

Code.gov API

  • Websitecode.gov
  • Description: Access data on federal government software projects, including code repositories and project details.

Sample Code

const fetch = require('node-fetch');

const url = 'https://api.code.gov/projects';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Data.gov API

  • Websitedata.gov/developers/apis
  • Description: Access a wide range of datasets from the US government, including weather, education, and health data.

Sample Code

const fetch = require('node-fetch');

const url = 'https://api.data.gov/ed/collegescorecard/v1/schools.json?api_key=YOUR_DATA_GOV_API_KEY';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Data.europa.eu API

  • Websitedata.europa.eu/en
  • Description: Access open data from European Union institutions and bodies.

Sample Code

const fetch = require('node-fetch');

const url = 'https://data.europa.eu/api/hub/search/datasets';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

TransLoc API

Sample Code

const fetch = require('node-fetch');

const translocApiKey = 'YOUR_TRANSLOC_API_KEY';
const url = 'https://transloc-api-1-2.p.rapidapi.com/agencies.json';

fetch(url, {
    headers: {
        'X-RapidAPI-Key': translocApiKey,
        'X-RapidAPI-Host': 'transloc-api-1-2.p.rapidapi.com'
    }
})
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Food APIs

Open Food Facts API

  • Websiteworld.openfoodfacts.org/data
  • Description: Access data on food products worldwide, including ingredients, nutrition facts, and allergen information.

Sample Code

const fetch = require('node-fetch');

const url = 'https://world.openfoodfacts.org/api/v0/product/737628064502.json';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Taco Fancy API

Sample Code

const fetch = require('node-fetch');

const url = 'http://taco-randomizer.herokuapp.com/random/';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Open Source Projects APIs

Libraries.io API

  • Websitelibraries.io/api
  • Description: Access data on open source projects, including dependency information, version history, and more.

Sample Code

const fetch = require('node-fetch');

const librariesApiKey = 'YOUR_LIBRARIES_IO_API_KEY';
const url = `https://libraries.io/api/platforms?api_key=${librariesApiKey}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Movies and Comics APIs

Chuck Norris Jokes API

Sample Code

const fetch = require('node-fetch');

const url = 'https://api.chucknorris.io/jokes/random';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Final Space API

  • Websitefinalspaceapi.com
  • Description: Access data from the Final Space TV show, including characters, episodes, and more.

Sample Code

const fetch = require('node-fetch');

const url = 'https://finalspaceapi.com/api/v0/character';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Kitsu API

  • Websitekitsu.docs.apiary.io
  • Description: Access data on anime and manga, including series information, reviews, and user ratings.

Sample Code

const fetch = require('node-fetch');

const url = 'https://kitsu.io/api/edge/anime';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Marvel API

  • Websitedeveloper.marvel.com
  • Description: Access data on Marvel comics, characters, and creators.

Sample Code

const fetch = require('node-fetch');

const marvelPublicKey = 'YOUR_MARVEL_PUBLIC_KEY';
const marvelPrivateKey = 'YOUR_MARVEL_PRIVATE_KEY';
const ts = new Date().getTime();
const hash = require('crypto').createHash('md5').update(ts + marvelPrivateKey + marvelPublicKey).digest('hex');
const url = `https://gateway.marvel.com/v1/public/characters?ts=${ts}&apikey=${marvelPublicKey}&hash=${hash}`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

PokeAPI

  • Websitepokeapi.co
  • Description: Access data on Pokémon, including species, abilities, and game information.

Sample Code

const fetch = require('node-fetch');

const url = 'https://pokeapi.co/api/v2/pokemon/ditto';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Rick and Morty API

  • Websiterickandmortyapi.com
  • Description: Access data on the Rick and Morty TV show, including characters, episodes, and locations.

Sample Code

const fetch = require('node-fetch');

const url = 'https://rickandmortyapi.com/api/character';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Simpsons Quotes API

Sample

Code

const fetch = require('node-fetch');

const url = 'https://thesimpsonsquoteapi.glitch.me/quotes';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Star Wars API

  • Websiteswapi.tech
  • Description: Access data on the Star Wars universe, including films, characters, starships, and planets.

Sample Code

const fetch = require('node-fetch');

const url = 'https://swapi.tech/api/people/1';

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Superhero API

  • Websitesuperheroapi.com
  • Description: Access data on various superheroes, including their powers, biographies, and images.

Sample Code

const fetch = require('node-fetch');

const superheroApiKey = 'YOUR_SUPERHERO_API_KEY';
const url = `https://superheroapi.com/api/${superheroApiKey}/1`;

fetch(url)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));

Conclusion

This comprehensive list of free APIs for 2024 spans a wide range of categories, offering developers numerous opportunities to enhance their applications with powerful and diverse functionalities. These APIs provide valuable resources for creating innovative and engaging projects, from gaming and music to science and government data.

Feel free to explore these APIs and integrate them into your projects to unlock new possibilities and features. Happy coding!

Leave a Comment