What Is an API? A Plain-English Guide for New Developers
APIs power every app you use, and every developer job expects you to know them. What an API really is, how REST works, and how to call one in ten lines.
"API" might be the most-used, least-explained term in programming. Job postings demand experience with them, tutorials assume you know what they are, and definitions like "Application Programming Interface" explain exactly nothing. Meanwhile, you used dozens of APIs today without noticing: checking the weather, logging in with Google, paying for anything online.
This guide explains what an API actually is, how the web's most common kind works, and gets you calling a real one in about ten lines of code.
The restaurant analogy (it's popular because it works)
You sit down in a restaurant. You don't walk into the kitchen, find ingredients, and cook; you give an order to a waiter, who takes it to the kitchen and brings back your food. You don't need to know how the kitchen works; you just need to know how to order from the menu.
An API is the waiter. It's a structured way for one program to request things from another program without needing to know anything about that program's internals:
- Your weather app doesn't own weather satellites; it asks a weather service's API for "current conditions in Tokyo" and gets back structured data.
- "Log in with Google" doesn't mean the app has your Google password; it asks Google's API to verify you.
- An online store doesn't process your card; it sends payment details to Stripe's API and gets back "approved" or "declined."
The menu matters too: every API publishes documentation listing exactly what you can ask for and what you'll get back. Learning to read API docs is learning to read menus, and it's a core professional skill.
What an API request actually looks like
The most common kind of API on the web is a REST API, which works over the same protocol (HTTP) as your browser. Four pieces:
1. A URL identifying the thing you want, called an endpoint:
https://api.github.com/users/torvalds
2. A method saying what to do with it:
| Method | Meaning | Everyday analogy |
|---|---|---|
GET | Read data | Look at something |
POST | Create something new | Submit a form |
PUT/PATCH | Update something | Edit a saved draft |
DELETE | Remove something | Throw it away |
3. A response with a status code:
200: success, here's your data201: created, your POST worked404: that thing doesn't exist401/403: you're not allowed (missing or insufficient credentials)500: the server itself broke
4. Data, almost always as JSON: JavaScript Object Notation, the universal data format of the web:
{
"login": "torvalds",
"name": "Linus Torvalds",
"public_repos": 8,
"followers": 240000
}
JSON is just nested keys and values; if you understand objects and arrays in any language, you already read JSON.
Call a real API right now
Here's a complete, working API call in JavaScript; you can paste it into any browser console:
async function getGitHubUser(username) {
const response = await fetch(`https://api.github.com/users/${username}`);
if (!response.ok) {
throw new Error(`GitHub responded with ${response.status}`);
}
const user = await response.json();
console.log(`${user.name} has ${user.followers} followers`);
}
getGitHubUser("torvalds");
That's genuinely it. You just did what professional developers do all day: send a request, check it succeeded, parse the JSON, use the data. The async/await parts are their own topic (we cover them in depth in Async JavaScript Explained), but the API concept is exactly this simple.
The same request works from Python (requests.get(...)), from a phone app, from another server; that's the point of APIs: any program that speaks HTTP can use them, regardless of language.
API keys: why most APIs make you sign up
GitHub's public API works without credentials, but most APIs require an API key, a long random string identifying who's asking:
const response = await fetch("https://api.example.com/data", {
headers: { Authorization: `Bearer ${apiKey}` },
});
Keys exist so providers can enforce rate limits (you get N requests per minute), bill usage, and revoke abusers. Two rules every beginner should tattoo somewhere visible:
- API keys are passwords. Never paste them into shared code, screenshots, or public repositories.
- Never commit keys to Git. Put them in a
.envfile that's listed in.gitignore. A key pushed to a public GitHub repo will be found by scanners within minutes, and if it ever happens, revoke and rotate the key immediately; deleting the file afterward doesn't remove it from Git history.
The two sides of the API world
Everything above is consuming APIs: using someone else's kitchen. The other half of the skill is building them: writing the server that receives GET /users/42 and responds with the right JSON. That's backend development in a nutshell (routing, validation, databases, authentication), and it's a natural next step once calling APIs feels comfortable. Our guide to building a REST API with Node.js walks through it end to end.
Frontend developer, backend developer, data scientist, mobile developer: every single one works with APIs weekly. It's arguably the most universally required practical skill in software.
Where to go from here
- Play with free public APIs. GitHub's API, weather APIs, or one of the many "fun" APIs (there are public APIs for everything from space launches to dog photos). No better way to make HTTP concrete.
- Build a tiny app around one. A weather widget, a "random advice" button, a crypto price ticker. Fetching + displaying real external data is the classic first real project, and it teaches error handling the honest way, because networks fail.
- Learn the underlying JavaScript properly.
fetch, promises, JSON, and error handling are all core language skills; they're covered interactively, with an AI tutor on standby, in our JavaScript Fundamentals course.
The next time documentation says "just call the API," it won't be jargon; it'll be a menu you know how to order from.
Kodion Team
Kodion Editorial
Written by the team that builds Kodion's courses: working engineers who test every example in the interactive editor before it ships. How we create and review content
Continue Learning
📚 Related Articles
Build Your First REST API: A Beginner's Roadmap
Design and build a working REST API in Python with FastAPI: endpoints, Pydantic models, status codes, and curl tests, explained step by step.
Building a REST API with Node.js and Express
Step-by-step tutorial to build a production-ready REST API. Learn routing, middleware, error handling, and best practices with Node.js and Express.