Public APIs: The Ultimate Free API Collection for Developers
In the world of modern software development, APIs are the building blocks that power applications. The Public APIs repository on GitHub has become the go-to resource for developers seeking free, publicly available APIs. With over 423,000 stars and 46,000 forks, this community-maintained collection is one of the most popular repositories on GitHub, offering a treasure trove of APIs across dozens of categories.
What is Public APIs?
The Public APIs repository is a manually curated collection of free APIs maintained by community members and folks at APILayer. It serves as a comprehensive directory that helps developers discover APIs for virtually any use case - from simple placeholder images to complex financial data.
Understanding the Repository Structure
The Public APIs repository represents a remarkable community effort to organize and catalog the vast landscape of available web APIs. This collection has evolved over years of community contributions, becoming an indispensable resource for developers worldwide.
Core Organization Principles:
The repository follows a category-based organization system that groups APIs by their primary domain. Each category contains a table with the following information columns:
- API Name: The name of the API with a link to its documentation
- Description: A brief explanation of what the API provides
- Auth: Authentication method required (apiKey, OAuth, or None)
- HTTPS: Whether the API supports secure HTTPS connections
- CORS: Cross-Origin Resource Sharing support status
This standardized format makes it incredibly easy to scan through options and quickly identify APIs that meet your specific requirements. The authentication column is particularly valuable as it immediately tells you whether you need to sign up for an API key or if you can start using the API immediately.
Community Curation Process:
What makes this repository special is its community-driven nature. Anyone can contribute through pull requests, and the maintainers review submissions to ensure quality and relevance. This collaborative approach has resulted in:
- Over 1,400 individual APIs cataloged
- 50+ distinct categories covering every imaginable domain
- Regular updates to remove deprecated APIs and add new ones
- Quality control through community feedback and issue reporting
APILayer Partnership:
The repository is maintained in partnership with APILayer, a company that provides premium APIs. This partnership ensures the repository remains active and well-maintained while keeping the core mission of providing free API resources to developers.
Categories Available
The repository organizes APIs into 50+ categories, making it easy to find exactly what you need:
| Category | Description | Example APIs |
|---|---|---|
| Animals | Pet adoption, animal facts, images | Cat Facts, Dog API, RandomFox |
| Anime | Anime databases, streaming, tracking | Jikan, Kitsu, Studio Ghibli |
| Anti-Malware | Security scanning, threat detection | VirusTotal, URLScan.io |
| Art & Design | Color schemes, images, icons | ColourLovers, Dribbble |
| Authentication | OAuth, identity verification | Various auth providers |
| Blockchain | Crypto data, smart contracts | Multiple crypto APIs |
| Books | Book databases, reading data | Open Library, Google Books |
| Business | Company data, analytics | Various business APIs |
| Calendar | Date/time, scheduling | Calendar APIs |
| Cryptocurrency | Crypto prices, market data | CoinGecko, CryptoCompare |
| Currency Exchange | Forex rates, conversion | Fixer, ExchangeRate-API |
| Data Validation | Email, phone validation | Mailboxlayer, Numverify |
| Development | Code tools, documentation | GitHub API, GitLab API |
| Email services, validation | Multiple email APIs | |
| Entertainment | Movies, music, games | TMDB, Spotify, IGDB |
| Finance | Stock market, financial data | Marketstack, Alpha Vantage |
| Food & Drink | Recipes, nutrition | Spoonacular, TheMealDB |
| Games & Comics | Game data, comic databases | Steam, Marvel API |
| Geocoding | Maps, location services | OpenStreetMap, Google Maps |
| Government | Open government data | Various gov APIs |
| Health | Medical data, fitness | Health APIs |
| Machine Learning | AI models, predictions | Various ML APIs |
| Music | Music streaming, metadata | Last.fm, Deezer |
| News | News articles, feeds | NewsAPI, Currents |
| Open Data | Public datasets | Various open data sources |
| Photography | Image hosting, stock photos | Unsplash, Pexels |
| Programming | Code execution, tutorials | Judge0, Codeforces |
| Science & Math | Scientific data, calculations | NASA API, Wolfram |
| Security | Security tools, scanning | Security APIs |
| Shopping | E-commerce, products | Amazon, eBay APIs |
| Social | Social media integration | Twitter, Reddit APIs |
| Sports & Fitness | Sports data, fitness tracking | Various sports APIs |
| Text Analysis | NLP, sentiment analysis | Text processing APIs |
| Transportation | Transit data, vehicle info | Transit APIs |
| Video | Video hosting, streaming | YouTube, Vimeo APIs |
| Weather | Weather data, forecasts | Weatherstack, OpenWeatherMap |
Deep Dive into Popular Categories
Animals Category:
The Animals category is one of the most popular and beginner-friendly sections. It includes APIs that provide:
- Cat Facts: Daily cat facts delivered via API, perfect for building fun applications or learning API integration
- Dog API: Access to thousands of dog images organized by breed, useful for placeholder images or pet-related applications
- RandomFox: Random fox images for placeholder content or entertainment apps
- HTTP Cat: HTTP status codes illustrated with cats, a creative way to handle error pages
These APIs are particularly valuable for developers learning API consumption because they typically require no authentication and have simple response structures.
Finance Category:
The Finance category provides access to critical financial data:
- Marketstack: Real-time and historical stock market data from over 70 global exchanges
- Alpha Vantage: Comprehensive financial data including stocks, forex, and cryptocurrencies
- Fixer: Foreign exchange rates with historical data dating back to 1999
These APIs enable developers to build trading applications, financial dashboards, and investment analysis tools without the complexity of direct market data feeds.
Weather Category:
Weather APIs are essential for many applications:
- Weatherstack: Real-time, historical, and forecast weather data for millions of locations
- OpenWeatherMap: Free weather API with current data, forecasts, and historical information
- Weather API: Simple weather data with multiple output formats
Weather data integration is a common requirement for travel apps, event planning tools, and IoT applications.
How to Use Public APIs
Step 1: Browse the Repository
Visit the Public APIs GitHub repository and scroll through the README.md file. The table of contents provides quick navigation to all categories.
Step 2: Choose an API
Each API entry shows:
- Name: Click to visit the API documentation
- Description: What the API provides
- Auth: Authentication requirements
- HTTPS: Security support
- CORS: Browser compatibility
Step 3: Check Requirements
Before using an API, verify:
- Authentication: Does it require an API key?
- Rate Limits: How many requests are allowed?
- CORS: Can you call it from a browser?
Step 4: Get API Key (if needed)
For APIs requiring authentication:
- Visit the API’s website
- Sign up for an account
- Generate an API key
- Store it securely (use environment variables!)
Step 5: Make Your First Request
// Example: Using the Dog API (no auth required)
fetch('https://dog.ceo/api/breeds/image/random')
.then(response => response.json())
.then(data => console.log(data.message))
.catch(error => console.error('Error:', error));
# Example: Using Cat Facts API (no auth required)
import requests
response = requests.get('https://catfact.ninja/fact')
data = response.json()
print(data['fact'])
Featured APILayer APIs
The repository also highlights premium APIs from APILayer:
| API | Description | Use Case |
|---|---|---|
| IPstack | IP geolocation | User location detection |
| Marketstack | Stock market data | Financial applications |
| Weatherstack | Weather information | Weather apps |
| Numverify | Phone validation | User verification |
| Fixer | Exchange rates | Currency conversion |
| Aviationstack | Flight data | Travel applications |
| Zenserp | Search results | SEO tools |
| Screenshotlayer | Website screenshots | Documentation |
Understanding API Integration Patterns
The diagram above illustrates the typical flow when integrating third-party APIs into your application. Let’s examine each component and the best practices for each stage:
1. API Discovery Phase:
The discovery phase is where the Public APIs repository shines. Instead of spending hours searching for APIs through search engines, developers can browse categorized lists with clear descriptions. Key considerations during discovery:
- Authentication Requirements: APIs marked with
apiKeyrequire registration, while those markedNocan be used immediately - HTTPS Support: Always prefer HTTPS-enabled APIs for production applications to ensure data security
- CORS Support: If building a browser-based application, CORS support is essential for direct API calls
2. Authentication Setup:
For APIs requiring authentication, the typical process involves:
// Store API keys securely using environment variables
const API_KEY = process.env.WEATHER_API_KEY;
// Never hardcode API keys in your source code
// BAD: const apiKey = "sk-1234567890";
// GOOD: const apiKey = process.env.API_KEY;
Modern authentication methods include:
- API Keys: Simple token-based authentication, passed in headers or query parameters
- OAuth 2.0: Delegated authorization for accessing user data
- JWT Tokens: Stateless authentication for microservices
3. Request Construction:
Building proper API requests requires attention to:
// Example of a well-structured API request
const requestOptions = {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
params: {
units: 'metric',
lang: 'en'
}
};
fetch('https://api.example.com/data', requestOptions)
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(data => processData(data))
.catch(error => handleError(error));
4. Response Handling:
Proper response handling includes:
- Status Code Validation: Check HTTP status codes (200, 400, 401, 403, 404, 500)
- Data Validation: Verify response structure matches expectations
- Error Handling: Graceful degradation when API fails
- Rate Limit Management: Respect API rate limits and implement backoff strategies
5. Data Integration:
The final step involves integrating API data into your application:
- Caching: Store frequently accessed data to reduce API calls
- Transformation: Convert API responses to your application’s data models
- State Management: Update application state with new data
- UI Updates: Reflect data changes in the user interface
Best Practices for Using Public APIs
1. Always Use HTTPS
Never use APIs over plain HTTP in production. HTTPS ensures:
- Data encryption in transit
- Protection against man-in-the-middle attacks
- Compliance with security standards
2. Handle Rate Limits
Most APIs have rate limits. Implement:
- Exponential backoff: Wait longer between retries
- Request queuing: Space out requests evenly
- Caching: Store responses to reduce API calls
// Example: Implementing exponential backoff
async function fetchWithRetry(url, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
const response = await fetch(url);
if (response.ok) return response;
if (response.status === 429) {
// Rate limited - wait and retry
const waitTime = Math.pow(2, i) * 1000;
await new Promise(resolve => setTimeout(resolve, waitTime));
continue;
}
throw new Error(`HTTP ${response.status}`);
} catch (error) {
if (i === maxRetries - 1) throw error;
}
}
}
3. Secure Your API Keys
Never expose API keys in client-side code:
- Use environment variables
- Proxy requests through your backend
- Rotate keys regularly
- Use API key restrictions when available
4. Implement Error Handling
APIs can fail. Always handle:
- Network errors
- Invalid responses
- Rate limit errors (429)
- Server errors (500)
- Authentication errors (401, 403)
5. Cache Responses
Reduce API calls by caching:
- Use browser localStorage for client-side caching
- Implement server-side caching with Redis
- Set appropriate cache expiration times
- Consider stale-while-revalidate patterns
Popular APIs for Beginners
If you’re new to API development, start with these no-auth-required APIs:
| API | Endpoint | What it Returns |
|---|---|---|
| Random Dog | https://dog.ceo/api/breeds/image/random | Random dog image URL |
| Random Fox | https://randomfox.ca/floof/ | Random fox image URL |
| Cat Fact | https://catfact.ninja/fact | Random cat fact |
| Official Joke | https://official-joke-api.appspot.com/random_joke | Random joke |
| Kanye Rest | https://api.kanye.rest | Random Kanye quote |
| Bored API | https://www.boredapi.com/api/activity | Random activity suggestion |
| Agify | https://api.agify.io?name=michael | Predict age from name |
| Genderize | https://api.genderize.io?name=peter | Predict gender from name |
| Nationalize | https://api.nationalize.io?name=john | Predict nationality from name |
Contributing to Public APIs
The repository welcomes contributions! To add a new API:
- Fork the repository
- Add your API to the appropriate category
- Follow the table format:
| [Name](link) | Description | Auth | HTTPS | CORS | - Submit a pull request
Guidelines:
- APIs must be free to use (freemium is acceptable)
- Include accurate authentication information
- Test the API before submitting
- Keep descriptions concise
Why Public APIs Matters
For Learning
Public APIs provides an excellent learning resource:
- No setup required: Many APIs work without authentication
- Real-world practice: Learn with actual production APIs
- Variety: Explore different API styles and data formats
- Free: No cost to experiment and learn
For Prototyping
When building MVPs and prototypes:
- Speed: Find APIs quickly without research
- Free tier: Most APIs offer free usage tiers
- Reliability: Community-vetted APIs are more likely to work
- Documentation: Links to official docs save time
For Production
Many APIs are production-ready:
- SLA guarantees: Premium tiers often include SLAs
- Scalability: APIs handle infrastructure for you
- Updates: Maintained APIs receive regular updates
- Support: Commercial APIs offer support channels
Troubleshooting Common Issues
CORS Errors
Problem: Browser blocks API requests due to CORS policy
Solutions:
- Use a CORS proxy (for development only)
- Make requests from your backend
- Find an API with CORS enabled
- Use JSONP if supported
// Using a CORS proxy (development only!)
const proxyUrl = 'https://cors-anywhere.herokuapp.com/';
const apiUrl = 'https://api.example.com/data';
fetch(proxyUrl + apiUrl)
.then(response => response.json())
.then(data => console.log(data));
Rate Limiting
Problem: API returns 429 (Too Many Requests)
Solutions:
- Implement request throttling
- Cache responses
- Upgrade to paid tier
- Use multiple API keys (if allowed)
Authentication Failures
Problem: API returns 401 or 403 errors
Solutions:
- Verify API key is correct
- Check authentication method (Bearer, API key header, query param)
- Ensure key has required permissions
- Check if key is expired
Slow Response Times
Problem: API responses are slow
Solutions:
- Use pagination for large datasets
- Request only needed fields
- Implement client-side caching
- Consider using a CDN for static data
Conclusion
The Public APIs repository is an invaluable resource for developers at all skill levels. Whether you’re learning API integration, building a prototype, or developing a production application, this curated collection saves time and provides reliable, tested APIs.
With over 1,400 APIs across 50+ categories, you’re likely to find exactly what you need. The community-driven nature ensures quality and relevance, while the standardized format makes discovery effortless.
Key Takeaways:
- Start with no-auth APIs for learning
- Always secure your API keys
- Implement proper error handling
- Respect rate limits
- Contribute back to the community
Resources
Related Posts
Enjoyed this post? Never miss out on future posts by following us