Glossary
What is API?
Published Updated
Also known as: application programming interface.
Think of a shop counter: you don’t walk into the stockroom. You place your order at the counter and get the product. An API is that counter between two programs.
MDN, the web’s reference documentation, describes an API (application programming interface) as a set of features and rules inside a program that lets other software work with it, as opposed to a person using its screen. In web development, it says, that means things like methods, events and URLs a developer can use to work with the browser, with other software on the computer, or with outside websites and services.
What happens when your app uses one
When you build with AI, an API call usually goes like this:
- Your app sends a request to an address (a URL) that a service published, for example “tomorrow’s weather for this city”.
- The service checks who is asking. That is what the key is for.
- It sends back a response: the data you asked for, or an error code that says what went wrong.
You never write this by hand. The AI does. But when something breaks, it helps to know which of these three steps failed.
Three kinds of API you will meet
- A service your app calls. Payments, email, maps, an AI model. You create an account at that service and get a key. Lovable’s and Bolt’s docs use payment and email services as examples of what an app connects to this way.
- Your own back-end. When the pages people see ask your server to save or fetch something, they talk to it through an API too. You don’t see it, but the AI built it.
- Built into the browser. MDN’s examples include the Geolocation API, which reads a device’s location, and getUserMedia, which grabs the webcam. Local storage is one as well. They come with the browser, so you don’t sign up for anything.
What an API key is, and which ones can be public
An API key is a password-like code that tells a service which account is making the request. Not every key is equally sensitive, and Supabase’s docs show the difference well:
- The publishable key can go in a web page or app. Supabase says anyone can read it, so it only reaches what Row Level Security (a database rule that limits who sees which rows) allows.
- The secret key must never leave your control. Supabase says it bypasses every Row Level Security policy and must never go in a browser, a shipped app or source control.
One thing to know before you copy a key from a tutorial or from the AI: Supabase says it is deprecating its older anon and service_role keys by the end of 2026, in favor of the publishable and secret keys. If a tool tells you to copy a long key that starts with eyJ, it was written for the older ones.
Where the key goes in Lovable and Bolt
The rule is the same in both: the secret stays on the server side, never in the page.
- Lovable. Its docs say Secrets hold API keys and tokens without exposing them in code: they are encrypted, handed to your Edge Functions automatically and never reach the browser. They are write-only, so after you save one, the value can’t be viewed again, only replaced or deleted. Manage them in More, then Settings, then Secrets.
- Bolt. Its docs say secrets only work with server functions, and that Bolt doesn’t write the value into your project’s files, your browser code or your published site. They also warn that an environment variable (a value stored in the project’s
.envfile) is different: it is part of your code, and if the browser reads it, the value reaches anyone who visits your published site. Open the database icon in the top menu, then Secrets (the project needs a database connected first).
Rule of thumb: if a key sits in code that runs in the browser, treat it as public. The full routine is in How to keep API keys safe in a vibe-coded project.
Error codes that point to an API
When an app calls an API and it fails, the response carries a number. These are the ones you will see most, with what MDN says each means:
| Code | What MDN says | What to check first |
|---|---|---|
| 401 | The request lacks valid authentication credentials | Is the key missing, wrong or expired? |
| 403 | The server understood the request but refused it; signing in again makes no difference | The key works, but this account may not do this. Check permissions |
| 404 | The server can’t find what was asked for | A mistyped or moved address |
| 429 | Too many requests in a given amount of time (“rate limiting”) | Wait, then try again; ask the AI not to repeat the call in a loop |
If your app uses Supabase and you see “permission denied”, read Supabase: permission denied for table.
Ask the AI which APIs your app uses
You don’t have to read the code. Paste this and change nothing:
List every outside service this app talks to through an API (payments, email, maps, AI models, a database). For each one, tell me what the app uses it for, where its key is stored (browser code, a server function, Secrets, or a .env file), and whether it is a public key or a secret key. Don't show me any key values and don't change any code.
If a secret key shows up in browser code or in your GitHub repository, ask the AI to move it into Secrets and then create a new key at the service, because the old one has already been seen. If one has leaked, Could my app be exposing personal data? explains what to check.
A key is billed to the account that owns it
Anthropic’s help center says paid Claude plans and the Claude Console, its developer platform that provides API keys, are separate products, and that the Claude API is billed separately from a paid plan. So a flat subscription for chat doesn’t cover what a tool spends through your key. Set a limit that blocks requests before you paste a key anywhere: Set an API spending limit shows how.
Sources, checked on November 15, 2026: MDN, API, 401, 403, 404 and 429; Lovable, Secrets; Bolt, Secrets; Supabase, API keys; Anthropic, Why is Claude API usage billed separately from my paid Claude plan?.