Dashboard

What Is an API? A Plain Guide for AI App Builders

Your AI coding tool keeps saying it will call an API. Here is what that means, what a request looks like, and the four places APIs show up in an app.

Cecilia Iona
Cecilia Iona
Senior Editor, AI & Product
20 October 20261 min read

What is an API? It is a set of rules that lets one piece of software ask another piece of software to do something, without a person clicking through a screen. When your AI coding tool says the app will "call the API" to save a booking or fetch a weather forecast, it means your code sends a structured message to another program and gets a structured answer back.

MDN, the web documentation project maintained by Mozilla, defines an API as "a set of features and rules that exist inside a software program (the application) enabling interaction with it through software - as opposed to a human user interface." It adds that the API "can be seen as a simple contract" between the application offering it and whatever wants to use it. The contract idea is the one worth keeping, because almost every API bug is a broken promise on one side of it.

One request, read line by line

Abstract definitions only go so far, so here is a single request, the kind an AI-built booking app makes when a customer opens the calendar.

GET /api/appointments?date=2026-11-03 HTTP/1.1
Host: example-salon.test
Authorization: Bearer sk_live_abc123

The server answers with something like this:

json
{
  "date": "2026-11-03",
  "slots": [
    { "time": "09:00", "available": true },
    { "time": "09:30", "available": false }
  ]
}

(The domain and key above are made up for illustration.) Four things are happening, and each is a place where things go wrong:

  1. The method, GET. It says what you want to do. MDN describes GET as a request for "a representation of the specified resource", which in plain terms means read-only.

  2. The path and query, /api/appointments?date=... This is the address of the thing you are asking about, plus a filter.

  3. The credential, Authorization. This tells the server who is asking. If it is missing or wrong, you get an error instead of data.

  4. The response body. The answer arrives as structured text, usually JSON. If your app expects a field called "slots" and the server sends "times", the screen goes blank even though the request technically worked.

When an AI tool is debugging an API call, it is checking those same four things in that order. You can do the same.

The methods you will see

MDN lists the standard HTTP methods, and five cover nearly everything an AI-built app does:

Method

What it means

Typical use in your app

GET

Retrieve data, no changes

Load a list of appointments

POST

Submit data, often causing a change

Create a new booking

PUT

Replace a resource with the one you send

Overwrite a customer record

PATCH

Apply a partial change

Update only the phone number

DELETE

Remove the resource

Cancel a booking

The descriptions come from MDN's reference on HTTP request methods. If your AI agent uses POST where PUT would be cleaner, the app usually still works. If it uses GET for something that changes data, that is a real bug, because browsers and caches assume GET is safe to repeat.

The four APIs inside an AI-built app

People say "the API" as if there were one. A typical app has four, and knowing which one is misbehaving saves hours.

Your own API. The backend routes your app exposes to its own front end, like the appointments route above. When this breaks, the bug is in code your AI tool wrote. See what a 500 error means in an AI-built app for how to read that failure.

Third-party APIs. Payments, email sending, maps, calendars. You do not control these, you read their documentation and send what they ask for. The AI tool will often guess at fields it has not seen, so paste in the provider's real documentation instead of letting it improvise.

An AI model's API. When your app asks a model to summarize text or answer a question, it is another third-party API, with extra quirks: it bills by usage and it has limits on how fast you can call it. AI API rate limits explained shows what a rate-limit error looks like.

The browser's own APIs. MDN gives examples such as the Geolocation API, which "can be used to retrieve location information from services the user has available on their device". No account needed, but the browser will ask the user for permission, and that prompt is a frequent source of "it works on my machine" confusion.

API keys are the part to protect

Most third-party APIs identify you with a key, a long string that works like a password for your account and your bill. Three habits matter:

API versus SDK, briefly

An API is the contract. An SDK is a prebuilt toolkit in a specific programming language that calls the contract for you. You can use an API with no SDK at all, and many AI-generated apps do. The difference gets its own treatment in SDK vs API.

A quick way to test any API yourself

Before asking an AI tool to fix an integration, make the request by hand. Most API documentation includes a sample command you can paste into a terminal, or you can use a free request-testing app. If the hand-made request works, the problem is in your app's code. If it fails, the problem is the key, the address, or the data you are sending, and the AI tool will fix it faster once you can tell it which.

For the wider picture of how these pieces fit into a finished product, the pillar guide on how to build an app with AI is the place to continue.

Frequently asked questions

What is an API in simple terms?

It is a set of rules for one program to ask another program for something, such as data or an action, and get a predictable answer back. The rules cover the address to call, the format of the request, and the format of the reply.

What is the difference between an API and a website?

A website is built for a person to read. An API is built for software to read, so it returns structured data like JSON instead of a designed page. Many sites use an API behind the scenes to fill in their pages.

Do I need to know how to code to use an API?

Not to understand one. AI coding tools will write the calls for you. What helps is being able to read a request and a response, so you can tell the tool what is wrong when something fails.

Is an API the same as an API key?

No. The API is the service you are calling. The key is the credential that proves the request comes from your account. Losing the key does not delete the API, but it can run up your bill.

Are APIs free?

Some are, many are not. Pricing is set by whoever runs the API, and AI model APIs typically bill by the amount of text processed. Always check the provider's pricing page before building a feature that calls one in a loop.

How did this land?

About the author

Cecilia Iona
Cecilia Iona

Senior Editor, AI & Product

Cecilia leads the Swarmz editorial desk. She has spent a decade turning complex AI and product topics into writing people actually finish, and she owns the blog's quality bar.

Share

Get the next post in your inbox

One email a month. Product updates, engineering posts, and the best of Built with Swarmz.

I agree to receive emails about AI building tips and Swarmz product news. Unsubscribe any time.