Web apps & software

What is an API gateway?

An API gateway is a server that sits in front of one or more back-end services and acts as their single entry point. It routes each request to the right service and handles shared concerns such as authentication, rate limiting and logging.

Jobs a gateway takes on

  • Routing: /bookings goes to the booking service, /payments to billing, even if they run on different servers.
  • Security: checks API keys or tokens once, so every service does not reimplement it.
  • Traffic control: rate limits per customer, request size limits, IP allow-lists.
  • Translation: can aggregate several internal calls into one response for a mobile app, or convert between protocols.
  • Observability: one place to log and measure every call.

Common options

Managed gateways include Amazon API Gateway, Azure API Management, Google Cloud's API Gateway and Apigee. Self-hosted choices include Kong, Tyk, Traefik and plain NGINX configured as a reverse proxy. Cloudflare and similar edge networks also offer gateway features.

Do you need one?

A single application with one API usually does not; its framework can handle auth and rate limits. A gateway starts to pay off when you publish APIs to partners, run several services, or need per-customer quotas and analytics. Beware turning it into a dumping ground for business logic, which makes it a fragile bottleneck.

Questions, answered

No. A load balancer spreads traffic across copies of a service; a gateway understands API requests and applies rules to them.

A little, usually a few milliseconds, which is small compared with the work it saves.

By the Stegnor team · Updated