Skip to main content

What is an API gateway, and when does an enterprise need one

An API gateway is the one entry point in front of your APIs. See what it holds on a real G8 Environment, the problems it solves, and when a proxy is enough.

By Selim Çalık Guides

What an API gateway is

An API gateway is a server that receives every API request from your clients, decides which backend service should handle it, applies rules on the way in and out, and records what happened. The rules are the point: who the caller is, how many requests they may make, what the request may contain, where it goes, and what is logged. The backend services behind the gateway do not implement those rules; they receive requests the gateway has already checked.

The rest of this article shows what that means in practice, on a real Environment of the G8 console, and then answers the question in the title: when a reverse proxy is enough, and when it is not.

What a gateway holds

Open Routes in the G8 console and you see the gateway’s table of contents. Each Route is a path and a set of methods, usually with an Upstream behind it; the Routes without one are answered by their Plugins. The Environment below has five: a payments API and an orders API in front of two backend services, two chat endpoints in front of language models, and an endpoint that serves an orders API to AI agents as tools.

The Routes table of the Staging Environment: five Routes with their URIs, methods, targets and status Five entry points, one address. The Target column says which Routes forward to a backend; the ones without a target are served by their Plugins.

Open one Route and you see everything the gateway knows about it. Matching is the address clients call and the paths and methods that reach this Route. Target is the Upstream, the backend behind it, a named object with its own nodes, balancing and health checks. Plugins are the rules: on orders-api, key-auth identifies the caller and limit-count gives each caller a budget. Metadata is the id, the Environment and the timestamps.

The Overview of the orders-api Route: Matching with the address and the path /orders/*, Target with the Upstream orders-backend, Plugins key-auth and limit-count, and the Metadata One Route, read top to bottom: what reaches it, where it goes, which rules apply, who it belongs to.

The Request path card on a Route’s Plugins tab shows the order in which the rules run. Rules that apply to every Route in the Environment, the global rules, run first; then the Route’s own Plugins by priority; then the request reaches the Upstream. On payments-api below, the caller is signed in by openid-connect and checked by authz-keycloak before the request reaches the payments backend.

The Request path card of the payments-api Route: the global rules first, then openid-connect and authz-keycloak by priority, then the Upstream payments-backend The order is part of the configuration. A rule that identifies the caller has to run before a rule that decides what the caller may do.

Around these objects sit the ones a gateway needs to run a business, not just a demo: Consumers, the identities of the callers, each with their credentials; Services, which group Routes that share a backend and rules; Certificates; and the Plugins catalog, 109 of them in this Environment, grouped by what they do.

The problems it solves

One address, many backends. Clients call one host. Which service answers, and on which nodes, is the gateway’s decision, and it changes without the clients changing.

Identity in one place. A caller signs in once at the gateway, with an API key, a token or a sign-in at the company’s identity provider, and every backend receives the identity as a header. No backend keeps its own list of keys.

Limits and protection before the backend. Rate limits, request-size limits, allowed methods and paths, and prompt rules for language models are applied before a request costs backend capacity. A refused request never reaches the service.

One record of every call. Every request through the gateway is a record with the caller, the Route, the status, the timing and the node that answered. The backends do not have to agree on a log format.

Change control. The configuration of the gateway is the one thing every API shares, so a change to it needs a role check, a record of who changed what, and a way to try it in one Environment before another. That is what the G8 console adds on top of the engine: Change control and audit.

When a reverse proxy is enough

A reverse proxy forwards requests to backends and terminates TLS. If you have one team, a handful of services, clients that are all your own, and no need to know who called what, a reverse proxy does the job and a gateway is weight you do not need.

The signs that it stops being enough are concrete:

  • A second team, or a partner, starts calling your APIs, and someone asks who is allowed to call which one.
  • A backend goes down under load from one client, and the fix is a limit per client rather than more servers.
  • An auditor, or a security review, asks for the list of API changes in the last quarter and who made them.
  • The same identity check, the same limit or the same header rewrite is being implemented in a third service.
  • Applications start calling language models, and the provider keys and the spend need a home that is not application code.

Each of these is a rule that belongs in front of the services rather than inside them. The first one usually arrives with the first external consumer.

When it is not

A gateway is not a replacement for the design of your APIs, and it does not make an unreliable backend reliable. It can retry, time out, balance and fall back, but a service that answers wrong answers wrong through a gateway too. It is also not where business logic belongs: a rule that needs to read your database is a service, not a Plugin.

What to do next

Written by
Selim Çalık
Founder, G8
Next step

See G8 in a demo

We’ll show you the console with APIs and AI traffic like yours, and answer the questions these articles leave open.

  1. 01Demo
  2. 02Proof of conceptOn Docker for a quick start, or on the infrastructure you plan to run G8 on.
  3. 03LicenseWe prepare a quote for your edition and nodes, and you receive a signed license file.