API definition
An API (application programming interface) is a defined way for one piece of software to request data or actions from another. On the web it usually means sending an HTTP request to a URL and getting a structured response back, typically JSON.
An API is a contract. It states which requests are allowed, what they must contain and what comes back. Whatever happens on the other side stays hidden, so a provider can rebuild its whole backend without breaking anyone, as long as the contract holds.
When the contract does have to change, providers version it and keep the old version running. Sanity, for example, has every client pin an API version written as a date, so a query keeps returning the same shape after the platform moves on.
What does an API do on a marketing website?
More than most site owners would guess. This site, for instance, calls:
- the Sanity API for the content of every page
- Resend's email API to deliver contact form messages
- an analytics endpoint, once a visitor accepts cookies
- Mux's API to stream video
Webflow and Framer hide most of this, which is a large part of their appeal. APIs come back into view when the site has to talk to something the platform doesn't support natively, such as pushing form leads into a CRM or syncing a Webflow CMS collection from a product database through Webflow's Data API.
Is an API the same as an endpoint?
An endpoint is one URL within an API, such as the address you post a form submission to. The API is the full set of endpoints plus the rules for using them, including how you authenticate and how many requests you're allowed. In conversation the two words get swapped all the time, and it rarely causes trouble.
Where should API keys live?
On the server. Most APIs identify the caller with a key or token, and anything shipped to the browser can be read by anyone who opens the developer tools. In Next.js that means keeping secret keys out of variables prefixed with NEXT_PUBLIC_, because those get bundled into client code.
Related terms
- PaginationPagination is splitting a long list of content, such as blog posts, products or search results, into separate pages that visitors move between with numbered links or next and previous buttons. APIs use pagination too, returning large result sets one chunk at a time.
- Agentic workflowAn agentic workflow is a multi-step process where a language model handles some of the steps, such as drafting, classifying, calling tools or checking output. The order of steps is fixed in code. That separates it from an AI agent, which plans its own steps.
- OG imageAn OG image is the preview picture shown when a link is shared on social media or in a messaging app. The page sets it with the Open Graph og:image meta tag, and the recommended size is 1200 × 630 pixels.