Skip to content
Fox photography representing the Public APIs section

Public APIs

Public APIs for Developers

A starting point for anyone looking for real data to build with: how to evaluate a public API, and five that are well documented and easy to call from the browser.

  • 5 APIs covered
  • Sample requests
  • Limits documented

The APIs covered on this page

Endpoints, free tiers and rate limits change. Everything here reflects the published documentation at the time of writing - always confirm on the provider's own docs before you depend on it in production.

JSONPlaceholder

Documentation

Fake REST data for prototypes, tutorials and UI testing.

Authentication
None
Pricing
Free
Endpoint
GET /posts/1

Example request

curl https://jsonplaceholder.typicode.com/posts/1

Example response

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident",
  "body": "quia et suscipit suscipit recusandae..."
}

Good for

  • Wiring up a fetch call before a real backend exists
  • Teaching material
  • Testing loading and error states

Limitations

  • Data is fictional
  • Write requests are simulated and never persist
  • No guarantees of uptime

REST Countries

Documentation

Country data: names, capitals, currencies, languages, flags, borders.

Authentication
None
Pricing
Free
Endpoint
GET /name/{country}

Example request

curl "https://restcountries.com/v3.1/name/pakistan?fields=name,capital,currencies"

Example response

[
  {
    "name": { "common": "Pakistan", "official": "Islamic Republic of Pakistan" },
    "capital": ["Islamabad"],
    "currencies": { "PKR": { "name": "Pakistani rupee", "symbol": "Rs" } }
  }
]

Good for

  • Country pickers and phone code inputs
  • Flags and locale data
  • Geography quiz apps

Limitations

  • Full records are large - use the fields parameter
  • Community maintained, so data can lag
  • No historical data

Open-Meteo

Documentation

Weather forecasts and historical weather without an API key.

Authentication
None for the documented free tier
Pricing
Free for non-commercial use; paid plans for commercial volume
Endpoint
GET /forecast

Example request

curl "https://api.open-meteo.com/v1/forecast?latitude=24.86&longitude=67.01&current=temperature_2m"

Example response

{
  "latitude": 24.875,
  "longitude": 67.0,
  "current": { "time": "2026-09-13T09:00", "temperature_2m": 31.4 }
}

Good for

  • Weather widgets
  • Travel and outdoor planning tools
  • Climate data projects

Limitations

  • Fair-use limits apply
  • Commercial use requires a paid plan
  • Needs coordinates - pair it with a geocoding call

Frankfurter

Documentation

Exchange rates published by the European Central Bank.

Authentication
None
Pricing
Free, open source
Endpoint
GET /latest

Example request

curl "https://api.frankfurter.app/latest?from=EUR&to=USD,GBP"

Example response

{
  "amount": 1.0,
  "base": "EUR",
  "date": "2026-09-12",
  "rates": { "USD": 1.0842, "GBP": 0.8531 }
}

Good for

  • Price display in multiple currencies
  • Simple conversion tools
  • Historical rate charts

Limitations

  • ECB reference rates only, updated once per working day
  • No weekend or holiday updates
  • Not suitable for trading

Open Library

Documentation

Book metadata, covers and author information.

Authentication
None for read endpoints
Pricing
Free
Endpoint
GET /search.json

Example request

curl "https://openlibrary.org/search.json?q=the+pragmatic+programmer&limit=1"

Example response

{
  "numFound": 12,
  "docs": [
    { "title": "The Pragmatic Programmer", "author_name": ["Andrew Hunt"], "first_publish_year": 1999 }
  ]
}

Good for

  • Reading list apps
  • Library and catalogue tools
  • ISBN lookup

Limitations

  • Crowd-sourced records vary in quality
  • Rate limiting is applied to heavy use
  • Cover images are not available for every edition

How to choose a public API you will not regret

Finding an API that returns the data you want is the easy part. Choosing one you can still depend on in six months takes a few more minutes and saves a great deal of rework.

What "public API" actually means

A public API is one anyone can call without a commercial agreement. That covers a wide range: some need no credentials at all, some need a free key, and some are free up to a quota and paid beyond it. The label says nothing about reliability, and it says nothing about whether the terms will be the same next year. Several well-known "free" APIs have introduced keys or paid tiers at short notice, which is why the evaluation below matters more than the list.

The checks worth doing before you build

  1. 1Read the terms, not the marketing. Look for the rate limit, the commercial-use clause and the attribution requirement.
  2. 2Check CORS. If the API does not send the right headers, you cannot call it from browser JavaScript and will need a server or proxy.
  3. 3Find out who runs it. A government agency, a funded company and a weekend project have very different life expectancies.
  4. 4Look for a changelog or version in the URL. Versioned endpoints signal a team that plans for change.
  5. 5Send a real request before writing any code. curl or a browser tab tells you more in thirty seconds than the documentation does in ten minutes.

Authentication patterns you will meet

Common API authentication approaches
PatternHow it worksWatch out for
No authCall the URL directlyUsually the tightest rate limits
API key in query stringAppend ?key=... to the URLThe key is visible in logs and browser history
API key in headerSend an Authorization or X-API-Key headerStill must never sit in front-end code
OAuth 2.0Exchange credentials for a short-lived tokenNeeds a server component and token refresh handling

Rate limits and how to live within them

Most free tiers are generous for development and tight for production. Cache aggressively - exchange rates that update daily do not need to be fetched on every page view. Debounce anything driven by typing. Batch requests where the API supports it. And handle the 429 response properly: read the Retry-After header, back off exponentially, and show your users something sensible rather than a blank screen.

Building a thin server-side cache in front of a public API is usually a couple of hours of work and turns a fragile integration into a stable one. It also means an outage upstream degrades your app rather than breaking it.

Handling failure as a first-class case

  • Always set a timeout. A hanging request is worse than a failed one.
  • Distinguish between a network error, a 4xx you caused and a 5xx the provider caused - the fixes are different.
  • Show stale cached data with a timestamp rather than nothing at all.
  • Log failures with enough context to reproduce, but never log the key.

Where to look for more

For specific categories, the pages on free weather APIs, free currency APIs, free JSON APIs and free image APIs go into detail on endpoints, limits and the trade-offs between providers. If you are learning to consume APIs as part of a wider skill set, the Backend Developer Roadmap covers the server side of the equation.

Frequently asked questions

What is the difference between a public API and a free API?

Public means anyone can sign up and call it. Free refers to price, which may apply only up to a quota. Plenty of public APIs are free for development and paid for commercial volume.

Why does my API call work in curl but fail in the browser?

Almost always CORS. The browser blocks cross-origin requests unless the API sends permissive headers, so you need a server-side route to make the call on your behalf.

Keep going

Related resources

Hand-picked pages that pair well with this one.

Public APIs

Free JSON APIs

Sample and real JSON endpoints for prototypes, tutorials, portfolio projects and interface testing.

Open

Public APIs

Free Weather APIs

Weather data sources with free tiers, compared on keys, limits, forecast range and commercial terms.

Open

Roadmaps

Backend Developer Roadmap

From your first HTTP endpoint to services that handle data, auth, failure and load without falling over.

Open