API gateway explained in plain terms is a single entry point that sits in front of a set of services and handles the traffic coming in from clients. The central question is why applications need a gateway at all when clients could call each service directly, and the short answer is that the gateway takes care of routing, security, and traffic management in one place, so the services behind it stay simple and focused.
Modern applications are often built from many small services, each doing one job. A shopping application might have separate services for products, orders, payments, and accounts, and a client would need to know about all of them. A gateway hides that complexity: the client talks to one address, and the gateway routes each request to the right service.
Key takeaways
- An API gateway is a single entry point in front of a set of services.
- It routes requests, enforces security, and manages traffic in one place.
- Clients see one address instead of many separate services.
- Gateways handle authentication, rate limiting, logging, and transformation.
- A gateway is a single point of failure, so it must be reliable and scalable.
What an API gateway does
At its simplest, a gateway receives a request, works out which service should handle it, and forwards it there. The response travels back through the gateway to the client. This routing is based on the request path, headers, or other details, and it can change without the client ever noticing.
Beyond routing, the gateway takes on the jobs that every service would otherwise have to do itself. It checks that the caller is authenticated, applies rate limits, logs requests, and can transform a request or response into the shape the other side expects. Services behind the gateway can then focus on their own work.
The gateway also gives teams one place to see what is happening. Traffic, errors, and usage can be observed at the gateway, which makes problems easier to find than if each service kept its own records. Our guide to API security explains the protections that often sit at the gateway.
Why gateways exist
The main reason is that services multiply. As an application grows, the number of services grows with it, and expecting every client to know about each one becomes unmanageable. A gateway gives clients a stable address while services change behind it.
The second reason is consistency. Security rules, logging, and rate limits should apply the same way to every service, and putting them in the gateway means they are written once rather than repeated in each service. A rule changed at the gateway takes effect everywhere at once.
The third reason is control. A gateway lets a team change how traffic flows without changing the services: they can route a share of traffic to a new version, block a misbehaving client, or add a new service behind the same address. Our guide to event-driven architecture describes another way services communicate, which often works alongside a gateway.
How a request flows through a gateway
A request arrives at the gateway, which first checks the basics: is the caller allowed in, and is the request well formed? Authentication happens here, using tokens or keys, so that unauthenticated traffic never reaches the services.
Next the gateway applies its policies. Rate limits protect services from being overwhelmed, and request validation rejects malformed data early. The gateway then routes the request to the right service, possibly transforming it on the way, for example by adding headers the service needs.
When the service replies, the gateway can transform the response too, for example by removing internal fields the client should not see. It logs the request and the result, and returns the response to the client. The whole journey is usually measured in milliseconds, and the client never sees the services behind the gateway.

Comparing gateway approaches
| Approach | How it works | Main benefit | Main drawback |
|---|---|---|---|
| Managed gateway | Provided by a cloud platform | Little to run yourself | Less control over behaviour |
| Self-hosted gateway | Runs on your own infrastructure | Full control | You operate and scale it |
| Service mesh ingress | Part of a mesh setup | Deep integration with services | More complex to set up |
| Simple reverse proxy | Forwards traffic by rules | Lightweight and fast | Fewer built-in features |
| Serverless gateway | Scales automatically per request | No servers to manage | Can add latency on cold starts |
Common gateway features
Authentication and authorisation are the most important features. The gateway checks who the caller is and what they are allowed to do, before any service is involved. Keys, tokens, and certificates are all used here, and our guide to secrets management explains how the credentials behind these checks should be stored.
Rate limiting and quotas protect services from overload and abuse. A gateway can limit how many requests a client makes in a given period, and can slow down or block clients that exceed it. This keeps one misbehaving client from affecting everyone else.
Logging, monitoring, and tracing give teams visibility into traffic. Caching can reduce load by serving repeated requests from the gateway instead of the service, and transformation lets the gateway adapt requests and responses between clients and services that speak slightly different shapes.
Some gateways also handle request aggregation, combining calls to several services into one response, and protocol translation, such as accepting one style of request and forwarding another. These features reduce the work clients have to do, at the cost of more logic in the gateway.
Gateway pitfalls
The biggest pitfall is that the gateway becomes a single point of failure. If it goes down, every service behind it is unreachable, even though the services themselves are fine. Gateways must therefore be run with redundancy and scaled to handle the traffic they carry.
A second pitfall is putting too much logic in the gateway. When business rules creep into routing and transformation, the gateway becomes hard to change and hard to test, and teams start to fear touching it. The gateway should handle cross-cutting concerns, while business logic stays in the services.
A third pitfall is configuration drift. Gateways are configured with routes, policies, and rules, and if those are changed by hand without version control, they become hard to reproduce. Our guide to platform engineering covers the practices that keep shared infrastructure like gateways consistent and reliable.
API gateway checklist
- Put one gateway in front of services that clients call directly.
- Authenticate every request at the gateway before it reaches a service.
- Apply rate limits so one client cannot overwhelm your services.
- Log requests at the gateway for visibility and debugging.
- Run the gateway with redundancy so it is not a single point of failure.
- Keep business logic in services, not in the gateway.
- Version-control gateway configuration like any other code.
- Test routing changes before they reach production traffic.
- Monitor gateway latency, errors, and traffic patterns.
Frequently asked questions
What is an API gateway?
An API gateway is a single entry point that sits in front of a set of services and handles incoming traffic. It routes requests to the right service, enforces security, applies rate limits, logs traffic, and can transform requests and responses.
Is an API gateway the same as a load balancer?
No, though they overlap. A load balancer spreads traffic across copies of the same service, while a gateway routes traffic to different services and applies policies such as authentication and rate limiting. Many setups use both, with a load balancer in front of the gateway.
Do I need an API gateway for a small application?
Not always. A single service or a small handful of services can often be called directly. A gateway becomes worth it when the number of services grows, when several kinds of clients need access, or when consistent security and traffic rules matter.
What is the difference between a gateway and a service mesh?
A gateway handles traffic entering the system from outside, while a service mesh manages traffic between services inside the system. They solve different problems and are often used together, with the gateway at the edge and the mesh inside.
Can a gateway slow down requests?
It adds a small amount of latency, since every request passes through an extra hop. In most cases this is a few milliseconds, which is a fair trade for the routing, security, and visibility the gateway provides. Caching at the gateway can even make some requests faster.
How do gateways handle authentication?
The gateway checks the caller’s credentials, such as a token or key, before forwarding the request. It can also check what the caller is allowed to do, so unauthorised requests are rejected early and never reach the services.
The bottom line
API gateway explained in one line is this: a gateway is the front door for your services, giving clients one stable address while routing, security, and traffic management happen in a single, well-run place.
Used well, it simplifies both sides of the conversation. Clients deal with one entry point, services stay focused on their own work, and the team gains one place to see and control the traffic flowing between them.







