What is an API?
You've probably heard the term dozens of times. Let's make it click.
The Restaurant Analogy
Imagine you're at a restaurant. You don't walk into the kitchen and cook your own food — instead, you tell the waiter what you want, the waiter takes your order to the kitchen, and comes back with your meal.
An API is the waiter. It's a messenger that takes your request, delivers it to a system that knows how to fulfill it, and brings back the response.
API stands for
Application Programming Interface — it's the defined way two pieces of software talk to each other.
Real-World Examples You Already Use
APIs are everywhere. Every time you:
- Check the weather in an app — the app calls a weather API to get forecast data
- Log in with Google — the site uses Google's API to authenticate you
- See a Google Map embedded in a website — that's Google Maps API
- Pay with Stripe — the checkout calls Stripe's payment API
- Tweet from a third-party app — that app calls Twitter/X's API
APIs let developers build on top of existing services without reinventing the wheel. Instead of building your own payment system, you call Stripe's API. Instead of building your own maps, you call Google's.
Web APIs Specifically
There are different kinds of APIs (operating system APIs, library APIs, etc.), but when developers say "API" today, they almost always mean a web API — one that you talk to over the internet using HTTP.
You send a request to a URL (called an endpoint), and you get back a response — usually containing data in a format called JSON.
// Example: asking for a list of users
→ Request
GET https://joncagle.com/api/training/users
← Response
{
"data": [
{ "id": 1, "name": "Alice Johnson", "email": "[email protected]" },
{ "id": 2, "name": "Bob Martinez", "email": "[email protected]" }
],
"meta": { "total": 10, "limit": 10, "offset": 0 }
}Why Does This Matter for Developers?
If you ever want to build something useful — a website, a mobile app, an automation, a data project — you will almost certainly need to consume or create an API. Learning to read, use, and build APIs is one of the highest leverage skills in modern development.
Connect services
Combine Stripe + Twilio + OpenAI to build powerful products fast
Get data
Pull live data from any service that has a public API
Automate tasks
Script API calls to automate repetitive work
Build backends
Your own app can expose an API for others to use
Try It Right Now
This course has a live training API running at /api/training/. Open a new browser tab and paste this URL to make your very first API call:
Your browser will send a GET request to that URL and display the JSON response. Congratulations — you just called an API!
Key Terms to Know
- API
- The contract/interface between two pieces of software
- Endpoint
- A specific URL that accepts API requests (e.g. /api/training/users)
- Request
- What you send to the API — your question or instruction
- Response
- What the API sends back — the answer or result
- JSON
- JavaScript Object Notation — the most common data format for APIs
- REST
- A style of designing APIs using standard HTTP — the most common kind