You use APIs dozens of times a day without noticing. Checking the weather on your phone, sending a message, paying for something online: each of those actions quietly hands a request to an API and waits for an answer. The word sounds like deep infrastructure, but the idea behind it is plain, and once it clicks you start seeing APIs everywhere.

This guide gives you a working API definition in both plain language and technical terms, then walks through how APIs actually move data: requests and responses, endpoints, methods, authentication, and the JSON they hand back. After that we cover the main styles you will meet (REST, SOAP, GraphQL, and webhooks), look at real examples, and show how a scraping API turns a messy website that has no official API into something you can call like one.

API definition: what an API actually is

An API, short for Application Programming Interface, is a set of rules that lets two pieces of software talk to each other. One program asks for something; the other program answers in a predictable format. The API is the agreed-upon contract in the middle that says how to ask and what you will get back.

The classic way to picture it is a restaurant. You sit at a table (your app), you read a menu of things you are allowed to order (the API's documented options), and you tell the waiter what you want. The waiter (the API) carries your order to the kitchen (the server), waits while it is prepared, and brings the result back to your table. You never walk into the kitchen, and you do not need to know how the dish is cooked. You only need to know what is on the menu and how to ask for it.

In technical terms, an API exposes a defined interface to a system's data or functions while hiding the implementation behind it. It abstracts away the database, the business logic, and the internal code, and gives the outside world a stable set of operations to call. That abstraction is the whole value: the kitchen can change its recipes completely, and as long as the menu stays the same, your table never notices.

The short version

An API is a contract for software-to-software conversation. One side requests, the other side responds in an agreed format, and neither has to know how the other is built internally.

How an API works: request and response

Almost every API runs on the same simple loop: a client sends a request, the server returns a response. Everything else is detail on top of that pattern. Walk through the pieces and the rest of this article falls into place.

The request

A request is a message your program sends to the API saying what it wants. A typical web API request carries four things: which address to hit (the endpoint), what kind of action you want (the method), who you are (authentication), and sometimes a body of data you are sending along.

The response

The response is what comes back. It usually includes a status code that tells you how it went (200 means success, 404 means not found, 401 means you were not authorized) and a body containing the data you asked for, most often formatted as JSON. Your code reads that response and does something useful with it.

Endpoints

An endpoint is a specific address you call to reach a specific resource or action. If the API is the menu, endpoints are the individual items on it. A weather API might expose one endpoint for current conditions and another for the five-day forecast. Endpoints generally fall into a few familiar shapes:

  • Resource endpoints return a specific thing, such as a single user profile or one product.
  • Collection endpoints return a group of things, such as a list of all products.
  • Action endpoints perform an operation, such as processing a payment or sending an email.
  • Search endpoints let you query and filter, such as finding all orders placed this week.

Methods

The method tells the API what you intend to do with an endpoint. Web APIs borrow these verbs straight from HTTP, and four of them cover most of what you will write:

  • GET reads data without changing anything (fetch a profile).
  • POST creates something new (submit a new order).
  • PUT updates an existing thing (edit a profile).
  • DELETE removes something (cancel an order).

Authentication

Most useful APIs need to know who is calling before they answer. Authentication is the API checking your identification at the door. The simplest form is an API key, a long secret string you include with every request that identifies your account, much like a house key that opens one specific door. Tokens go a step further: they behave more like a smart card that also carries information about what you are allowed to do, and standards such as OAuth 2.0 use them for richer, permission-aware access. The right choice is a balance. A basic API key is plenty for a simple internal tool, while a public, user-facing app usually wants the stronger guarantees that tokens and OAuth provide.

JSON: the format most responses speak

When an API answers, it has to format the data so your program can read it reliably. JSON (JavaScript Object Notation) has become the default because it is compact, human-readable, and supported by every modern language. It represents data as key-value pairs and nested lists, which maps neatly onto the objects most programs already work with. A small JSON response for a single user might look like this:

json
{
  "id": 42,
  "name": "Ada Lovelace",
  "email": "[email protected]",
  "active": true
}

Put the pieces together and a full round trip reads almost like a sentence: send a GET request, to the users endpoint, with your API key, and get back JSON. Here is that same idea as a one-line call you could run from a terminal, plus the kind of response it returns.

bash
# GET a user, sending an API key as a header
curl -H "Authorization: Bearer YOUR_API_KEY" \
     "https://api.example.com/users/42"

The server reads the request, confirms the key, looks up user 42, and answers with the JSON object above. That is the entire mechanism behind most of the APIs you will ever touch.

One request, one response. The client calls a method on an endpoint, for example GET /v1/users/42, and the server answers with a status code and a JSON body. Every API interaction, however large, is built from this single round trip.

Types of API: REST, SOAP, GraphQL, and webhooks

APIs follow a handful of common styles. They all do the request-and-response job, but they differ in how strict they are, how you ask for data, and how the data comes back. Four cover the vast majority of what you will encounter.

REST

REST (Representational State Transfer) is the dominant style on the modern web. It is less a strict protocol than a set of conventions: use plain HTTP methods on clearly named endpoints, keep each request self-contained, and return data in a simple format like JSON. REST is popular because it is approachable and stateless, meaning each request carries everything the server needs and the server keeps no memory of previous calls. That makes REST APIs easy to cache, easy to scale, and easy to learn, which is why most public APIs you meet are RESTful.

SOAP

SOAP (Simple Object Access Protocol) is the older, stricter cousin. Where REST is flexible, SOAP enforces a rigid contract: messages are always XML and must follow a formal structure. That strictness is a feature in regulated, high-stakes settings. SOAP has strong built-in standards for security, transactions, and reliability, so it still shows up in enterprise environments like banking and payment processing where guaranteed, auditable messaging matters more than convenience.

GraphQL

GraphQL, developed at Facebook in 2012, takes a different angle. Instead of many endpoints that each return a fixed shape of data, it exposes a single endpoint and lets the client ask for exactly the fields it wants. The benefits follow directly: you stop over-fetching data you do not need, you can pull related things in one round trip instead of several, and a typed schema documents precisely what is available before you ever send a query. That precision makes GraphQL appealing for complex apps with many screens that each need slightly different slices of the same data.

Webhooks

Webhooks flip the usual direction. With REST, SOAP, and GraphQL, your app asks and the server answers; with a webhook, the server tells your app the moment something happens, no asking required. You register a URL, and when an event occurs (a payment clears, a build finishes, a form is submitted) the service sends a request to your URL with the details. Think of it as the difference between repeatedly phoning the kitchen to ask if your order is ready and the kitchen simply ringing a bell when it is. Webhooks are the standard way to get real-time updates without polling an API over and over.

Real-world API examples

The clearest way to make the API definition stick is to name a few you have almost certainly used:

  • Payments. When a checkout page charges your card, it is calling a payment provider's API in the background. The store never touches your raw card details; it asks the API to handle the transaction and waits for an approved-or-declined response.
  • Maps. A delivery app that shows a live map and an estimated arrival time is pulling tiles, routes, and distances from a mapping API rather than building its own map of the world.
  • Sign in with Google or Apple. Those buttons use an authentication API so an app can confirm who you are without ever seeing your password.
  • Weather. The forecast in your phone's weather app comes from a weather provider's API, the same data sold on to agriculture, logistics, and event planning.
  • Social and streaming. Posting from a third-party app, or getting a personalized playlist, runs through APIs that read and write data on the platform's behalf.

Why APIs matter

APIs are the reason modern software is built from parts instead of from scratch. No team needs to write its own payment processor, mapping engine, or authentication system when a well-documented API does the job in a few calls. That lets companies ship faster and focus on what makes their product different rather than rebuilding solved problems.

They also create real business value. APIs let a company plug into partner ecosystems, open new distribution channels, and reach customer segments it could not serve alone. Many organizations now treat their data and services as products in their own right: a weather firm sells its forecasts through an API, a bank exposes account data to fintech apps, and both turn existing systems into revenue. APIs also unify the customer view by breaking down data silos, so an app, a website, and a chatbot can all present the same consistent, up-to-date information.

When a website has no API: the scraping API

Here is the gap. Plenty of the data you might want lives on a public website that offers no official API at all. The information is right there on the page, but there is no clean endpoint to call and no JSON waiting for you. The traditional answer is web scraping: fetch the page's HTML and pull the values out yourself. That works until the site renders content with JavaScript, blocks unfamiliar visitors, throws a CAPTCHA, or changes its layout, at which point a simple fetch turns into an ongoing maintenance problem.

A scraping API closes the gap by wrapping all of that behind a single endpoint. Instead of managing browsers, proxies, and retries yourself, you send one request that names the URL you want, and you get the page back as a clean response, exactly the request-and-response loop every other API uses. In effect, it gives an API-less website an API-like interface: you call it the same way you would call a weather or payments service, and the messy parts of fetching a real page stay on the other side of the contract.

Crawlbase Crawling API

When a site you need has no API of its own, the Crawling API gives it one. Send a single request naming the page, and Crawlbase handles JavaScript rendering, IP rotation, and CAPTCHAs behind the scenes, then returns the page's HTML so you can work with the data instead of fighting the infrastructure. Your first 1,000 requests are free.

Once a page comes back as a predictable response, everything you learned above applies. You can parse the HTML with a library, request the data with the help of Python or Node.js, and feed the result into your own app exactly as if it had arrived from a documented JSON endpoint. The website becomes just another API your code knows how to call.

Scraping responsibly

Treating a website like an API does not remove your responsibility for how you use it. Stick to public data, read and respect the site's terms of service and its robots.txt, identify your requests honestly, and keep your request rate reasonable so you are not straining someone else's servers. A managed scraping API helps you stay polite by spreading and pacing requests for you, but the judgment about what to collect, and how hard to hit a site, is still yours.

Recap

Key takeaways

  • An API is a contract. It lets two programs talk by defining how to ask and what comes back, while hiding the implementation behind it.
  • Everything is request and response. A client sends a request to an endpoint, with a method and authentication, and the server answers, usually in JSON.
  • Styles differ, not the core idea. REST is the flexible web default, SOAP is strict and enterprise-grade, GraphQL fetches exactly the fields you ask for, and webhooks push updates to you.
  • APIs are why software is modular. They let teams reuse payments, maps, and auth instead of rebuilding them, and let companies turn data into products.
  • A scraping API gives an API-less site an interface. One request in, a clean page back, so a website you cannot officially query behaves like any other API.

Frequently Asked Questions (FAQs)

What is an API in simple terms?

An API is a set of rules that lets two software programs talk to each other. One program sends a request asking for data or an action, and the other sends back a response in an agreed format. Like a waiter carrying your order to the kitchen and bringing the food back, the API handles the conversation so neither side needs to know how the other works inside.

What is the difference between an API and a website?

A website is built for people: it returns HTML styled for a browser so a human can read it. An API is built for programs: it returns structured data, usually JSON, that other software can read directly. A scraping API sits in between, fetching a human-facing page and handing it back as a predictable response your code can process.

What are the main types of API?

The most common styles are REST, SOAP, GraphQL, and webhooks. REST is the flexible, widely used standard for web services. SOAP is a stricter, XML-based protocol favored in enterprise and finance. GraphQL lets clients request exactly the fields they need from one endpoint. Webhooks reverse the flow so a server can push real-time updates to your app when an event happens.

What is JSON and why do APIs use it?

JSON (JavaScript Object Notation) is a lightweight, text-based format for representing data as key-value pairs and lists. APIs favor it because it is compact, easy for humans to read, and supported by every modern programming language, which makes responses simple to send, store, and parse.

Do I need an API key to use an API?

Often, yes. Many APIs require an API key or token so they can identify your account, control access, and track usage. You include the key with each request, much like showing identification at a door. Some open APIs allow limited use without a key, but most production services expect one.

How do I use a website that has no API?

You can use a scraping API, which wraps the website behind a single endpoint. You send a request naming the page you want, and the service fetches it, handling rendering, IP rotation, and blocks for you, then returns the HTML as a clean response. From there you parse the data exactly as you would from any standard API.

Start Building

Crawl any site at scale, without fighting infrastructure.

Crawlbase handles proxies, fingerprints, and CAPTCHAs so your team ships data pipelines instead of maintaining crawl plumbing. 1,000 requests free, no card required.

Self-serve · No sales call required · Enterprise crawl volumes available