REST vs HTTP vs WebSocket APIs

API Gateway has three flavors. Here's how to pick one in ten seconds.

1 min read
TypeChoose it whenNotes
HTTP APIYou want a simple, fast, low-cost API in front of Lambda or another HTTP service.The usual default for new projects. Built-in JWT auth and simple CORS.
REST APIYou need advanced features: API keys and usage plans, request validation, response caching, AWS WAF, or private APIs.Older, more features, higher price per request.
WebSocket APIYou need two-way, real-time messages, like chat or live dashboards.Keeps a connection open, and the server can push to clients.
Tip

Start with an HTTP API. Reach for a REST API only when you hit a feature you actually need, such as usage plans for a paid public API.

Words you'll see

  • Route: a method + path, e.g. GET /notes/{id}.
  • Integration: what a route forwards to, usually a Lambda function.
  • Stage: a named deployment, e.g. dev or prod. HTTP APIs come with an auto-deploying $default stage.
  • Path parameter: the {id} part of the path, delivered to your code.

Key takeaways

  • HTTP API is the simple, cheaper default.
  • REST API adds advanced features like usage plans, caching, and request validation.
  • WebSocket API is for real-time two-way messaging.

Check your understanding

Pick an answer to see the explanation.

  1. 1. You're building a live chat app where the server pushes messages to users. Which type fits?

  2. 2. You need API keys and per-customer usage plans for a public API. Which type?