StackLift
All terms

Glossary

API gateway

A single entry point that routes, secures and limits requests to the services behind it.

An API gateway is a server that sits between clients and your backend services and acts as the single entry point. It routes each request to the right service and handles shared concerns such as authentication, rate limiting, logging and caching, so the services behind it do not each have to.

Gateways are most common in systems with several services or several kinds of clients. Mobile apps, web apps and partners call one address, and the gateway decides where the request goes.

A gateway is also a single point to monitor and, if poorly set up, a single point of failure. It should stay thin: routing and policy, not business logic.

Start in 60 seconds

Put this to work on your project.

Get an AI-assisted, architect-reviewed scope, cost range, and timeline. Free, no login.

The complete guide

API gateway: the complete guide

Updated November 18, 2026 ยท Published by , Founder, StackLift AI. Written with AI assistance; how we make content.

Short answer

An API gateway is a single entry point that sits in front of your backend services and handles the work every API call needs: authentication, rate limiting, routing, request and response transformation, caching and logging. Clients talk to one address, and the gateway decides which service answers and whether the call is allowed.

What is an API gateway?

An API gateway is a front door for your APIs. Instead of every client calling every service directly, requests arrive at the gateway. It checks who is asking, applies the rules, sends the request to the right service and returns the reply.

Think of a building's reception desk. Visitors do not wander the corridors. They check in, get checked against a list, and are sent to the right floor. The gateway does that for traffic, and it keeps a log of who came and when.

It is most common with microservices, where many small services would otherwise each need their own security, limits and public address. It is also useful in front of a single monolith or a set of serverless functions.

What does an API gateway do?

Typical gateway functions
FunctionWhat it doesWhy it helps
RoutingMaps a request path to the right backend serviceClients see one stable address while services change behind it
Authentication and authorizationVerifies keys, tokens or certificates and checks permissionsSecurity is applied in one place, not rewritten in every service
Rate limiting and quotasCaps how much each caller can useProtects services from overload and abuse
Request and response transformationReshapes headers, formats or fieldsLets old and new systems talk without changing either
CachingStores common responses for a short timeReduces load and speeds replies
Load balancing and retriesSpreads traffic and retries failed callsImproves availability
Logging, metrics and tracingRecords every call in one placeGives you a single view of traffic and errors
Version managementRoutes old and new API versions to the right codeLets you change without breaking clients

Not every gateway offers every function, and you rarely need all of them. Choose by the problems you actually have.

How does a request flow through an API gateway?

  1. A client, such as a mobile app or a partner system, sends a request to the gateway's public address.
  2. The gateway checks the caller's credentials and the permissions attached to them.
  3. It applies rate limits and rejects requests that break the rules, with a clear error.
  4. It looks up the route and picks the backend service, optionally balancing between several copies.
  5. It may reshape the request, for example adding headers or converting a format.
  6. The backend does the work and replies.
  7. The gateway may cache or reshape the response, records the call in its logs and returns the reply to the client.

Because every call passes through one place, the gateway is a good spot for logs and traces. It also means the gateway must be reliable, since a failure there affects everything behind it.

Why use an API gateway?

  • Consistent security: one place to enforce authentication, authorization and limits.
  • Simpler clients: apps call one address instead of tracking many services.
  • Freedom to change: you can split, merge or replace backend services without changing client code.
  • Protection: rate limits and request checks keep a single noisy caller from taking the service down.
  • Visibility: one log of all external traffic, which supports debugging and audits.
  • Partner access: you can offer keys, quotas and usage reports to outside developers.

A gateway can also be the right place to expose internal capabilities safely to AI agents, with narrow permissions and logging on every call. See tool calling.

What are real-world uses of an API gateway?

  • A retailer's mobile app, website and partner marketplace all call one public API. The gateway authenticates each, gives each its own limits and routes calls to catalog, cart and order services.
  • A bank-style platform migrates from an old core system to new services one feature at a time. The gateway sends some routes to the old system and some to the new, and clients never notice.
  • A SaaS company offers a public API. The gateway issues keys, enforces plans and shows each customer their usage.
  • A logistics company receives webhooks from carriers. The gateway checks signatures and queues the events for processing.
  • A company with several AI agents puts a gateway between them and internal systems, so every tool call is authenticated, limited and logged in one place.

The migration case is worth remembering. A gateway lets you replace a system without a risky switch-over, a pattern often called the strangler approach in legacy modernization.

What should you design carefully?

Because everything passes through it, the gateway deserves more care than its size suggests. Four concerns come up in almost every design.

Design concerns and what to do
ConcernRiskWhat to do
AvailabilityGateway outage stops all trafficRun several copies across zones, add health checks and test failover
SecurityA weak gateway exposes everything behind itKeep it patched, restrict admin access, validate input and keep secrets in a secrets store
PerformanceHeavy policies slow every callKeep policies short, cache where safe and watch added latency
Change controlA wrong route or policy can break productionKeep config in version control, review changes and roll out gradually

What are the options for an API gateway?

You can use a managed service from your cloud provider, run an open-source product yourself or build a thin layer in your own code. Examples of managed services include Amazon API Gateway, Azure API Management and Google Cloud's API Gateway and Apigee. Open-source and self-hosted options include Kong, Envoy-based gateways, Traefik, NGINX and Tyk. Cloud choice often decides the answer; see AWS vs. Azure.

Choosing an approach
ApproachStrengthsTrade-offs
Managed cloud gatewayLittle to operate, integrates with the cloud's identity and monitoringTies you to one provider, pricing tied to usage
Self-hosted open sourceControl, portability, rich plugin ecosystemsYou run, patch and scale it
Framework or code-based layerSimple for one or two services, no extra productEasy to outgrow; each service may repeat logic
Do nothing yetNo extra moving partFine for a single app, painful once many clients and services appear

When do you not need an API gateway?

A gateway is one more component to run, secure and monitor. For a small product with one backend and one front end, the framework's own authentication and limits are often enough. Adding a gateway early can be needless weight.

  • You have a single application and no outside developers.
  • Your hosting platform already provides routing, limits and certificates.
  • The team is small and cannot yet operate another critical component.
  • Your need is connecting business tools, not exposing APIs; an iPaaS fits better.

Revisit the decision when you add a mobile app, a second service, partner access or compliance requirements that want central logging.

How do you introduce an API gateway?

  1. List your APIs, their callers and the rules each needs.
  2. Decide what belongs in the gateway (identity, limits, routing) and what stays in services (business rules).
  3. Pick a product that fits your cloud, team skills and compliance needs.
  4. Define routes and policies as configuration in a repository, not by hand in a console.
  5. Run it in front of one low-risk API first, in parallel with the old path.
  6. Add logging, metrics and alerts for errors, latency and limit hits.
  7. Move traffic over gradually, using a canary release if the gateway supports weighted routing.
  8. Document how to onboard a new API or a new client.

Treat gateway configuration as code, using infrastructure as code, so changes are reviewed, tested and reversible.

What mistakes should you avoid?

  • Putting business logic in the gateway, which turns it into a hidden monolith.
  • Making it a single point of failure, with no redundancy or health checks.
  • Relying only on the gateway for security. Services should still verify identity and permissions.
  • Setting rate limits without watching real traffic, which blocks legitimate users.
  • Editing routes by hand in production with no record of who changed what.
  • Forgetting to monitor latency added by the gateway itself.

How do you know the gateway is working?

Watch it as both a security control and a piece of infrastructure. Healthy signs are steady error rates, few legitimate requests rejected, quick routing and clear logs for any incident.

  • Error rates by route and by caller.
  • Added latency at the gateway compared with calling a service directly.
  • Rate-limit and authentication rejections, reviewed for false positives.
  • Traffic by API version, which tells you when old versions can retire.
  • Time to onboard a new service or partner.

These feed your service level objectives and your wider observability.

What does an API gateway mean for cost and timeline?

Effort depends on how many APIs sit behind it, the policies you need, your identity setup, where it runs and how much monitoring you want. Managed services charge by usage; self-hosting trades that for operating effort.

Planning one is part of cloud and integration work. See cloud and DevOps cost, API integration cost and the free estimate.

How StackLift approaches API gateways

StackLift treats the gateway as part of the architecture, scoped by an architect before building. Policies live in the repository, changes go through review and CI/CD, and observability and rollback are in the plan from sprint one. Agents work on feature branches, and engineers own the decisions.

For related work, see enterprise SaaS builds and legacy modernization, where a gateway often lets you replace a system piece by piece.

Questions people ask

Is an API gateway a security product?

It is a security control among others. It centralizes authentication, limits and logging, which helps a great deal, but it does not replace secure code, permission checks inside services or a security review. Treat it as one layer in a defense with several.

How is an API gateway different from a web application firewall?

A web application firewall looks for known attack patterns in web traffic. A gateway applies API rules such as who may call what and how often. They work well together, and some products include both.

Is an API gateway the same as a reverse proxy?

A gateway builds on the reverse proxy idea and adds API-specific features such as key management, per-caller limits and transformation. Some reverse proxies can act as gateways with plugins.

Do I need an API gateway for microservices?

Usually, or something that does the same job. Without one, each service repeats authentication and limits and clients need to know every address.

Does a gateway improve performance?

It can, through caching and connection reuse. It also adds a hop, so measure the added latency and keep policies lean.

Can an API gateway handle authentication for me?

It can verify tokens and keys and enforce coarse permissions. Services should still check fine-grained permissions on the data itself.

What is the difference between an API gateway and API management?

The gateway handles live traffic. API management adds the surrounding product: a developer portal, key issuing, analytics and lifecycle tools.

Can I use an API gateway in front of AI models?

Yes. Teams put one in front of model providers to centralize keys, limits and logging, and to switch models without changing apps. See model routing.

Where does the gateway run?

As a managed cloud service, as containers in your cluster or on virtual machines. Place it close to the services it fronts and make it redundant.

Sources

Sources and further reading

The standards, rules, research and official documentation this page draws on.