Best Free APIs in 2026
Interactive directory of 57 best free APIs: AI, weather, maps, finance, images, auth, dev tools, and more. Filter, search, copy code snippets, and try them live!
Application Programming Interfaces (APIs) are the building blocks of modern software development. Whether you're building a hobby project, learning to code, or bootstrapping a startup, leveraging free APIs can significantly accelerate your development process.
We've tested and verified each API on this list as of March 2026. Every entry includes the free tier limits, authentication requirements, a rate limit generosity score, and a ready-to-use code snippet you can copy directly into your project.
API Categories at a Glance
From AI and machine learning APIs that let you add intelligence to your apps, to weather data for location-based services, financial market data for fintech projects, and authentication services that handle user management — this directory covers the most useful free APIs across 11 categories.
Quick Links to Categories
OpenAI
State-of-the-art language models like GPT-4, DALL-E for images, and Whisper for speech recognition.
View Code Snippet
const res = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
body: JSON.stringify({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }]
})
});
const data = await res.json();
console.log(data.choices[0].message.content); Hugging Face
Access thousands of open-source ML models for NLP, computer vision, and audio processing.
View Code Snippet
const res = await fetch(
"https://api-inference.huggingface.co/models/gpt2",
{
method: "POST",
headers: { "Authorization": "Bearer YOUR_HF_TOKEN" },
body: JSON.stringify({ inputs: "The future of AI is" })
}
);
const data = await res.json();
console.log(data[0].generated_text); Google Gemini
Multimodal AI that can process text, images, and audio simultaneously with generous free tier.
View Code Snippet
const res = await fetch(
"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_KEY",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
contents: [{ parts: [{ text: "Explain quantum computing" }] }]
})
}
);
const data = await res.json();
console.log(data.candidates[0].content.parts[0].text); Replicate
Run open-source models like Llama, Stable Diffusion, and custom models via simple API.
View Code Snippet
const res = await fetch("https://api.replicate.com/v1/predictions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
version: "MODEL_VERSION_ID",
input: { prompt: "A painting of a cat" }
})
});
const data = await res.json();
console.log(data.urls.get); // poll this URL for results Cohere
Large language models for text generation, classification, and embeddings with production-ready APIs.
View Code Snippet
const res = await fetch("https://api.cohere.ai/v1/generate", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "command",
prompt: "Write a tagline for an ice cream shop"
})
});
const data = await res.json();
console.log(data.generations[0].text); OpenWeatherMap
DEMOCurrent weather, forecasts, and historical data. Most popular weather API among developers.
View Code Snippet
const city = "London";
const res = await fetch(
\`https://api.openweathermap.org/data/2.5/weather?q=\${city}&appid=YOUR_KEY&units=metric\ Open-Meteo
DEMOOpen-source weather API with no API key required. High-resolution forecasts and historical data.
View Code Snippet
const res = await fetch(
"https://api.open-meteo.com/v1/forecast?latitude=40.71&longitude=-74.01¤t=temperature_2m,windspeed_10m"
);
const data = await res.json();
console.log(\`Temp: \${data.current.temperature_2m}°C\`);
console.log(\`Wind: \${data.current.windspeed_10m} km/h\`); WeatherAPI
DEMOGlobal weather data with current conditions, forecasts, and astronomy information.
View Code Snippet
const res = await fetch(
"https://api.weatherapi.com/v1/current.json?key=YOUR_KEY&q=Tokyo"
);
const data = await res.json();
console.log(\`\${data.location.name}: \${data.current.temp_c}°C\`);
console.log(\`Condition: \${data.current.condition.text}\`); Visual Crossing
Historical weather data and forecasts perfect for data analysis and machine learning projects.
View Code Snippet
const res = await fetch(
"https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/London?key=YOUR_KEY&unitGroup=metric"
);
const data = await res.json();
console.log(\`Today: \${data.days[0].temp}°C\`);
console.log(\`Conditions: \${data.days[0].conditions}\`); Google Maps
Comprehensive mapping platform with Places, Routes, and Maps APIs. Industry standard.
View Code Snippet
const address = encodeURIComponent("1600 Amphitheatre Parkway");
const res = await fetch(
\`https://maps.googleapis.com/maps/api/geocode/json?address=\${address}&key=YOUR_KEY\ Mapbox
Highly customizable maps and navigation services with beautiful design options.
View Code Snippet
const query = encodeURIComponent("Central Park");
const res = await fetch(
\`https://api.mapbox.com/geocoding/v5/mapbox.places/\${query}.json?access_token=YOUR_TOKEN\ OpenStreetMap
Free, editable map data via Nominatim API. Great for custom mapping applications.
View Code Snippet
const res = await fetch(
"https://nominatim.openstreetmap.org/search?format=json&q=Berlin",
{ headers: { "User-Agent": "MyApp/1.0" } }
);
const data = await res.json();
console.log(\`\${data[0].display_name}\`);
console.log(\`Lat: \${data[0].lat}, Lon: \${data[0].lon}\`); HERE Maps
Enterprise-grade mapping with generous freemium limits for routing and geocoding.
View Code Snippet
const res = await fetch(
"https://geocode.search.hereapi.com/v1/geocode?q=Paris&apiKey=YOUR_KEY"
);
const data = await res.json();
const pos = data.items[0].position;
console.log(\`\${data.items[0].title}: \${pos.lat}, \${pos.lng}\`); Alpha Vantage
Real-time and historical stock data, forex, and cryptocurrency market information.
View Code Snippet
const res = await fetch(
"https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=AAPL&apikey=YOUR_KEY"
);
const data = await res.json();
const quote = data["Global Quote"];
console.log(\`AAPL: $\${quote["05. price"]}\`); CoinGecko
DEMOComprehensive cryptocurrency data with prices, market caps, and trading volumes.
View Code Snippet
const res = await fetch(
"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd"
);
const data = await res.json();
console.log(\`BTC: $\${data.bitcoin.usd}\`);
console.log(\`ETH: $\${data.ethereum.usd}\`); Polygon.io
Real-time and historical market data for stocks, options, forex, and crypto.
View Code Snippet
const res = await fetch(
"https://api.polygon.io/v2/aggs/ticker/AAPL/prev?apiKey=YOUR_KEY"
);
const data = await res.json();
const r = data.results[0];
console.log(\`AAPL prev close: $\${r.c}, volume: \${r.v}\`); Yahoo Finance
Comprehensive financial data via unofficial API wrappers. Wide coverage of global markets.
View Code Snippet
// Using the unofficial Yahoo Finance endpoint
const res = await fetch(
"https://query1.finance.yahoo.com/v8/finance/chart/MSFT?interval=1d&range=5d"
);
const data = await res.json();
const prices = data.chart.result[0].indicators.quote[0].close;
console.log("MSFT last 5 closes:", prices); Fixer.io
DEMOForeign exchange rates and currency conversion with 170+ currencies.
View Code Snippet
const res = await fetch(
"http://data.fixer.io/api/latest?access_key=YOUR_KEY&symbols=USD,GBP,JPY"
);
const data = await res.json();
console.log(\`EUR/USD: \${data.rates.USD}\`);
console.log(\`EUR/GBP: \${data.rates.GBP}\`); Stripe
Payment processing APIs. Test mode is completely free with no transaction limits.
View Code Snippet
const res = await fetch("https://api.stripe.com/v1/payment_intents", {
method: "POST",
headers: {
"Authorization": "Bearer sk_test_YOUR_KEY",
"Content-Type": "application/x-www-form-urlencoded"
},
body: "amount=2000¤cy=usd&payment_method_types[]=card"
});
const intent = await res.json();
console.log(\`Payment Intent: \${intent.id}, Status: \${intent.status}\`); Unsplash
DEMOHigh-quality stock photos from professional photographers. Perfect for web design.
View Code Snippet
const res = await fetch(
"https://api.unsplash.com/photos/random?query=nature",
{ headers: { "Authorization": "Client-ID YOUR_ACCESS_KEY" } }
);
const data = await res.json();
console.log(data.urls.regular);
console.log(\`Photo by \${data.user.name}\`); Pexels
DEMOFree stock photos and videos with generous rate limits and high-quality content.
View Code Snippet
const res = await fetch(
"https://api.pexels.com/v1/search?query=mountain&per_page=1",
{ headers: { "Authorization": "YOUR_API_KEY" } }
);
const data = await res.json();
console.log(data.photos[0].src.medium);
console.log(\`Photo by \${data.photos[0].photographer}\`); Lorem Picsum
DEMOThe 'Lorem Ipsum' for photos. Random placeholder images with custom dimensions.
View Code Snippet
// Just use the URL directly - no fetch needed!
const imageUrl = "https://picsum.photos/400/300";
// Or get a specific image with metadata:
const res = await fetch("https://picsum.photos/id/237/info");
const data = await res.json();
console.log(\`Author: \${data.author}, Size: \${data.width}x\${data.height}\`); Cloudinary
Image and video management with transformations, optimization, and delivery.
View Code Snippet
const formData = new FormData();
formData.append("file", fileInput.files[0]);
formData.append("upload_preset", "YOUR_PRESET");
const res = await fetch(
"https://api.cloudinary.com/v1_1/YOUR_CLOUD/image/upload",
{ method: "POST", body: formData }
);
const data = await res.json();
console.log(\`Uploaded: \${data.secure_url}\`); The Cat API
DEMORandom cat pictures for testing and fun projects. Essential for developers!
View Code Snippet
const res = await fetch("https://api.thecatapi.com/v1/images/search");
const data = await res.json();
console.log(data[0].url);
// Returns a random cat image URL each time The Dog API
DEMORandom dog pictures for testing and prototyping. Companion to The Cat API.
View Code Snippet
const res = await fetch("https://api.thedogapi.com/v1/images/search");
const data = await res.json();
console.log(data[0].url);
// Returns a random dog image URL each time Giphy
Search and share GIFs. Huge library of animated content for apps and messaging.
View Code Snippet
const res = await fetch(
"https://api.giphy.com/v1/gifs/trending?api_key=YOUR_KEY&limit=5"
);
const data = await res.json();
data.data.forEach(gif => {
console.log(\`\${gif.title}: \${gif.images.downsized.url}\`);
}); Auth0
Comprehensive identity management platform with social login and enterprise features.
View Code Snippet
const res = await fetch("https://YOUR_DOMAIN.auth0.com/oauth/token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
client_id: "YOUR_CLIENT_ID",
client_secret: "YOUR_SECRET",
audience: "https://YOUR_DOMAIN.auth0.com/api/v2/",
grant_type: "client_credentials"
})
});
const data = await res.json();
console.log(\`Token: \${data.access_token}\`); Clerk
Drop-in authentication with beautiful UI components. Popular with React/Next.js developers.
View Code Snippet
const res = await fetch("https://api.clerk.com/v1/users", {
headers: { "Authorization": "Bearer YOUR_SECRET_KEY" }
});
const users = await res.json();
users.forEach(u => {
console.log(\`\${u.first_name} \${u.last_name}: \${u.email_addresses[0]?.email_address}\`);
}); Supabase Auth
Open-source Firebase alternative with integrated PostgreSQL and real-time subscriptions.
View Code Snippet
const res = await fetch("https://YOUR_PROJECT.supabase.co/auth/v1/signup", {
method: "POST",
headers: {
"apikey": "YOUR_ANON_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "[email protected]",
password: "securepassword"
})
});
const data = await res.json();
console.log(\`User ID: \${data.user.id}\`); Firebase Auth
Google's authentication service with phone, email, and social provider support.
View Code Snippet
const res = await fetch(
"https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=YOUR_KEY",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "[email protected]",
password: "securepassword",
returnSecureToken: true
})
}
);
const data = await res.json();
console.log(\`ID Token: \${data.idToken}\`); Supabase
Open-source Firebase alternative with PostgreSQL, real-time, and auth included.
View Code Snippet
const res = await fetch(
"https://YOUR_PROJECT.supabase.co/rest/v1/todos?select=*",
{
headers: {
"apikey": "YOUR_ANON_KEY",
"Authorization": "Bearer YOUR_ANON_KEY"
}
}
);
const todos = await res.json();
console.log(\`Found \${todos.length} todos\`); PlanetScale
Serverless MySQL with database branching for modern development workflows.
View Code Snippet
// PlanetScale uses MySQL protocol via their serverless driver
import { connect } from "@planetscale/database";
const conn = connect({
host: "YOUR_HOST",
username: "YOUR_USER",
password: "YOUR_PASS"
});
const results = await conn.execute("SELECT * FROM users LIMIT 5");
console.log(results.rows); Neon
Serverless Postgres that separates storage and compute for true scalability.
View Code Snippet
// Using Neon's serverless driver
import { neon } from "@neondatabase/serverless";
const sql = neon("postgresql://user:pass@host/db");
const posts = await sql\`SELECT * FROM posts ORDER BY created_at DESC LIMIT 10\`;
console.log(posts); MongoDB Atlas
Cloud-hosted MongoDB with free M0 cluster for small projects and prototyping.
View Code Snippet
const res = await fetch(
"https://data.mongodb-api.com/app/YOUR_APP/endpoint/data/v1/action/find",
{
method: "POST",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
dataSource: "Cluster0",
database: "mydb",
collection: "users",
filter: {}
})
}
);
const data = await res.json();
console.log(data.documents); Upstash
Serverless Redis and Kafka for caching, rate limiting, and real-time features.
View Code Snippet
// Upstash Redis REST API
const res = await fetch("https://YOUR_ENDPOINT.upstash.io/set/mykey/hello", {
headers: { "Authorization": "Bearer YOUR_TOKEN" }
});
const set = await res.json();
const get = await fetch("https://YOUR_ENDPOINT.upstash.io/get/mykey", {
headers: { "Authorization": "Bearer YOUR_TOKEN" }
});
const data = await get.json();
console.log(data.result); // "hello" TMDB
The Movie Database with comprehensive film and TV show information.
View Code Snippet
const res = await fetch(
"https://api.themoviedb.org/3/movie/popular?api_key=YOUR_KEY&page=1"
);
const data = await res.json();
data.results.slice(0, 5).forEach(m => {
console.log(\`\${m.title} (\${m.release_date}) - \${m.vote_average}/10\`);
}); OMDb
Open Movie Database with movie information, ratings, and poster images.
View Code Snippet
const res = await fetch(
"https://www.omdbapi.com/?t=Inception&apikey=YOUR_KEY"
);
const movie = await res.json();
console.log(\`\${movie.Title} (\${movie.Year})\`);
console.log(\`IMDB: \${movie.imdbRating}, RT: \${movie.Ratings[1]?.Value}\`); Jikan
Unofficial MyAnimeList API for anime and manga information. No key required.
View Code Snippet
const res = await fetch("https://api.jikan.moe/v4/top/anime?limit=5");
const data = await res.json();
data.data.forEach(anime => {
console.log(\`\${anime.title} - Score: \${anime.score}\`);
}); Spotify Web API
Access Spotify's catalog with track info, playlists, and user data.
View Code Snippet
// First get a token via client credentials
const tokenRes = await fetch("https://accounts.spotify.com/api/token", {
method: "POST",
headers: {
"Authorization": "Basic " + btoa("CLIENT_ID:CLIENT_SECRET"),
"Content-Type": "application/x-www-form-urlencoded"
},
body: "grant_type=client_credentials"
});
const { access_token } = await tokenRes.json();
const res = await fetch("https://api.spotify.com/v1/search?q=Bohemian+Rhapsody&type=track&limit=1", {
headers: { "Authorization": \`Bearer \${access_token}\` }
});
const data = await res.json();
console.log(data.tracks.items[0].name); REST Countries
DEMOInformation about all world countries including flags, currencies, and languages.
View Code Snippet
const res = await fetch("https://restcountries.com/v3.1/name/canada");
const data = await res.json();
const country = data[0];
console.log(\`\${country.name.common}: Pop \${country.population.toLocaleString()}\`);
console.log(\`Capital: \${country.capital[0]}, Region: \${country.region}\`); PokeAPI
DEMOComplete Pokemon data: species, abilities, moves, items, and game info. No auth needed.
View Code Snippet
const res = await fetch("https://pokeapi.co/api/v2/pokemon/pikachu");
const pokemon = await res.json();
console.log(\`\${pokemon.name} (#\${pokemon.id})\`);
console.log(\`Types: \${pokemon.types.map(t => t.type.name).join(", ")}\`);
console.log(\`Height: \${pokemon.height/10}m, Weight: \${pokemon.weight/10}kg\`); NASA APOD
DEMONASA's Astronomy Picture of the Day. Beautiful space images with explanations. Free, no key needed for demo.
View Code Snippet
const res = await fetch(
"https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY"
);
const data = await res.json();
console.log(\`Title: \${data.title}\`);
console.log(\`Date: \${data.date}\`);
console.log(\`Image: \${data.url}\`);
console.log(\`Explanation: \${data.explanation.slice(0, 100)}...\`); NewsAPI
Search worldwide news articles from 80,000+ sources. Great for news aggregators.
View Code Snippet
const res = await fetch(
"https://newsapi.org/v2/top-headlines?country=us&category=technology&apiKey=YOUR_KEY"
);
const data = await res.json();
data.articles.slice(0, 3).forEach(a => {
console.log(\`\${a.title} - \${a.source.name}\`);
}); EmailJS
Send emails directly from client-side applications without backend servers.
View Code Snippet
const res = await fetch("https://api.emailjs.com/api/v1.0/email/send", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
service_id: "YOUR_SERVICE_ID",
template_id: "YOUR_TEMPLATE_ID",
user_id: "YOUR_PUBLIC_KEY",
template_params: {
to_name: "John",
message: "Hello from my app!"
}
})
});
console.log("Email sent:", res.ok); Twilio
SMS, voice calls, and video communication with trial credits for new users.
View Code Snippet
const res = await fetch(
"https://api.twilio.com/2010-04-01/Accounts/YOUR_SID/Messages.json",
{
method: "POST",
headers: {
"Authorization": "Basic " + btoa("YOUR_SID:YOUR_AUTH_TOKEN"),
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams({
To: "+1234567890",
From: "+0987654321",
Body: "Hello from Twilio!"
})
}
);
const data = await res.json();
console.log(\`Message SID: \${data.sid}\`); Discord Webhooks
Send messages to Discord channels via webhooks. Perfect for notifications.
View Code Snippet
const res = await fetch("https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_TOKEN", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
content: "Hello from my app!",
embeds: [{
title: "Alert",
description: "Something happened",
color: 5814783
}]
})
});
console.log("Sent:", res.ok); Slack API
Integrate with Slack workspaces for messaging, file sharing, and workflow automation.
View Code Snippet
const res = await fetch("https://slack.com/api/chat.postMessage", {
method: "POST",
headers: {
"Authorization": "Bearer xoxb-YOUR-TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
channel: "C01ABCDEF",
text: "Hello from the API!"
})
});
const data = await res.json();
console.log(\`Message sent: \${data.ok}, ts: \${data.ts}\`); SendGrid
Transactional email service with templates, analytics, and high deliverability.
View Code Snippet
const res = await fetch("https://api.sendgrid.com/v3/mail/send", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
personalizations: [{ to: [{ email: "[email protected]" }] }],
from: { email: "[email protected]" },
subject: "Hello!",
content: [{ type: "text/plain", value: "Sent via SendGrid" }]
})
});
console.log("Email sent:", res.status === 202); JSON Placeholder
DEMOFake JSON API for testing and prototyping. Perfect for frontend development.
View Code Snippet
const res = await fetch("https://jsonplaceholder.typicode.com/posts/1");
const post = await res.json();
console.log(\`Title: \${post.title}\`);
console.log(\`Body: \${post.body}\`);
// Also supports POST, PUT, PATCH, DELETE
const newPost = await fetch("https://jsonplaceholder.typicode.com/posts", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title: "New Post", body: "Content", userId: 1 })
}); QR Server
DEMOGenerate QR codes via simple URL parameters. No API key required.
View Code Snippet
// Just use the URL directly in an <img> tag:
const text = encodeURIComponent("https://example.com");
const qrUrl = \`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=\${text}\`;
console.log(qrUrl);
// Or fetch the image as a blob:
const res = await fetch(qrUrl);
const blob = await res.blob(); GitHub API
Access repos, issues, PRs, users, and organizations. Most popular developer API.
View Code Snippet
const res = await fetch("https://api.github.com/repos/facebook/react", {
headers: { "Authorization": "Bearer ghp_YOUR_TOKEN" }
});
const repo = await res.json();
console.log(\`\${repo.full_name}: \${repo.stargazers_count} stars\`);
console.log(\`Language: \${repo.language}, Forks: \${repo.forks_count}\`); Notion API
Read and write Notion pages, databases, and blocks programmatically.
View Code Snippet
const res = await fetch(
"https://api.notion.com/v1/databases/YOUR_DB_ID/query",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Notion-Version": "2022-06-28",
"Content-Type": "application/json"
},
body: JSON.stringify({ page_size: 10 })
}
);
const data = await res.json();
console.log(\`Found \${data.results.length} pages\`); Dictionary API
DEMOFree English dictionary with definitions, phonetics, and audio pronunciation.
View Code Snippet
const word = "serendipity";
const res = await fetch(\`https://api.dictionaryapi.dev/api/v2/entries/en/\${word}\`);
const data = await res.json();
console.log(\`\${data[0].word}: \${data[0].phonetic}\`);
console.log(\`Definition: \${data[0].meanings[0].definitions[0].definition}\`); RandomUser.me
DEMOGenerate random user profiles with names, addresses, photos. Great for mockups and testing.
View Code Snippet
const res = await fetch("https://randomuser.me/api/?results=3");
const data = await res.json();
data.results.forEach(user => {
console.log(\`\${user.name.first} \${user.name.last}\`);
console.log(\` Email: \${user.email}\`);
console.log(\` Location: \${user.location.city}, \${user.location.country}\`);
}); IPinfo
IP geolocation and ASN data. Identify visitor location, ISP, and company.
View Code Snippet
const res = await fetch("https://ipinfo.io/json?token=YOUR_TOKEN");
const data = await res.json();
console.log(\`IP: \${data.ip}\`);
console.log(\`Location: \${data.city}, \${data.region}, \${data.country}\`);
console.log(\`ISP: \${data.org}\`); Abstract API
Suite of utility APIs: geolocation, email validation, phone validation, and more.
View Code Snippet
const res = await fetch(
"https://ipgeolocation.abstractapi.com/v1/?api_key=YOUR_KEY"
);
const data = await res.json();
console.log(\`IP: \${data.ip_address}\`);
console.log(\`Location: \${data.city}, \${data.country}\`);
console.log(\`Timezone: \${data.timezone.name}\`); Have I Been Pwned
Check if email addresses or passwords have been exposed in data breaches.
View Code Snippet
// Check a password hash (k-anonymity model - safe!)
const password = "test123";
const encoder = new TextEncoder();
const hashBuffer = await crypto.subtle.digest("SHA-1", encoder.encode(password));
const hashHex = Array.from(new Uint8Array(hashBuffer))
.map(b => b.toString(16).padStart(2, "0")).join("").toUpperCase();
const prefix = hashHex.slice(0, 5);
const suffix = hashHex.slice(5);
const res = await fetch(\`https://api.pwnedpasswords.com/range/\${prefix}\`);
const text = await res.text();
const found = text.split("\\n").find(line => line.startsWith(suffix));
console.log(found ? "Password has been pwned!" : "Password not found in breaches"); Frequently Asked Questions
Many free APIs are reliable for side projects and MVPs, but for mission-critical production use, you should evaluate their uptime guarantees, rate limits, and SLA. Often, transitioning to a paid tier is necessary as your application scales.
To handle rate limits, implement caching to reduce redundant requests, use queues to pace your outbound calls, and implement exponential backoff strategies for retrying failed requests when limits are hit.
Most high-quality free APIs require authentication via an API key or OAuth. This allows providers to track usage, enforce rate limits, and prevent abuse, even on their free tiers.
REST APIs expose multiple endpoints for different resources and use standard HTTP methods, while GraphQL exposes a single endpoint and allows clients to request exactly the data they need, reducing over-fetching.
Yes, you can monetize apps built with free APIs, but you must carefully read the Terms of Service for each API. Some providers explicitly forbid commercial use of their free tiers or require attribution.
Several popular APIs require no authentication: Open-Meteo (weather), REST Countries, JSONPlaceholder, PokeAPI, Dictionary API, RandomUser.me, NASA APOD, Lorem Picsum, The Cat API, The Dog API, and QR Server. These are ideal for learning and prototyping.