← All lessons Stage 4 · Lesson 1
15 min

How APIs differ from web apps

Stage 4 · Lesson 1 · 15 minutes · Requires Stage 3


The one-line answer

An API is the structured door an app's front-end talks to — same HTTP underneath, but no user interface to hide behind, so authorisation flaws are bare.

The boundary: APIs are just as protected by law as websites. Calling a company's API outside its terms or your authorisation is unauthorised access. Practise on PortSwigger labs, OWASP Juice Shop, and public APIs explicitly offered for testing.


Why you should care

Most modern applications — mobile apps, single-page web apps, UPI and fintech apps, food delivery, e-commerce — are thin front-ends on top of APIs. The front-end decides what you see; the API decides what you can do. Much of today's bug bounty work, and many serious breaches, are API bugs.

Good news: you already have the skills. Everything from Stages 0–3 applies. This stage just shows you where to point them.


How it actually works

What an API is

Recall Stage 0 Lesson 7: when you watched the Network tab in devtools, the page made background requests like:

GET /api/v1/orders/50231 HTTP/2
Authorization: Bearer eyJhbGciOi...
Accept: application/json

and got back data, not a page:

{
  "id": 50231,
  "status": "delivered",
  "total": 1299,
  "address": { "city": "Chennai", "pincode": "600001" }
}

That's an API (Application Programming Interface): a set of URLs (endpoints) that accept and return structured data, meant to be used by programs rather than people. The front-end calls the API, then draws the result on screen.

REST in five ideas

Most APIs you'll meet are REST-style:

  1. Resources have URLs. /api/v1/users/1043, /api/v1/users/1043/orders.
  2. Methods say what to do (recall Stage 0 Lesson 3):
MethodUsually means
GETread
POSTcreate
PUT / PATCHreplace / update
DELETEdelete
  1. Data is JSON — the { "key": "value" } format above.
  2. Status codes carry meaning — 200 OK, 201 created, 401 not logged in, 403 not allowed, 404 not found.
  3. Each request carries its own credentials — often a token in an Authorization header (Bearer ...) rather than a cookie. You'll take tokens apart in Lesson 4 (JWT).

Why APIs expand the attack surface

  • No UI to hide things. A web page might hide the "delete user" button from normal users; the API endpoint still exists and answers whoever calls it. Hiding isn't access control (Stage 3 Lesson 4).
  • More endpoints than features. APIs often expose more than the front-end uses — extra fields, admin endpoints, old versions (/v1/ next to /v2/).
  • Several clients, one API. The web app, the Android app and the iOS app may all call the same API. If the mobile app's checks differ from the web app's, the API has to enforce the rules itself.
  • Objects everywhere. Almost every endpoint takes an ID. That makes access control (Lessons 2–3) the central API question.

Finding and reading API documentation

APIs are often described in a machine-readable specification, most commonly OpenAPI (previously called Swagger). It lists every endpoint, method, parameter and response. Look for:

  • /swagger, /swagger-ui, /api-docs, /openapi.json, /v2/api-docs (recall content discovery, Stage 2 Lesson 4),
  • public developer portals,
  • endpoints referenced in the front-end JavaScript (Stage 2 Lesson 3).

A spec is a gift to a tester: it's the map from Stage 2, already written.

Postman basics

Postman is a free app for building and sending API requests by hand — like Burp Repeater (Stage 2 Lesson 2), but designed around APIs. You can:

  • import an OpenAPI spec and get every endpoint as a ready request,
  • set headers and tokens once for a whole collection,
  • send it through Burp (set Postman's proxy to 127.0.0.1:8080) to record everything in HTTP history.

Many testers use both: Postman to explore an API comfortably, Burp to inspect and modify.


See it yourself

  1. In OWASP Juice Shop on your own machine, open devtools → Network, and click around. List five /api/ or /rest/ endpoints the front-end calls, with their methods.
  2. Send one through Burp and look at the JSON response. Which fields does the page actually show — and which does it ignore?
  3. Read PortSwigger's API testing topic (link below) and do the apprentice lab on exploiting an API endpoint using documentation.
  4. Optional: install Postman, set its proxy to Burp, and send one Juice Shop API request from Postman. Find it in Burp's HTTP history.

How attackers abuse this

Attackers skip the front-end entirely. They pull the API's endpoints from documentation, JavaScript or mobile app traffic, then call them directly: requesting other users' objects, sending extra fields, using old API versions, and hammering endpoints with no rate limits. Every lesson in this stage is one of these patterns.

The defensive fix (framing for the whole stage):

  • Every endpoint needs its own authorisation — on every request, for every object and every action. The front-end hiding something protects nothing.
  • Return only the fields the client needs — don't send the whole database row and let the front-end pick.
  • Inventory your APIs: know every endpoint and version that's live; retire old ones.
  • Protect documentation for internal APIs (or don't publish it externally).
  • Rate-limit and monitor every API (Lesson 5).

Common mistakes

  • Testing only through the UI. For APIs, the UI is just one client. Call the endpoints directly.
  • Ignoring extra response fields. Data the page doesn't display is still exposed.
  • Ignoring old versions. /v1/ often lacks fixes added to /v2/.
  • Assuming tokens make it secure. A token proves who you are, not what you're allowed to touch.
  • Testing production APIs without permission because "it's just an API".

Check yourself

  1. In your own words, what's the main difference between a web page and an API response?
  2. Why does "the button is hidden in the app" not protect an API endpoint?
  3. Where might you find a list of an API's endpoints?
Answers
  1. A web page returns HTML for people to look at; an API returns structured data (usually JSON) for programs to use. Both use HTTP.
  2. The API endpoint still exists and answers anyone who calls it. Only a server-side authorisation check on the endpoint protects it.
  3. An OpenAPI/Swagger specification (often at paths like /swagger or /openapi.json), a developer portal, the front-end JavaScript files, and traffic from mobile or web clients.

Your lab

  • PortSwigger API testing: https://portswigger.net/web-security/api-testing
  • Explore OWASP Juice Shop's API on your own machine with Postman through Burp.

Writeup: an endpoint table for Juice Shop's API — method, path, inputs, auth required, and notes — just like Stage 2 Lesson 3.


Summary in your language

தமிழில் சுருக்கம்

API என்பது app-இன் front-end பேசும் கட்டமைக்கப்பட்ட கதவு — அதே HTTP, ஆனால் மறைக்க UI இல்லை, எனவே அனுமதிப் பிழைகள் நேரடியாகத் தெரியும். REST APIs: resource-களுக்கு URL, GET/POST/PUT/DELETE முறைகள், JSON தரவு, Authorization header-இல் token. OpenAPI/Swagger ஆவணங்கள் எல்லா endpoint-களையும் பட்டியலிடுகின்றன; Postman மூலம் அவற்றை அனுப்பலாம். தீர்வு: ஒவ்வொரு endpoint-க்கும் server-இல் அனுமதிச் சரிபார்ப்பு, தேவையான fields மட்டும் அனுப்புதல், பழைய versions-ஐ நீக்குதல், rate limiting.

हिंदी में सारांश

API वह structured दरवाज़ा है जिससे app का front-end बात करता है — वही HTTP, पर छिपाने के लिए UI नहीं, इसलिए authorisation की गलतियाँ सीधे दिखती हैं। REST APIs: हर resource का URL, GET/POST/PUT/DELETE methods, JSON data, और Authorization header में token। OpenAPI/Swagger docs सारे endpoints बताते हैं; Postman से उन्हें भेजा जा सकता है। इलाज: हर endpoint पर server-side authorisation, सिर्फ़ ज़रूरी fields भेजना, पुराने versions हटाना और rate limiting।

Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.


What's next

The number one API bug is one you already know by another name: BOLA — the number one API bug