← All tutorials
REST Β· GraphQL Β· gRPC

REST vs GraphQL vs gRPC β€” which API style?

All three let a client and a server talk over the network β€” they just disagree on how. REST exposes resources over plain HTTP; GraphQL lets the client ask for exactly the data it wants from one endpoint; gRPC makes fast, typed, binary remote-procedure calls between services.

Resources over HTTP

🌐 REST

Simple, universal, cacheable. The default for public web APIs.

Ask for what you need

πŸ”· GraphQL

One endpoint, a typed query β€” no over- or under-fetching.

Fast typed RPC

⚑ gRPC

Binary Protobuf over HTTP/2 with streaming. Built for microservices.

One line each. REST: "GET this resource." GraphQL: "here's exactly the shape of data I want." gRPC: "call this function on that service, fast."

At a glance  The request, three ways

Fetching a user and their orders looks different in each β€” and that difference is the whole story:

How REST, GraphQL and gRPC fetch data REST makes several round trips to multiple endpoints. GraphQL sends one query to one endpoint and gets exactly the requested fields. gRPC makes a fast binary RPC call over HTTP/2, with streaming. REST GraphQL gRPC client server GET /user GET /orders 3 round trips client server 1 query exact fields 1 endpoint service A service B Protobuf HTTP/2 streaming

REST's multiple round trips and fixed responses (over-fetching) are exactly what GraphQL set out to fix; gRPC instead optimizes for raw speed and typed contracts between services.

Style 1  REST

REST Representational State Transfer Β· JSON over HTTP

Solves Simple, universal client-server APIs. Model your domain as resources with URLs (/users/1) and act on them with HTTP verbs (GET/POST/PUT/DELETE). It's stateless, human-readable JSON, works with every language and browser, and gets HTTP caching for free.

Limits Fixed endpoints cause over-fetching (you get fields you don't need) and under-fetching (you make several calls to assemble one screen). No enforced schema unless you add OpenAPI; versioning (/v2/) and evolving responses can get messy.

Choose Public APIs, CRUD services, and anything valuing simplicity, broad tooling, and HTTP caching.

Style 2  GraphQL

GraphQL query language for APIs Β· one endpoint, typed schema

Solves Over- and under-fetching. The client sends a query to a single endpoint describing exactly the fields and nested relations it wants, and gets back that shape β€” in one request. A strongly-typed schema documents the whole API, and one graph can aggregate several backend sources.

Limits More server complexity; HTTP caching is harder (one endpoint, usually POST). It's prone to the N+1 query problem, and arbitrary client queries create cost/security concerns (deep or expensive queries need depth-limiting and rate control). File uploads and simple cases can feel heavyweight.

Choose Rich, nested data; many clients with different needs (web + mobile); aggregating multiple services; when eliminating over/under-fetching matters.

Style 3  gRPC

gRPC RPC framework Β· Protocol Buffers over HTTP/2

Solves Fast, strongly-typed service-to-service communication. You define the service contract-first in a .proto file; gRPC generates typed clients/servers in many languages, serializes with compact binary Protobuf, runs over HTTP/2, and supports streaming (client, server, and bidirectional) as a first-class feature.

Limits Not natively callable from browsers (needs gRPC-Web + a proxy). The binary payloads aren't human-readable, tooling/debugging has a learning curve, and it's overkill for simple public CRUD APIs.

Choose Internal microservices, low-latency / high-throughput links, streaming, and polyglot systems that want one typed contract.

Concretely  Same data, three styles

Fetch a user and their orders. Switch tabs; hit Copy.

get a user + their orders
# REST: one resource per endpoint β€” often several round trips.
GET /users/1              # β†’ { id, name, email, address, ... } (may over-fetch)
GET /users/1/orders       # β†’ [ { id, total, ... }, ... ]  (a second call)

# JSON, cacheable via standard HTTP caching. No enforced schema by default.

Side by side

AspectRESTGraphQLgRPC
ModelResources + HTTP verbsOne endpoint, typed queriesRemote procedure calls
PayloadJSON (text)JSON (text)Protobuf (binary)
TransportHTTP/1.1 (usually)HTTPHTTP/2
ContractOptional (OpenAPI)Required schemaRequired .proto
FetchingFixed per endpoint (over/under-fetch)Client picks exact fieldsMethod call
StreamingBolt-on (SSE/WebSocket)SubscriptionsFirst-class, bidirectional
PerformanceGoodGoodBest (binary + HTTP/2)
BrowserNativeNativeNeeds gRPC-Web + proxy
CachingEasy (HTTP)HarderCustom
Best forPublic / CRUD APIsComplex, nested, many clientsInternal microservices

When to choose which

If you…Reach for…
Build a public API valuing simplicity & cachingREST
Do straightforward CRUD with broad client supportREST
Serve many clients needing different slices of nested dataGraphQL
Want to kill over/under-fetching & aggregate sourcesGraphQL
Connect internal microservices with low latencygRPC
Need streaming or a typed polyglot contractgRPC
They coexist. A very common architecture: gRPC between internal services for speed, with a REST or GraphQL gateway at the edge for browsers and third parties. Pick per boundary, not once for everything.

Cheat sheet

QuestionShort answer
One-liner for each?REST = resources over HTTP; GraphQL = ask for exact data; gRPC = fast typed RPC.
What problem did GraphQL fix in REST?Over- and under-fetching (and multiple round trips).
Why is gRPC fast?Binary Protobuf over HTTP/2, with streaming.
Which struggles in the browser?gRPC β€” needs gRPC-Web + a proxy.
Which caches most easily?REST, via standard HTTP caching.
Must I pick just one?No β€” gRPC internally, REST/GraphQL at the edge is common.

Knowledge check

Six questions on REST, GraphQL and gRPC. Pick an answer for each, then check your score.

1. What problem does GraphQL primarily address in REST APIs?

2. Why is gRPC especially fast?

3. Which style gets HTTP caching most easily?

4. Which needs gRPC-Web and a proxy to work in browsers?

5. You have many clients (web + mobile) that each need different slices of nested data. Best fit?

6. Fast internal microservice-to-microservice calls with streaming. Best fit?

Next steps

πŸ”Œ APIs vs MCP

APIs meet AI β€” how these API styles get exposed to agents via MCP.

πŸ”— n8n automation

Call any API β€” the HTTP node wires REST/GraphQL endpoints into workflows.

☁️ AWS services

API Gateway & more β€” where these APIs run in the cloud.

πŸ›‘οΈ Web Β· API Β· AI Security

Secure your APIs β€” auth, authz, rate limits, validation and the AI attack surface.

πŸ““ All tutorials

The hub β€” LLMs, embeddings, agents, protocols & more.