What is an API? Learn it in 10 minutes.

An API (Application Programming Interface) is a way for one program to ask another program for data or actions.

Think of it like ordering food in a restaurant

πŸ™‹Youare the app or website asking for something.
🀡The waiteris the API request.
πŸ‘©β€πŸ³The kitchenis the server that does the work.
🍝Your mealis the response data (usually JSON).

How APIs work

1You send a request to an API endpoint (URL).
2You choose a method, usually GET.
3The server processes your request.
4The server sends back a response, often in JSON format.

FreePublicAPIs helps beginners by collecting free APIs in one place and testing them daily, so you can spend more time learning and less time debugging dead links.

Lesson 1JavaScript Β· 5 min

Your first API call with JavaScript

Goal: make your first real API request and print results in the console.

GEThttps://freepublicapis.com/api/random
main.js
async function getRandomApi() {
  const response = await fetch("https://freepublicapis.com/api/random");

  if (!response.ok) {
    throw new Error("Request failed");
  }

  const api = await response.json();
  console.log("Title:", api.title);
  console.log("Description:", api.description);
  console.log("Documentation:", api.documentation);
}

getRandomApi();
πŸ†Beginner challenge: print only APIs that include a GET method in api.methods.
Lesson 2JavaScript Β· 10 min

Build a tiny API explorer

Goal: fetch multiple APIs and show a simple ranked list.

GEThttps://freepublicapis.com/api/apis?sort=best&limit=5
main.js
async function listBestApis() {
  const response = await fetch(
    "https://freepublicapis.com/api/apis?sort=best&limit=5"
  );

  if (!response.ok) {
    throw new Error("Request failed");
  }

  const apis = await response.json();

  apis.forEach((api, index) => {
    console.log(`${index + 1}. ${api.title}`);
    console.log(`   Docs: ${api.documentation}`);
    console.log(`   Health: ${api.health}`);
  });
}

listBestApis();
πŸ†Beginner challenge: render this list in HTML as clickable links.