Prerequisites
What it is
An API gateway is the entry point for client requests. It routes requests to backend services and often handles cross-cutting concerns such as authentication, rate limiting, request validation, API versioning, and response shaping.
Why it matters
It keeps every backend service from reimplementing the same public API rules. Product teams can change internal service boundaries while clients keep calling stable endpoints.
How it works
The gateway inspects method, path, headers, identity, and sometimes request body. It applies policy, chooses a backend route, forwards the request, and returns the response with standard headers and errors.
When to use it
Use it for public APIs, mobile backends, multi-service products, and platforms with different customer tiers or API versions.
Tradeoffs / failure modes
A gateway can become a bottleneck or a dumping ground for business logic. Keep it focused on platform policy, routing, and protocol translation.
Tiny example
POST /v1/chat/completions hits a gateway that authenticates the API key, checks token limits, and routes the request to a model-serving service.
Related guides and systems
See API Versioning, Rate Limiting, OAuth2 & Social Login, ChatGPT, Slack, GitHub, and Gmail.
Seen in deeper dives
Capability
API Versioning
Backward-compatible API evolution with URL, header, and content negotiation strategies
Capability
OAuth2 & Social Login
Authorization code flow, token refresh, and provider federation for third-party authentication
Capability
Rate Limiting & Throttling
Token bucket, sliding window, and distributed rate limiting to protect your APIs
Case Study
ChatGPT
Serving large language model inference to hundreds of millions of users
Case Study
GitHub
The world's largest code hosting platform powered by Git at scale
Case Study
Gmail
The world's largest email service with AI-powered organization and search
Case Study
Slack
Channel-based messaging for the enterprise workplace
Related concepts
Rate Limiting
Control request volume so shared systems stay fair, stable, and protected.
Idempotency
Make repeated requests safe so retries do not create duplicate side effects.
JWT
A signed JSON token that carries claims between systems.