💬 qa

What Is an API in Plain English?

Common questions about APIs answered in plain language — what they do, how they work, why they matter, and how they power every app you use.

What Is an API in Plain English?

APIs power every app you use — from weather forecasts to payment processing. But what exactly is an API? Here are common questions answered in plain language.


What does API stand for?


API stands for Application Programming Interface.


Break it down:

  • **Application** = A piece of software (an app, a website, a service)
  • **Programming** = Code talking to code (not humans using a mouse)
  • **Interface** = The rules and methods for how two things communicate

  • An API is how one piece of software asks another piece of software to do something. It's a contract: "If you send me this request in this format, I'll send you back this response."


    What does an API actually do?


    An API lets software communicate with other software without needing to know how it works internally.


    Real-world analogy:


    Think of a restaurant. You (the customer) don't walk into the kitchen and start cooking. You tell the waiter what you want from the menu. The waiter takes your order to the kitchen, the kitchen prepares it, and the waiter brings it back to you.


    In this analogy:

  • **You** = Your app or code
  • **The waiter** = The API
  • **The kitchen** = The server or service doing the work
  • **The menu** = The API documentation (what you can request)

  • You don't need to know how the kitchen works. You just use the interface (the waiter/menu) to get what you need.


    Want to see how APIs fit into web requests? Check out The Journey of a URL.


    How do web APIs work?


    Most APIs you encounter are web APIs (also called HTTP APIs or REST APIs). Here's the flow:


  • **Your app sends a request** to a specific URL (called an **endpoint**), like `https://api.weather.com/forecast`
  • **The request includes**:
  • - The HTTP method (GET to fetch data, POST to send data, etc.)

    - Headers (metadata like authentication tokens)

    - Sometimes a body with data you're sending

  • **The server receives the request**, processes it, and does whatever it needs to do (fetch data from a database, perform calculations, etc.)
  • **The server sends back a response**, usually containing:
  • - A status code (200 = success, 404 = not found, etc.)

    - Data in a structured format, typically JSON


    Example API request:


    GET https://api.weather.com/forecast?city=Seattle

    Authorization: Bearer YOUR_API_KEY


    Example response:


    {

    "city": "Seattle",

    "temperature": 58,

    "condition": "Cloudy",

    "forecast": "Rain likely"

    }


    Your app receives this JSON, parses it, and displays it to the user: "Seattle is 58° and cloudy."


    Dive deeper: What Is an API? — interactive lesson on how APIs work.


    What is JSON and why do APIs use it?


    JSON (JavaScript Object Notation) is a lightweight text format for structuring data. Despite the name, every programming language can read and write JSON.


    Why APIs love JSON:


  • **Human-readable**: You can look at JSON and understand it
  • **Structured**: Clear hierarchy with keys and values
  • **Compact**: Less verbose than older formats like XML
  • **Universal**: Every language has JSON parsers

  • JSON example:


    {

    "user": {

    "name": "Alice",

    "email": "alice@example.com",

    "active": true

    },

    "posts": [

    {"title": "Hello World", "likes": 42},

    {"title": "Learning APIs", "likes": 137}

    ]

    }


    Keys are strings in double quotes. Values can be strings, numbers, booleans, objects (curly braces), or arrays (square brackets).


    Learn more: What Is JSON? — the universal language of APIs.


    Why do APIs matter?


    APIs enable reusability and specialization. Without APIs, every app would need to build everything from scratch.


    Examples of what APIs let you do:


  • **Google Maps API**: Embed interactive maps in your app without building a mapping service
  • **Stripe API**: Accept payments without building payment infrastructure
  • **OpenWeather API**: Show weather forecasts without running weather stations
  • **Twitter API**: Post tweets or read timelines programmatically
  • **Twilio API**: Send SMS messages without negotiating with telecom carriers

  • APIs let companies focus on their core product while leveraging external services for the rest. They're the building blocks of modern software.


    What's an API key and why do I need one?


    An API key is a secret token that proves you have permission to use an API.


    Why APIs require keys:


  • **Authentication**: The service knows who you are
  • **Usage tracking**: The service can count how many requests you make
  • **Rate limiting**: Prevents one user from overloading the service
  • **Billing**: Many APIs charge based on usage

  • How it works:


    When you sign up for an API, the provider gives you a unique key. You include it in every request:


    GET https://api.example.com/data

    Authorization: Bearer your_api_key_here


    Without the key, the API refuses your request (usually with a 401 Unauthorized response).


    Security warning:


    API keys are secrets. Never commit them to public code repositories. Use environment variables instead.


    Related: Environment Variables Explained — keeping secrets out of code.


    What's the difference between public and private APIs?


    Public APIs (also called open APIs or external APIs):


  • Available to anyone (often with registration)
  • Intended for third-party developers
  • Usually have public documentation
  • Examples: Twitter API, GitHub API, Stripe API

  • Private APIs (also called internal APIs):


  • Only used within a company or organization
  • Not exposed to the public internet
  • Power internal tools and services
  • Example: Your company's backend API that the frontend calls

  • Partner APIs:


  • Shared with specific partners under agreements
  • Require special credentials
  • Somewhere between public and private

  • Most APIs you hear about are public. Most APIs that exist are private (companies build internal APIs constantly).


    Can I use any API for free?


    It depends. APIs have different pricing models:


    Free tiers:


    Many APIs offer free usage up to a limit. Examples:

  • OpenWeather: 1,000 requests/day free
  • GitHub: 5,000 requests/hour (authenticated)
  • Google Maps: $200/month credit (covers ~28,000 map loads)

  • Paid tiers:


    Once you exceed free limits, you pay per request, per user, or via subscription. Pricing varies wildly:

  • Some APIs: fractions of a cent per request
  • Others: hundreds of dollars per month

  • Fully free APIs:


    Some APIs are entirely free with no limits:

  • REST Countries (country data)
  • Dog CEO (random dog pictures)
  • Public government APIs (weather, census data)

  • Before integrating:


    Check the API's pricing page. Free tiers can disappear or change. Budget for scaling — 100 requests a day becomes expensive at 10,000,000 requests a day.


    What happens when I exceed rate limits?


    Most APIs enforce rate limits — caps on how many requests you can make in a time window (e.g., 1,000 requests per hour).


    When you exceed the limit:


    The API returns a 429 Too Many Requests status code. Your request is rejected. You must wait until the rate limit window resets.


    Why rate limits exist:


  • **Cost control**: Compute and bandwidth cost money
  • **Fair access**: Prevents one user from monopolizing resources
  • **DDoS protection**: Stops abuse and attacks

  • How to handle rate limits:


    Most APIs include rate limit info in response headers:


    X-RateLimit-Limit: 1000

    X-RateLimit-Remaining: 237

    X-RateLimit-Reset: 1630000000


    Good clients:

  • Check these headers
  • Back off when limits are approaching
  • Implement exponential backoff on 429 errors

  • Learn more: Rate Limiting Explained — why APIs throttle requests.


    What's the difference between REST and GraphQL?


    REST (Representational State Transfer):


    The traditional API architecture. Each endpoint represents a resource:


    GET /users/123 → Get user data

    GET /users/123/posts → Get user's posts

    POST /posts → Create a new post


    You get what the endpoint returns — no customization. Need more data? Make more requests.


    GraphQL:


    A query language for APIs. You describe exactly what data you want in one request:


    {

    user(id: 123) {

    name

    posts {

    title

    likes

    }

    }

    }


    The server returns only the fields you requested. One request can fetch data from multiple resources.


    Trade-offs:


    REST is simpler and more cacheable. GraphQL reduces round trips and gives clients flexibility. Many modern APIs offer both.


    How do I find an API's documentation?


    API documentation (often just called "docs") explains:


  • What endpoints exist
  • What data each endpoint expects
  • What responses look like
  • Authentication requirements
  • Rate limits and pricing

  • Where to look:


  • **Company website**: Usually under `/docs` or `/developers`
  • - https://stripe.com/docs/api

    - https://docs.github.com

  • **API marketplaces**: RapidAPI, API List, ProgrammableWeb
  • **OpenAPI specs**: Machine-readable documentation (Swagger)

  • Good docs include:


  • Quickstart guides
  • Code examples in multiple languages
  • Interactive API explorers (try requests in the browser)
  • Error code explanations

  • Poor docs are vague, outdated, or incomplete. If the docs are bad, the API is probably bad too.


    What is REST?


    REST stands for Representational State Transfer — a set of architectural principles for designing web APIs.


    Key REST principles:


  • **Resources are nouns**: Endpoints represent things (`/users`, `/posts`, not `/getUser`)
  • **HTTP methods indicate actions**:
  • - GET = Read

    - POST = Create

    - PUT/PATCH = Update

    - DELETE = Delete

  • **Stateless**: Each request is independent — the server doesn't remember previous requests
  • **Standard status codes**: `200 OK`, `404 Not Found`, `500 Internal Server Error`

  • RESTful API example:


    GET /users → List all users

    GET /users/42 → Get user 42

    POST /users → Create a new user

    PUT /users/42 → Update user 42

    DELETE /users/42 → Delete user 42


    REST isn't a strict standard — it's a style. Most modern web APIs are "REST-ish" but don't follow every principle religiously.


    Related: HTTP Status Codes Decoded — understanding response codes.


    Are APIs secure?


    APIs can be secure or insecure — it depends on how they're built and used.


    Common security measures:


  • **HTTPS**: Encrypts data in transit (API keys, request bodies, responses)
  • **Authentication**: API keys, OAuth tokens, JWT (JSON Web Tokens)
  • **Rate limiting**: Prevents abuse and DDoS attacks
  • **Input validation**: Rejects malformed or malicious requests
  • **Authorization**: Checks if you're allowed to access specific resources

  • Common vulnerabilities:


  • **Exposed API keys**: Keys committed to public repos get scraped and abused
  • **Weak authentication**: No auth or easily guessable keys
  • **Lack of rate limiting**: API can be overwhelmed
  • **Injection attacks**: Unsanitized input leads to SQL injection or XSS
  • **Insecure endpoints**: APIs returning sensitive data without proper authorization

  • Best practices:


  • Always use HTTPS (never plain HTTP)
  • Rotate API keys regularly
  • Use environment variables for secrets
  • Validate and sanitize all inputs
  • Implement proper authentication and authorization
  • Monitor usage for suspicious patterns

  • Security reading: What That Padlock Really Means — HTTPS encryption basics.


    How do I start using an API?


    Step-by-step:


  • **Find an API** that does what you need (weather, payments, maps, etc.)
  • **Read the docs** — understand endpoints, authentication, and pricing
  • **Sign up** for an account and get an API key
  • **Test requests** with a tool like Postman, Insomnia, or `curl`:

  • curl -H "Authorization: Bearer YOUR_API_KEY" \

    https://api.example.com/data


  • **Integrate into your code**:

  • const response = await fetch('https://api.example.com/data', {

    headers: {

    'Authorization': 'Bearer YOUR_API_KEY'

    }

    });

    const data = await response.json();

    console.log(data);


  • **Handle errors** (rate limits, timeouts, invalid responses)
  • **Monitor usage** to avoid surprise bills

  • Start simple: Try a free, public API first. Experiment, break things, and learn how requests and responses work.


    Quick Reference


    | Term | What it means |

    |------|---------------|

    | API | Application Programming Interface — how software talks to software |

    | Endpoint | A specific URL where an API accepts requests (e.g., /users) |

    | REST | Architectural style for web APIs using HTTP methods and resources |

    | JSON | Lightweight data format APIs use to send structured data |

    | API key | Secret token proving you have permission to use an API |

    | Rate limit | Maximum number of requests allowed in a time window |

    | HTTP methods | GET (read), POST (create), PUT (update), DELETE (remove) |

    | Status code | Three-digit response code (200 = success, 404 = not found) |




    The Takeaway:


    APIs are contracts that let software communicate. They power every app by enabling reusability — instead of building everything from scratch, you integrate with services via their APIs. Whether fetching weather data, processing payments, or sending emails, APIs are the glue that makes modern software work.


    Understanding APIs means understanding how the digital world connects.




    Related Reading:


  • [What Is an API?](/bits/what-is-an-api) — interactive lesson with a quiz
  • [What Is JSON?](/bits/what-is-json) — the data format APIs speak
  • [The Journey of a URL](/bits/url-journey) — see how requests travel from browser to server
  • [HTTP Status Codes Decoded](/bits/http-status-codes) — understanding 2xx, 3xx, 4xx, 5xx
  • [Environment Variables Explained](/bits/env-vars) — keeping API keys secure
  • [Rate Limiting Explained](/bits/rate-limiting) — why APIs throttle requests



  • *This post is part of Hacking Bits, where we explain how everyday technology works — one bit at a time.*


    Related Posts