Skip to main content

What is an API Gateway?

An API Gateway is the central entry point for all requests to a microservices system. It accepts requests from clients and routes them to the needed services, hiding the internal structure of the system.


The main tasks of an API Gateway:

  1. Routing - directs requests to the needed microservices (for example, /users → the users service, /orders → the orders service).
  2. Authentication and security - checks tokens and access rights, and filters unwanted requests.
  3. Data aggregation - combines responses from several services into one (for example, a profile plus orders).
  4. Caching and load balancing - reduces the load on the microservices and distributes traffic evenly.
  5. Logging and monitoring - collects statistics and request metrics.

Example

A client application does not talk to a dozen different APIs, only to a single address: gateway.example.com. The gateway itself decides where to send the request and how to assemble the response.


Summary:

An API Gateway is a "facade" for a microservices system that simplifies access to many services, increases security, and allows traffic to be managed centrally.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.