Introduction

Amazon API Gateway offers two principal types of API, the REST API and the HTTP API. Both accept requests and route them to a backend, but they differ in features, cost, and latency. Latency is the delay between a request being made and a response being produced. This guide compares the two types and explains when each should be chosen. A general overview is provided in the guide on Amazon API Gateway.

What is being compared?

A REST API provides the fuller set of features, including request and response validation, response caching, usage plans, and API keys. An HTTP API provides a smaller set of features at lower cost and lower latency. Both serve as the entry point to an application without a server being managed, and both can route requests to Lambda functions and to other backends.

Why the choice matters

The type that is chosen affects the cost of each request, the latency that is added, and the features that are available. A high-volume API for which the additional features are not required can be made cheaper and faster by using an HTTP API, while an API that needs fine control over each request may require a REST API.

How each works

Both types receive a request, apply any configured authorization, and forward the request to a backend, then return the response. A REST API can additionally validate the request against a defined shape, cache responses so that repeated requests are served quickly, and apply usage plans that limit how much a client may call the API. An HTTP API applies a streamlined set of steps, which reduces both cost and latency, and it supports authorizers based on JSON Web Tokens.

Comparison diagram

REST API HTTP API Features fuller set streamlined subset Request supported limited validation Response caching supported not available Usage plans / supported not available API keys Cost per request higher lower Latency higher lower

Where a REST API is stronger

Where an HTTP API is stronger

When to choose each

Best practices

Common mistakes

Further reading in this library

Frequently Asked Questions

What is the main difference between a REST API and an HTTP API?
A REST API provides the fuller set of features, including request validation, response caching, usage plans, and API keys. An HTTP API provides a smaller set at lower cost and latency. The HTTP API should be chosen when its features are sufficient.
Which is cheaper?
An HTTP API is generally less expensive per request. For a high volume of simple requests, it can reduce cost significantly.
Which has lower latency?
An HTTP API is designed to be lighter and generally adds less latency, because it applies fewer features to each request.
What features are unique to a REST API?
Request and response validation, response caching, usage plans and API keys, and a wider range of integration types.
Which should be the default choice?
An HTTP API should be the default for new APIs, because it is cheaper and faster. A REST API should be selected when a feature that only it provides is required.
AWS Serverless Architecture Handbook cover
Go deeper ยท Book as a Service™
AWS Serverless Architecture Handbook

This article is the summary. The book is the full, continuously updated reference: API design, authorization, caching, and complete serverless architectures on AWS.

View the book