API Examples for Beginners: How Apps Ask Each Other for Data
An API is a set of rules that lets one program request data or actions from another. Everyday API examples, how a request and response work, and key terms.

An API, short for application programming interface, is an agreed set of rules that lets one piece of software ask another for data or for an action, and get a predictable answer back. The program asking does not need to know how the other one works inside. It only needs to know which requests are allowed, what to send and what will come back.
Restaurants offer a familiar comparison. Diners do not walk into the kitchen; they choose from a menu and the order travels through a server. The menu lists what can be requested, the kitchen does the work, and the dish comes back in a known form. An API plays the role of the menu and the server together.
Everyday API examples
Most people use dozens of APIs a day without noticing:
- Weather on a phone. The weather app rarely measures anything itself. It sends a location to a forecasting service's API and displays the temperatures and symbols that come back.
- Maps inside other apps. A delivery or taxi app shows a map and a route by calling a mapping provider's API rather than drawing the world from scratch.
- "Sign in with" buttons. When a site lets you log in using an existing account from a large provider, the two systems exchange messages through an API to confirm who you are, without the site ever seeing that account's password.
- Online checkout. Shops pass card payments to a payment processor through its API, which replies with "approved" or "declined".
- Travel comparison. Sites that list flights or hotels from many sellers gather prices and availability by querying those sellers' APIs.
- The phone itself. When an app asks permission to use the camera or your location, it is requesting access through the operating system's APIs.
The last example is a useful reminder that not every API travels over the internet. Programming languages, libraries and operating systems all expose APIs: documented functions that other code is allowed to call. Calling one looks very much like calling any function in your own program, with parameters going in and a result coming out.
Inside a web API request
Web APIs, the kind most beginners meet first, follow a request-and-response pattern over the same protocol that delivers web pages. A request usually contains:
- An endpoint: the specific address for the resource, such as a path ending in /forecast or /orders/123.
- A method: what you want to do with that resource.
- Headers: extra details, often including an API key or token that identifies the caller.
- A body (sometimes): the data being sent, for example the contents of a new order.
The response comes back with a status code and, usually, a body of data formatted as JSON, a lightweight text format of labelled values and lists that both people and programs can read.
The common methods
| Method | Purpose | Example |
|---|---|---|
| GET | Read data | Fetch tomorrow's forecast |
| POST | Create something new | Submit a new order |
| PUT or PATCH | Update something that exists | Change a delivery address |
| DELETE | Remove something | Cancel a saved draft |
APIs designed around resources and these methods are often described as RESTful, a style that has become the default for many web services.
Status codes worth recognising
- 200: success, here is what you asked for.
- 201: success, something new was created.
- 400: the request was malformed or missing information.
- 401 or 403: not signed in, or not allowed to do this.
- 404: nothing exists at that endpoint.
- 429: too many requests in a short time; slow down.
- 500: something broke on the provider's side.
Where APIs fit in a website
In most modern sites, the part running in the browser talks to the server through an API. The front end asks, the back end answers, and the API defines the conversation. That division of labour is laid out in front end vs back end.
Safe ways to experiment
- Watch real requests. Open your browser's developer tools, switch to the network tab and reload a page. Many of the entries are API calls, complete with methods, status codes and JSON responses.
- Start with public practice APIs. Several free services exist purely for learning and need no account or key.
- Read the documentation first. Good API documentation lists every endpoint, the parameters it accepts and sample responses.
- Protect your keys. Treat an API key like a password: keep it out of shared code and public repositories.
Short answers
Is an API the same as a database?
No. A database stores data; an API is a controlled doorway through which other programs can request some of it, without direct access to the storage behind.
Do APIs cost money?
Some are free, some charge, and many offer a free allowance with limits on how many requests you can make. The provider's own terms set the rules.
When is a beginner ready to use one?
Once variables, functions and basic data structures feel familiar, fetching data from a simple API makes a satisfying project, and it fits neatly into the milestone plan for how long learning to code takes.
Worth a second look
EducationHTML vs CSS: What Each One Does on a Web Page4 min
Real EstateMortgages in Australia Explained: Complete Breakdown for First-Time Homebuyers3 min
NewsPlanning a Day Trip from Boston: Best Nearby Cities and How to Build an Efficient Route3 min
EducationWhat Is Pseudocode? How to Write It, With Simple Examples4 min


