Kho API miễn phí cần biết năm 2025
API (Giao diện lập trình ứng dụng) là công cụ thiết yếu cho nhà phát triển, cho phép họ tích hợp các dịch vụ bên thứ ba vào ứng dụng của mình. Dưới đây là danh sách mở rộng các API miễn phí có sẵn trong năm 2025 trên nhiều danh mục khác nhau, cùng với liên kết trang web, mô tả và mã mẫu cho mỗi API.
1. API Game
API Steam Community
- Trang web: steamcommunity.com/dev
- Mô tả: Steamworks Web API cung cấp giao diện cho các tính năng Steam khác nhau như xác thực người dùng, quản lý kho đồ và dữ liệu trò chơi.
Mã mẫu
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
- Trang web: developer.riotgames.com
- Mô tả: Truy cập dữ liệu cho các trò chơi như Liên Minh Huyền Thoại, Đấu Trường Chân Lý, Valorant, v.v. Cung cấp dữ liệu về trận đấu, bảng xếp hạng, tướng và các số liệu thống kê liên quan đến trò chơi khác.
Mã mẫu
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));
2. API Ngôn ngữ
Evil Insult Generator API
- Trang web: evilinsult.com/api
- Mô tả: Tạo ra các lời lăng mạ ngẫu nhiên bằng nhiều ngôn ngữ khác nhau cho mục đích vui chơi hoặc thử nghiệm.
Mã mẫu
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
- Trang web: funtranslations.com/api
- Mô tả: Dịch văn bản sang nhiều ngôn ngữ vui nhộn khác nhau như Yoda, Shakespeare, Minion, v.v.
Mã mẫu
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));
3. API Âm nhạc
Spotify Web API
- Trang web: developer.spotify.com/documentation/web-api
- Mô tả: Truy cập dữ liệu âm nhạc như album, nghệ sĩ, danh sách phát và dữ liệu người dùng. Kiểm soát phát lại Spotify và hơn thế nữa.
Mã mẫu
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));
4. API Bảo mật
Have I Been Pwned API
- Trang web: haveibeenpwned.com/API/v2
- Mô tả: Kiểm tra xem email hoặc tên người dùng của bạn có nằm trong vụ rò rỉ dữ liệu nào không. Cung cấp dữ liệu về các vụ vi phạm, các đoạn mã và việc lộ mật khẩu.
Mã mẫu
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
- Trang web: developer.shodan.io
- Mô tả: Shodan là một công cụ tìm kiếm cho các thiết bị được kết nối Internet. Nó cung cấp dữ liệu về nhiều máy chủ, thiết bị và hệ thống khác nhau trên toàn thế giới.
Mã mẫu
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));
5. API Khoa học & Toán học
NASA API
- Trang web: api.nasa.gov
- Mô tả: Truy cập dữ liệu từ các bộ dữ liệu của NASA bao gồm ảnh thiên văn, dữ liệu hành tinh, v.v.
Mã mẫu
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
- Trang web: products.wolframalpha.com/api
- Mô tả: Cung cấp quyền truy cập vào kiến thức tính toán rộng lớn của Wolfram Alpha, bao gồm tính toán toán học, phân tích dữ liệu, v.v.
Mã mẫu
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
- Trang web: developer.osf.io
- Mô tả: Truy cập dữ liệu nghiên cứu, công cụ quản lý dự án và các tài nguyên khoa học khác từ Open Science Framework.
Mã mẫu
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));
6. API Ứng dụng Web
Discord API
- Trang web: discord.com/developers/docs/intro
- Mô tả: Tích hợp ứng dụng của bạn với Discord, cho phép xác thực người dùng, nhắn tin, v.v.
Mã mẫu
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
- Trang web: api.slack.com
- Mô tả: Truy cập các tính năng Slack như nhắn tin, dữ liệu người dùng và quản lý không gian làm việc.
Mã mẫu
onst 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));
7. API thể thao
NBA API
- Trang web: any-api.com/nba_com/nba_com/docs/API_Description
- Mô tả: Truy cập dữ liệu về các đội, cầu thủ và trận đấu NBA.
Mã mẫu
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));
8. API Sản phẩm và Đồ vật
Car Query API
- Trang web: carqueryapi.com
- Mô tả: Truy cập dữ liệu về ô tô, bao gồm thông tin về hãng sản xuất, mẫu xe và năm sản xuất.
Mã mẫu
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
- Trang web: yelp.com/developers
- Mô tả: Truy cập dữ liệu về các doanh nghiệp địa phương, bao gồm đánh giá, xếp hạng và chi tiết doanh nghiệp.
Mã mẫu
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));
9. API Sức khỏe
Healthcare.gov API
- Trang web: healthcare.gov/developers
- Mô tả: Truy cập dữ liệu về các gói chăm sóc sức khỏe, danh mục nhà cung cấp và các thông tin liên quan đến sức khỏe khác.
Mã mẫu
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));
10. API Chính phủ & Địa lý
Code.gov API
- Trang web: code.gov
- Mô tả: Truy cập dữ liệu về các dự án phần mềm của chính phủ liên bang, bao gồm kho mã và chi tiết dự án.
Mã mẫu
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
- Trang web: data.gov/developers/apis
- Mô tả: Truy cập một loạt các bộ dữ liệu từ chính phủ Hoa Kỳ, bao gồm dữ liệu về thời tiết, giáo dục và sức khỏe.
Mã mẫu
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
- Trang web: data.europa.eu/en
- Mô tả: Truy cập dữ liệu mở từ các tổ chức và cơ quan của Liên minh Châu Âu.
Mã mẫu
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
- Trang web: rapidapi.com/transloc/api/openapi-1-2/details
- Mô tả: Truy cập dữ liệu vận chuyển công cộng theo thời gian thực bao gồm dự đoán thời gian đến, vị trí phương tiện, v.v.
Mã mẫu
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));
11. API Thực phẩm
Open Food Facts API
- Trang web: world.openfoodfacts.org/data
- Mô tả: Truy cập dữ liệu về các sản phẩm thực phẩm trên toàn thế giới, bao gồm thành phần, thông tin dinh dưỡng và thông tin về chất gây dị ứng.
Mã mẫu
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
- Trang web: github.com/evz/tacofancy-api
- Mô tả: Truy cập dữ liệu về công thức nấu taco, bao gồm thành phần và phương pháp chuẩn bị.
Mã mẫu
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));
12. API Dự án Nguồn Mở
Libraries.io API
- Trang web: libraries.io/api
- Mô tả: Truy cập dữ liệu về các dự án nguồn mở, bao gồm thông tin phụ thuộc, lịch sử phiên bản, v.v.
Mã mẫu
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));
13. API Phim và Truyện tranh
Chuck Norris Jokes API
- Trang web: api.chucknorris.io
- Mô tả: Truy cập bộ sưu tập truyện cười Chuck Norris.
Mã mẫu
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
- Trang web: finalspaceapi.com
- Mô tả: Truy cập dữ liệu từ chương trình truyền hình Final Space, bao gồm nhân vật, tập phim, v.v.
Mã mẫu
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
- Trang web: kitsu.docs.apiary.io
- Mô tả: Truy cập dữ liệu về anime và manga, bao gồm thông tin loạt phim, đánh giá và xếp hạng của người dùng.
Mã mẫu
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
- Trang web: developer.marvel.com
- Mô tả: Truy cập dữ liệu về truyện tranh, nhân vật và người sáng tạo Marvel.
Mã mẫu
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
- Trang web: pokeapi.co
- Mô tả: Truy cập dữ liệu về Pokémon, bao gồm loài, khả năng và thông tin trò chơi.
Mã mẫu
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
- Trang web: rickandmortyapi.com
- Mô tả: Truy cập dữ liệu về chương trình truyền hình Rick and Morty, bao gồm nhân vật, tập phim và địa điểm.
Mã mẫu
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
- Trang web: thesimpsonsquoteapi.glitch.me
- Mô tả: Truy cập bộ sưu tập câu trích dẫn từ chương trình truyền hình The Simpsons.
Mã mẫu
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
- Trang web: swapi.tech
- Mô tả: Truy cập dữ liệu về vũ trụ Star Wars, bao gồm phim, nhân vật, tàu vũ trụ và hành tinh.
Mã mẫu
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
- Trang web: superheroapi.com
- Mô tả: Truy cập dữ liệu về nhiều siêu anh hùng khác nhau, bao gồm sức mạnh, tiểu sử và hình ảnh của họ.
Mã mẫu
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));
Kết luận
Danh sách toàn diện này về các API miễn phí cho năm 2024 trải dài trên nhiều danh mục, mang đến cho các nhà phát triển nhiều cơ hội để nâng cao ứng dụng của họ với các chức năng mạnh mẽ và đa dạng. Từ trò chơi và âm nhạc đến khoa học và dữ liệu chính phủ, những API này cung cấp các tài nguyên quý giá để tạo ra các dự án sáng tạo và hấp dẫn.
Cảm ơn các bạn đã theo dõi!
All rights reserved