Cover illustration for “Web API Protocols REST GraphQL and Webhooks Compared”

Web API Protocols REST GraphQL and Webhooks Compared

Each protocol solves a different problem: REST fetches resources, GraphQL requests specific fields.

Senior Writer · · 7 min read

Every "REST vs. GraphQL vs. Webhooks" debate starts from a broken premise: that these three things are competing for the same job. They're not. Each one answers a different question about how a client and a server talk to each other, and that difference affects which protocol will work well for a given use case, regardless of what benchmarks show.

REST answers: give this resource, right now, in a shape already decided on. GraphQL answers: give exactly these fields, from however many resources are needed, in one trip. Webhooks answer something else entirely: notify when something happens, because the caller should not have to keep asking.

Picking the wrong protocol produces an architecture that fights you at every layer. Picking the right one means asking what problem you actually have, not which protocol appears first on a "top API technologies" list.

REST as the default substrate for public APIs

REST traces back to Roy Fielding's doctoral dissertation in 2000, and it mapped so cleanly onto HTTP that it basically became HTTP's native dialect. GET, POST, PUT, PATCH, DELETE: the verbs already existed, REST just gave them a job description. An API becomes a collection of named resources sitting at predictable URLs, and the server decides what shape it hands back for each one.

That decision is why REST won the infrastructure lottery. Browser caches, CDNs, and reverse proxies all understand GET requests natively. Nobody had to teach the internet how to cache a REST call, because the internet was built to cache exactly that kind of call. Redirects, standardized error codes, and decades of tooling all came free, bundled with HTTP itself.

There's a more practical reason REST stuck around too. Every language on earth has an HTTP library, and a junior developer can look at GET /users/123/orders and know what it does without reading a spec. That readability is why REST shows up in an estimated 89% of enterprise environments and roughly 83% of public APIs, with a large share of Fortune 1000 companies running REST somewhere in production. REST didn't win because it's clever. It won because it's legible.

How REST's fixed endpoints cause performance problems

Legible doesn't mean efficient. A REST endpoint returns a fixed shape, full stop. If a mobile client needs two fields out of twenty, it still downloads all twenty and discards eighteen. That's over-fetching, and it happens on every single call, quietly burning bandwidth nobody budgeted for.

Under-fetching is the mirror issue. Rarely does one endpoint contain everything a complex screen needs, so the client ends up chaining calls: GET /users/123, then GET /users/123/posts, then a separate GET /posts/{id}/comments for every post in the list. A dashboard rebuild documented in one benchmark required the mobile app to make 8 to 9 round trips to render one screen, with bandwidth starting at 12 KB per screen load before optimization. That's REST behaving exactly as designed, and the design doesn't scale to relational, multi-resource views.

The bandwidth cost is measurable. In that same benchmark, a REST call returning a mobile user profile transferred 4.2 KB. The equivalent GraphQL query, returning only the fields actually requested, transferred 1.8 KB. That's a 57% reduction, and on a slow connection or a battery-conscious app, that difference is significant.

Where GraphQL outperforms REST

Diagram: REST vs. GraphQL: Latency, Bandwidth, and Round-Trips by Scenario. Visualizes: Show a side-by-side comparison of REST and GraphQL across three concrete measured outcomes: (1) bandwidth — REST mobile profile call: 4.2 KB vs.

GraphQL started inside Facebook in 2012 and went public in 2015. It now lives under the GraphQL Foundation, with the latest stable spec published in September 2025, replacing the one from October 2021. The mechanism is straightforward: one endpoint, and the client sends a query describing exactly which fields and relationships it wants. The server responds with exactly that shape, no extra fields included.

That simplicity comes from a strongly typed schema, written in GraphQL's schema definition language and enforced at runtime. Every query gets validated against it, and clients can introspect the schema to see what's actually available, which beats REST's usual arrangement of an OpenAPI doc that was accurate as of some sprint eighteen months ago.

In a benchmark pulling a user plus their projects plus their tasks, REST needed three separate requests (85ms, 95ms, and 70ms) for a median of 250ms. GraphQL did it in one query at a median of 180ms, a 28% latency advantage. That gap shows up specifically when a client needs data spread across multiple related resources. Asking GraphQL for one simple resource adds roughly 20ms of overhead compared to REST. Throughput tells a similar story: REST handled around 20,000 simple requests where GraphQL managed about 15,000 complex queries. GraphQL is faster at a specific kind of problem and slower at the kind REST was built for.

GraphQL's real operational costs

The tradeoff nobody puts on the conference slide is caching. REST's GET requests get cached automatically, everywhere, by default. GraphQL queries typically travel as POST requests, which bypass standard HTTP caches. Tools exist to compensate, like Apollo Client's normalized cache or a Redis layer sitting in front of resolvers, but someone has to build and maintain that caching layer deliberately.

Then there's the N+1 problem. Without batching through something like DataLoader, a GraphQL resolver can fire off a separate database query for every single item in a list. Asking for a list of users and their posts without batching results in one query per user plus the original, multiplying database load quickly. REST's flat, fixed-endpoint model doesn't create that particular trap.

Security gets trickier too. Rate-limiting a REST endpoint is a known, mostly solved problem. GraphQL's flexibility means a deeply nested or recursively structured query can become a denial-of-service vector if nobody's enforcing query controls. Shopify's calculated query cost model is a well-known approach for handling this, and it requires deliberate query controls, not just a firewall rule.

None of this makes GraphQL a bad choice. It makes GraphQL a choice with maintenance obligations attached: schema changes need review, resolvers need optimization discipline, and someone on the team needs to understand the tradeoffs. Worth it when the query flexibility solves a real problem, and unnecessary overhead when it doesn't.

Webhooks versus Polling: the core difference

Jeff Lindsay coined the word "webhook" back in 2007. A webhook is a user-defined HTTP callback triggered by an event: when something happens, a payment clears, code gets pushed, or a form gets submitted, the source system fires an HTTP POST to a URL the receiver configured ahead of time. Nobody asks; the server notifies. Webhooks are sometimes called a "reverse API" because instead of a client pulling data, the server pushes it exactly when there's something worth pushing.

Consider the alternative. Without webhooks, a client has to poll: hit the same REST endpoint repeatedly, asking whether anything changed. Every poll costs a request on both ends, and the gap between polls creates built-in latency. Poll every 30 seconds, and the slowest a client ever learns about a change is 30 seconds late, and most of those requests return nothing new. Webhooks eliminate that overhead entirely.

Webhook security & reliability in practice

Webhooks eliminate polling overhead, but they open a security surface most comparisons skip. A webhook is an automated pipe carrying data between two systems, and it usually operates outside the authentication flow a human user would go through. Compromise that pipe, and it becomes a route for moving sensitive data that doesn't appear on dashboards built for tracking user logins and API keys.

The visibility gap is significant. The average enterprise runs something like 47 active webhook endpoints, but security teams can typically account for only about 23% of them. No amount of firewall configuration fixes a blind spot of that size.

Payload signing is the non-negotiable baseline. Every major webhook provider, including Stripe, GitHub, Shopify, Twilio, and Slack, signs their payloads using an HMAC scheme with a shared secret, though the exact algorithm varies by provider. The pattern is consistent: the sender computes an HMAC of the request body, drops the signature in a header, and the receiver recomputes it and checks for a match. As of 2026, passing a bare token in the URL is a known vulnerability.

Reliability follows one simple rule: acknowledge fast, process slow. Return a 202 Accepted the moment the payload arrives, then hand it off to a background queue for the actual work. That pattern keeps the sender from timing out and prevents a slow database write from taking the whole integration down with it.

Choosing the right protocol for your scenario

The right question isn't which protocol is "best." Ask instead: who initiates the exchange, and how often does the shape of the data change?

  • Client initiates, the data shape is stable, and third parties consume it: REST.

  • Client initiates, but different consumers need different shapes from the same underlying data: GraphQL.

  • The server needs to notify the client the moment something happens, and polling is the only other option on the table: Webhooks.

REST is the right call for a public API meant for outside developers, where tooling universality beats query flexibility. It's also the right call for straightforward CRUD work with predictable response shapes, for anything where CDN caching drives performance like product catalogs and public content feeds, and for teams where readability matters more than optimization.

GraphQL earns its complexity when multiple frontends, including web, mobile, and desktop, all need different slices of the same backend data. It earns it when mobile bandwidth is a hard constraint, since that 57% bandwidth reduction for field-subset queries and 28% latency advantage on complex multi-resource queries are measured outcomes. And it earns it when the data is genuinely relational and REST's round-trip count has crept up to eight or nine calls for a single screen.

None of this is ideology. It's arithmetic: query latency, bandwidth costs, and round-trip counts weighed against what the team can actually maintain. A buyer asking about API architecture doesn't want a philosophy. They want to know which protocol fits their specific case and why, backed by numbers. The right answer names the scenario, names the protocol that fits it, and lets the benchmark do the talking.

Sources

  1. GraphQL vs REST: Choosing the Right API Architecture in 2026
  2. Types of APIs Explained: REST, GraphQL, gRPC, SOAP, WebSocket, and More (2026)
  3. tech-insider.org
Filed underweb API

More in web API