Skip to main content
Vibe Code Forum

Article: APIs and API keys: how apps talk to each other

An API (application programming interface) is a menu of things one program lets another program ask for. When your app gets the weather, takes a payment, sends an email or asks an AI model a question, it does so through someone's API.

What a call looks like

Your app sends a request to an address (an endpoint) such as https://api.example.com/v1/forecast?city=Sydney, and gets a response, usually in JSON:

{ "city": "Sydney", "tomorrow": { "max": 24, "rain": "20%" } }

Requests have a method: GET to read, POST to create, PUT or PATCH to update, DELETE to remove. Responses have a status code: 200 means OK, 400 means your request was wrong, 401 or 403 means you're not allowed, 404 means not found, 429 means too many requests, and 500 means the other side broke.

API keys

Paid or private APIs need to know who is calling, so they give you an API key: a long secret string sent with each request. Whoever has the key can use the service on your account.

Your own API

Your app's back end is also an API: the front end calls addresses like /api/notes. Each of those endpoints must check that the request is allowed (is this user signed in? do they own this note?) because anyone can send requests to it directly, not just through your buttons.

Webhooks

A webhook is an API call in the other direction: a service calls your app when something happens, for example "payment succeeded". Your app must check the webhook really came from that service (usually with a signing secret) before trusting it.

In your prompts

Name the API and link its documentation: "Use the official Stripe Node library, call it from the server only, and handle the 429 rate-limit response by retrying after a short wait."

More in Concepts