How APIs Actually Work
Past curl and Postman to what is really happening on the wire.
You use APIs every day but the under-the-hood picture stays fuzzy: what an endpoint really is, where the front-end/back-end line sits, and how it all gets secured. This pathway walks from the core concept, to how an endpoint is exposed and protected, to seeing it live in your terminal.
You can already call an API — what's missing is the model underneath. This route follows one thing, a request, from what it fundamentally is, through how it travels and gets secured, to watching it happen in your own terminal. Ten lessons across three sites, in order; each stands alone, but together they close the loop.
10 steps live · 3 sites
What you'll be able to do
- →Explain what an API really is — a contract, not code — and where the front-end/back-end line actually falls.
- →Trace a request end to end: DNS, ports, TLS termination, the gateway, and the handler that answers.
- →Reason about API security the way production does: tokens, the authentication/authorization split, and mTLS as the default.
- →Inspect real traffic with
curl -vand the browser network tab — and read what you find.
Start with the contract
What an API Actually Is
Computer Science · EssentialsAn API is a contract, not a tool. Start here and the rest follows.
An API is a contract between two roles, client and server — not a specific tool, protocol, or format. Once you see it as a promise about addresses and shapes rather than code, questions like 'what should I expose' and 'how do I secure it' start answering themselves.
Client and Server: The Request/Response Lifecycle
Computer Science · EfficiencyTrace one request end to end and the front/back-end fog lifts.
Client and server are roles, not fixed identities — your backend becomes a client the moment it calls another service. Tracing one request end to end, naming who initiates and who responds at each hop, is what actually clears up the front-end/back-end confusion.
Follow a request
From URL to Endpoint: How an API Gets Exposed
Networking · EssentialsWhat "expose an endpoint" really means: DNS, ports, and binding.
'Expose an endpoint' hides four real stages: DNS resolving a name to an address, a port acting as the door, a bind decision (localhost vs. the world), and a path routing to the code that answers. Each stage fails differently, so knowing which one broke turns a vague symptom into a specific fix.
Why HTTP APIs Forget You: Statelessness
Computer Science · EfficiencyWhy every request re-introduces itself — and where state lives.
HTTP servers are deliberately stateless, which is what lets any server handle any request and the web scale horizontally. The cost is that identity has to be re-proven on every single call — the entire reason sessions, cookies, and tokens exist.
Anatomy of an HTTP Request and Response
Computer Science · EfficiencyMethods, status codes, headers, body — the contract in detail.
Every HTTP message reduces to four parts with fixed jobs: a method (the verb), a path (the noun), headers (metadata), and a body (payload) — answered by a status code, more headers, and a payload. Learn the four slots and "design an endpoint" stops being a mystery.
Seeing API Traffic: curl -v and the Network Tab
Dev Tools · EssentialsWatch the anatomy you just learned on real, live traffic.
curl -v and the browser Network tab expose the exact anatomy from the last step on real, live traffic — handshakes, headers, redirects, and preflights you have been trusting on faith. Reading the whole conversation, not just the response body, turns "the API is being weird" into a specific fact.
Expose it safely
Authentication vs Authorization in APIs
Computer Science · EfficiencyWho you are vs what you may do — and where each check happens.
Authentication answers "who are you"; authorization answers "what may you do" — two separate checks that belong in different places, since identity can be offloaded to a gateway but permission checks belong in the service that owns the resource. Conflating them is the root cause behind most broken-access-control vulnerabilities.
HTTPS for APIs: Where the Connection Gets Secured
Networking · EssentialsTLS termination: where encryption actually stops in production.
"Put it behind HTTPS" is the start of securing an API in transit, not the end — the real question is where the lock comes off and what protects every hop after it. The current standard answer is mTLS on every leg, not "trust the internal network."
Reverse Proxies and API Gateways
Networking · EfficiencyThe front door that owns the public address and guards your services.
In production your backends are not directly exposed — a single reverse proxy or API gateway owns the public address, terminates TLS, routes by path, and authenticates callers before traffic ever reaches your code. "Is this endpoint exposed?" becomes a question about the gateway config, not your service.
CORS Explained: The Front-End/Back-End Border
Networking · EfficiencyThe browser rule that makes APIs "work in curl but not the app."
CORS is not the browser being difficult — it is the browser protecting your users by refusing, by default, to let an arbitrary site spend their credentials against your API without permission. The fix for a CORS error is always a specific server-side header, never a client-side workaround.
Go deeper
API Design Principles: REST, Idempotency, Versioning
coming soonComputer Science · MasteryThe decisions you cannot take back once clients depend on you.
REST conventions, idempotency guarantees, and a versioning strategy are the decisions you cannot unmake once real clients depend on your contract. Reserved for the paid Mastery tier — coming soon.