Back to all posts
Backend7 min read·November 8, 2026

What Is an API Gateway and When Do You Need One?

TB
ThynkBlox Team
Engineering

An API gateway is a single entry point that sits between your clients (web app, mobile app, partner systems) and your backend services. It receives every incoming request, decides which service should handle it, and applies shared rules such as authentication and rate limiting before the request gets through. You need one when several services or several types of client would otherwise each repeat those rules. If you have one application with one backend, a gateway often adds cost and moving parts without much benefit.

What does an API gateway actually do?

Think of the gateway as the reception desk for your backend. Clients talk only to the gateway. The gateway knows where each request should go and checks it on the way in.

Most gateways handle a common set of jobs:

ResponsibilityWhat it means in practiceWhy it helps
RoutingSends each request to the right backend service based on its path, method or other detailsClients use one address, however many services sit behind it
AuthenticationChecks that the caller is who they say they are before passing the request onIdentity checks live in one place, not in every service
Rate limitingLimits how many requests a caller can make in a given periodProtects services from overload and abuse
Request and response shapingChanges headers, combines responses or translates formatsLets backend services change without breaking clients
Logging and monitoringRecords traffic, errors and response times at the front doorGives one view of how the API is being used
TLS terminationHandles encrypted connections from clientsSimplifies certificate management

Not every gateway does all of these, and you do not have to switch them all on. The core value is putting shared, cross-cutting concerns in one layer.

What does an architecture look like with and without a gateway?

Here is a simplified sketch of a product with three backend services: users, orders and payments.

Without a gateway, each client calls each service directly:

`

Web app ─────┬──────────► Users service (own auth, own limits)

├──────────► Orders service (own auth, own limits)

Mobile app ──┼──────────► Payments service (own auth, own limits)

│

Partner ─────┘

`

Every client must know every service address. Every service must check identity, enforce limits and log traffic on its own. If you split or rename a service, every client may need updating.

With a gateway, clients call one entry point:

`

Web app ─────┐ ┌──► Users service

│ ┌─────────────┐ │

Mobile app ──┼──► │ API gateway │ ──┼──► Orders service

│ │ route, auth,│ │

Partner ─────┘ │ rate limit │ └──► Payments service

└─────────────┘

`

Clients know one address. Shared rules run once at the gateway. Services can focus on business logic, though they should still check what a caller is allowed to do with the data they own.

How does routing work through a gateway?

The gateway holds a set of rules that map incoming requests to backend services. A request for order details goes to the orders service; a request to update a profile goes to the users service.

This matters most when your backend is split into several services, a pattern covered in microservices vs monolithic architecture. Routing lets you move a feature from one service to another, or run a new version alongside an old one, without the client noticing. It also lets you hide internal services that should never be called from outside.

How does a gateway handle authentication?

The gateway checks credentials, such as a token or an API key, on every request. Invalid requests are rejected before they reach any service. Valid requests are passed on, usually with the caller's verified identity attached.

Two points are worth getting right:

  • Authentication is not authorization. The gateway can confirm who is calling. Whether that caller may see a specific invoice or edit a specific record is usually best decided by the service that owns the data. The difference is explained in authentication vs authorization.
  • Backend services should not trust everything. If services can be reached without going through the gateway, the central check can be bypassed. Make sure internal services only accept traffic from the gateway or verify identity themselves.

For partner integrations, the choice between keys and delegated access is covered in API key vs OAuth for integrations.

How does rate limiting at the gateway work?

The gateway counts requests per caller (by key, user, account or network address) and rejects or delays requests once a limit is reached. The caller typically receives a response telling them to slow down and when to try again.

Rate limiting at the gateway protects your services from a single misbehaving client, runaway scripts and some kinds of abuse. It also lets you offer different limits to different plans or partners. If you are on the other side of the relationship, calling someone else's limited API, see how to handle API rate limits.

Set limits based on what your services can actually handle and how your customers use the product, then review them as usage changes. Limits copied from another product rarely fit.

When does an API gateway only add complexity?

A gateway is another component to deploy, monitor, secure and pay for. It can also become a single point of failure and add a small delay to every request. It earns its place when it removes more repetition than it introduces.

You may not need a gateway yet if:

  • You have one backend application. A well-structured monolith can handle authentication and rate limiting in its own middleware with less overhead.
  • You have one client and no external consumers. With a single web app talking to a single backend, there is little to unify.
  • Your hosting platform already provides the basics. Many load balancers and managed platforms offer routing, TLS and simple rate limiting.
  • Your team is small and the product is early. Every extra layer slows down debugging and onboarding. Adding a gateway later is usually easier than taking one out.

A gateway starts to make sense when you have several services, several types of client, public or partner APIs, or a need for consistent policies across teams.

What common mistakes should you avoid?

Putting business logic in the gateway. Pricing rules, order validation and workflows belong in services. A gateway full of business logic becomes a hidden monolith that is hard to test and change.

Treating the gateway as the only security layer. Keep authorization checks in services and block direct access to internal services.

Ignoring availability. If the gateway goes down, everything behind it is unreachable. Plan for redundancy and monitor it like any critical service.

Adding a gateway because large companies use one. Choose it for a problem you have now or expect soon, and record the reasoning in an architecture decision record.

Locking yourself to one product without thinking. Gateway configuration can be hard to move. Keep rules documented and, where practical, portable.

Quick checklist: do you need an API gateway?

  • More than one backend service that clients call directly
  • More than one type of client, such as web, mobile and partners
  • Authentication or rate limiting repeated across services
  • A public or partner API that needs keys, limits and usage tracking
  • A plan to split, rename or version services without breaking clients

If you tick two or more, a gateway is worth discussing with your development team. If you tick none, you can probably wait.

Frequently asked questions

Is an API gateway the same as a load balancer?

No. A load balancer spreads traffic across copies of the same service. A gateway decides which service a request belongs to and applies policies such as authentication and rate limiting. Many setups use both, and some products overlap.

Do I need a gateway for microservices?

Not always, but it is common. Without one, clients must know about every service and each service repeats shared checks. With a handful of services and multiple clients, a gateway usually simplifies things.

Does a gateway slow down my API?

It adds an extra step to each request, which adds some delay. For most products this is small compared with database and network time, but measure it under realistic load rather than assuming.

Can I add a gateway later?

Yes. Starting without one is reasonable for an early product. If clients already use a single domain for your API, introducing a gateway behind that address later is usually manageable.


*Unsure whether your architecture needs an API gateway? Start a conversation →*

Ready to build?

Let's turn these ideas into your next product.

Start your project