Skip to content
SparkTime, home

Guide · Technology

What Is an API? A Plain-English Explanation With Real Examples

APIs are behind every UPI payment, map pin and login-with-Google button. Here's what they are, how a request actually works, and how to call one yourself in five minutes.

6 min readBeginner

For

Students, non-technical professionals and new developers who keep hearing about APIs and want to actually understand them.

Level

Beginner

Before you start

None. Basic comfort using a browser is enough. The hands-on section uses a terminal, but you can skip it.

On this page

Key takeaways

  • An API is a defined way for one piece of software to ask another for data or an action.
  • Most web APIs work by sending an HTTP request to a URL and getting a response back, usually in JSON.
  • The request says what you want (method, URL, data). The response says what happened (status code, data).
  • API keys identify who is calling, so they must be kept secret, like a password.
  • You can call a public API right now from your browser, with no code at all.

Open a food delivery app and a lot happens in the first two seconds. Your location shows up on a map. Nearby restaurants load with ratings and delivery times. A banner shows an offer from your bank's card. When you pay, a UPI app pops up, you enter your PIN, and the order is confirmed.

That one app is talking to many separate systems: a maps provider, the restaurants' menus, a payment gateway, your bank, an SMS service for the OTP. None of them share code. They work together because each one offers an API.

The one-line definition

#

An API (Application Programming Interface) is a defined way for one piece of software to ask another piece of software for data or to do something.

The important word is defined. An API is a contract that says: if you send me a request in this exact format, I'll send you back a response in this exact format.

An everyday comparison

#

Think about a bank's ATM.

You don't walk into the vault and count out your own cash. You use a small, well-defined set of options: check balance, withdraw, change PIN. You give it specific inputs (card, PIN, amount) and get specific outputs (cash, receipt, an error message if your balance is too low).

The ATM is an interface to the bank's systems. It exposes a few safe operations and hides everything else. An API does the same thing for software.

What actually happens in an API call

#

Most APIs you'll hear about are web APIs. They use HTTP, the same protocol your browser uses to load websites. Every call has two halves: a request and a response.

The request

#

A request has four main parts:

  1. URL (endpoint): where you're sending it. https://api.example.com/v1/restaurants
  2. Method: what kind of action you want.

    • GET to read data
    • POST to create something
    • PUT or PATCH to update something
    • DELETE to remove something
  3. Headers: extra information, like who you are (an API key or token) and the format you're sending.
  4. Body: the data you're sending, for actions like creating an order. GET requests usually don't have one.

The response

#

The server replies with:

  1. Status code: a three-digit number saying how it went.
  2. Body: the data, usually in JSON.

The status codes you'll see most:

Code

Meaning

Everyday version

200 OK

It worked

"Here you go."

201 Created

Something new was made

"Your order is placed."

400 Bad Request

Your request was wrong

"I don't understand what you sent."

401 Unauthorized

You aren't logged in or your key is missing

"Who are you?"

403 Forbidden

You're known but not allowed

"You can't do that."

404 Not Found

That thing doesn't exist

"No such restaurant."

429 Too Many Requests

You're calling too often

"Slow down."

500 Internal Server Error

The server broke

"Something went wrong on our side."

The 4xx codes mean the problem is with the request. The 5xx codes mean the problem is on the server.

What JSON looks like

#

JSON (JavaScript Object Notation) is the most common format for API data. It's plain text that both humans and programs can read easily.

A response listing restaurants might look like this:

JSON
{  "city": "Chennai",  "restaurants": [    {      "id": 4821,      "name": "Anna's Tiffin Centre",      "rating": 4.4,      "delivery_minutes": 25,      "is_open": true    },    {      "id": 5310,      "name": "Coastal Kitchen",      "rating": 4.1,      "delivery_minutes": 40,      "is_open": false    }  ]}

Curly braces {} hold an object made of named fields. Square brackets [] hold a list. The app reads this and turns it into the cards you see on screen.

REST, and why you keep hearing it

#

REST is a style of designing web APIs, not a technology you install. A REST API organises things as resources, each with its own URL, and uses HTTP methods for actions:

Code
GET    /restaurants          → list restaurantsGET    /restaurants/4821     → get one restaurantPOST   /orders               → place an orderGET    /orders/99120         → check an order's statusDELETE /orders/99120         → cancel it

You'll also come across GraphQL, where the client asks for exactly the fields it wants in a single query, and webhooks, where the server calls your URL when something happens, such as "payment succeeded". Those are worth learning later. REST covers most of what you'll meet first.

API keys and authentication

#

Most APIs need to know who's calling, so they can:

  • Stop strangers from accessing private data
  • Limit how many calls you make (rate limits)
  • Bill you, if the API is paid

A common way is an API key, a long random string sent with each request, usually in a header:

Code
Authorization: Bearer sk_live_8f3k2...

Treat API keys like passwords. Don't paste them into public GitHub repositories, screenshots or chat messages. Leaked keys get found and abused within hours, sometimes minutes, and can lead to big bills or data exposure. Store them in environment variables or a secrets manager, and rotate a key immediately if it leaks.

Try one yourself, right now

#

You don't need to write code. Paste this URL into your browser:

Code
https://api.github.com/users/octocat

You'll see JSON describing GitHub's mascot account: name, number of public repositories, when the account was created. Your browser just made a GET request to a public API and displayed the response.

If you're comfortable with a terminal, try the same call with curl, which comes built into Windows 10+, macOS and Linux:

Shell
curl https://api.github.com/users/octocat

And from JavaScript, the way a web app would:

JavaScript
const response = await fetch("https://api.github.com/users/octocat");const user = await response.json();console.log(user.name, user.public_repos);

Three different tools, the same request underneath.

Where APIs show up in your daily life

#
  • UPI payments: apps talk to banks through NPCI's systems using defined interfaces.
  • "Log in with Google": the app asks Google's API to confirm who you are, without seeing your password.
  • Maps inside other apps: ride-hailing, delivery and property apps use mapping APIs instead of building their own maps.
  • OTP messages: apps call SMS provider APIs to send codes.
  • Weather widgets, cricket scores, stock prices: all pulled from data APIs.
  • AI features: when an app adds a chatbot, it's often calling a language model through an API.

Why APIs matter for your career

#

Even if you never write code, understanding APIs helps in many roles:

  • Product managers decide what to build versus what to integrate.
  • Analysts pull data from tools like CRMs or ad platforms through APIs instead of exporting CSVs by hand.
  • Testers test APIs directly with tools like Postman, often before any UI exists.
  • Founders can launch faster by connecting existing services instead of building everything.

For developers, working with APIs is a daily job: calling other people's, and designing your own.

Frequently asked questions

#

Is an API the same as a website?

#

No. A website is designed for people, with layout, buttons and images. An API is designed for programs, returning structured data like JSON. Many companies run both: a website for you, and an API that the website and mobile app use behind the scenes.

Are APIs free?

#

Some are free, many have a free tier with limits, and others are paid per request or by subscription. Always check the pricing and rate limits before building on one.

What's the difference between an API and an SDK?

#

An API is the interface itself, the requests you can send. An SDK (Software Development Kit) is a ready-made library, often for a specific language, that makes calling the API easier so you don't have to build every request by hand.

What does "endpoint" mean?

#

An endpoint is a specific URL where an API accepts requests, like /orders or /users/42. One API usually has many endpoints.

How do I start learning to build APIs?

#

Learn the basics of one backend language (JavaScript with Node.js, Python or Java), then build a small REST API for something simple, like a to-do list or expense tracker, with endpoints to create, read, update and delete items. Test it with Postman or curl. That one project teaches most of the core ideas.

Sources & further reading

  1. MDN Web Docs, "An overview of HTTP"
  2. MDN Web Docs, HTTP response status codes
  • Guide · Technology

    HTTP, JSON and REST APIs: How Web Backends Talk

  • Guide · Technology

    Security Fundamentals and Spring Security: Passwords, JWT, Access Control, CORS and Secrets

  • Guide · Career

    A LinkedIn Profile That Gets Recruiter Messages