Skip to content
Back to glossary

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.