The short answer
REST organizes an API around resources, each at its own URL, such as /orders/42, using standard HTTP methods. GraphQL exposes one endpoint where the client asks for exactly the fields it needs in a typed query. REST is simpler, caches easily and suits most apps and public APIs. GraphQL shines when many different screens or clients need different shapes of related data, at the cost of more setup and harder caching.
Key points
- REST: many URLs, one per resource, standard HTTP caching.
- GraphQL: one endpoint, the client chooses the fields.
- REST is the simpler default for most products.
- GraphQL helps when many clients need different data shapes.
- Either works. Consistency and good docs matter more.
How each works
In REST, each kind of thing has its own address. GET /customers/7 returns a customer; GET /customers/7/orders returns their orders; POST /orders creates one. The server decides what each response contains.
In GraphQL, a schema describes every type and how they connect. The client sends a query naming the fields it wants, for example a customer’s name and their last three orders with totals, and gets exactly that back in one request. GraphQL was developed at Facebook and released publicly in 2015; it is now looked after by the GraphQL Foundation.
Side by side
| REST | GraphQL | |
|---|---|---|
| Endpoints | Many, one per resource | Usually one |
| Who shapes the response | The server | The client, within the schema |
| Over- and under-fetching | Common: extra fields, or several calls | Avoided by design |
| Caching | Standard HTTP and CDN caching | Needs client or custom caching |
| Types and docs | Optional, often via OpenAPI | Built in through the schema |
| Learning curve | Low | Higher, on both server and client |
| Risks | Version sprawl | Expensive queries, needs depth and cost limits |
How to choose
- Choose REST for most MVPs, internal tools, public APIs and webhooks.
- Choose GraphQL when web, mobile and partner clients each need different slices of richly connected data.
- Choose GraphQL when one screen otherwise needs many REST calls, which hurts on slow mobile networks.
- Stay with what your team knows well. A clean REST API beats a messy GraphQL one.
Whichever you pick, document it, check permissions on every field or route, and add rate limits. For server-to-server notifications, see API vs webhook. APIs for web and mobile apps are part of our web app development work.
Sources
Checked when this guide was written.