REST vs GraphQL: choosing an API style for your app

How REST and GraphQL APIs differ, the strengths and pitfalls of each, and practical guidance on which fits your web or mobile project.

By the UK Technology Hub teamPublished 3 minute read

The short answer

REST APIs expose resources at fixed URLs and are simple, widely understood and easy to cache. GraphQL exposes a single endpoint where clients request exactly the data they need, which suits complex apps with many screens and data relationships. REST is a strong default for most APIs; GraphQL shines when many different clients need flexible data, but it needs careful attention to performance and security.

APIs connect your apps to data and services. The two most common styles for web and mobile apps are REST and GraphQL. Both work well; the right choice depends on your data, clients and team. If you're new to APIs, start with our guide to APIs explained.

REST in a nutshell

REST organises an API around resources, each with its own URL:

  • GET /products lists products.
  • GET /products/42 gets one product.
  • POST /orders creates an order.

It uses standard HTTP methods and status codes, and responses are usually JSON.

GraphQL in a nutshell

GraphQL, originally developed at Meta, uses a single endpoint. Clients send a query describing exactly the fields they want, including related data, and receive a response matching that shape. A schema defines all available types and operations.

Comparison

RESTGraphQL
EndpointsMany, one per resourceUsually one
Data returnedFixed by the endpointExactly what the client asks for
Related dataMultiple requests or custom endpointsOne query
CachingSimple with standard HTTP cachingNeeds client or server caching tools
VersioningOften versioned URLsSchema evolves; fields deprecated
ToolingUniversalStrong, with schema introspection
Learning curveLowModerate
Error handlingHTTP status codesErrors in the response body

Where REST works best

  • Public APIs used by many third parties.
  • Simple CRUD applications.
  • Services where HTTP caching and CDNs matter.
  • Teams that want simplicity and broad familiarity.
  • File uploads and downloads.

Where GraphQL works best

  • Apps with many screens needing different combinations of data.
  • Mobile apps where reducing requests and payload size matters.
  • Products combining data from several services behind one API.
  • Fast-moving front-end teams that want to change data needs without backend changes.

Common pitfalls

REST: over-fetching (getting more data than needed), under-fetching (needing many requests) and endpoint sprawl.

GraphQL:

  • Performance: naive resolvers can trigger many database queries. Batching and caching are essential.
  • Expensive queries: clients can request deeply nested data. Use depth limits, cost analysis or approved queries.
  • Caching: less straightforward than REST.
  • Authorisation: must be enforced per field and type, not just per endpoint.

Security for both

  • Authenticate every request.
  • Authorise access to each resource or field.
  • Validate input.
  • Rate-limit requests.
  • Log and monitor unusual activity.

Performance and the database

API performance depends heavily on database design and indexing. Our comparison of SQL and NoSQL databases covers the data side.

Other options

  • tRPC for TypeScript projects where front end and back end share types.
  • gRPC for fast service-to-service communication.
  • Webhooks for pushing events to other systems; see our guide to webhooks.

Can you use both?

Yes. Many organisations offer REST for public integrations and GraphQL for their own apps, or use GraphQL as a layer combining several REST services.

Our recommendation

Start with REST for most projects: it's simple, well understood and easy to secure and cache. Consider GraphQL when you have many clients with varied data needs, or complex related data that would otherwise require many REST calls.

Documentation and developer experience

Whichever style you choose, good documentation makes or breaks an API. REST APIs commonly use OpenAPI specifications, which generate documentation, client code and tests. GraphQL schemas are self-describing, and tools let developers explore queries interactively. Keep examples realistic and document errors, limits and authentication clearly.

Versioning and change management

APIs change over time. REST APIs often add a version number in the URL or header when making breaking changes. GraphQL APIs typically evolve a single schema, marking old fields as deprecated before removing them. In both cases, communicate changes early and give clients time to update.

Monitoring APIs

Track response times, error rates and usage by endpoint or query. Monitoring shows which parts of your API are slow or failing, and which clients use them most, guiding where to optimise.

Good API design, whichever style you choose, comes from understanding what clients actually need.

How we help

Our web app development team designs and builds REST and GraphQL APIs. Our app development service plans APIs that serve web and mobile clients, and our mobile app team optimises data fetching for fast app experiences.

Frequently asked questions

Is GraphQL replacing REST?

No. Both are widely used. GraphQL is popular for complex front ends; REST remains the default for many APIs.

Is GraphQL faster than REST?

It can reduce the number of requests and data transferred, but poorly designed resolvers can make it slower.

Which is easier to secure?

REST is generally simpler to secure. GraphQL needs extra controls for query depth, cost and field-level authorisation.

This guide is general information, not legal, tax or financial advice, and details such as prices, features and rules can change. Product and company names mentioned are trademarks of their respective owners and are used only to identify those products; UK Technology Hub is not affiliated with or endorsed by them.

Related guides

All comparisons guides