Definition: Query language for APIs that allows clients to request exactly the data they need, reducing over-fetching and under-fetching.
— Source: NERVICO, Product Development Consultancy
What is GraphQL
GraphQL is a query language for APIs and a runtime for fulfilling those queries, originally developed by Facebook in 2012 and released as open source in 2015. Unlike REST, where each endpoint returns a fixed data structure, GraphQL allows clients to specify exactly which fields they need in a single request.
How it works
The server defines a schema that describes all available data types and their relationships. Clients send queries specifying the exact shape of the data they need. The server resolves the query using functions called resolvers, which fetch data from the corresponding sources (databases, external services, cache). Mutations allow data modification, and subscriptions enable real-time communication. Everything is exposed through a single endpoint, in contrast to the multiple endpoints of a REST API.
Why it matters
GraphQL solves two common problems with REST APIs: over-fetching (receiving more data than needed) and under-fetching (requiring multiple requests to get all the information). For mobile applications with limited bandwidth or complex interfaces that combine data from multiple sources, GraphQL significantly reduces the number of requests and the volume of data transferred, improving both performance and developer experience.
Practical example
A mobile application needs to display a user profile with their name, photo, and three most recent purchases. With REST, this would require at minimum two requests: one to /users/123 and another to /users/123/orders. With GraphQL, a single query retrieves exactly the required fields. If another screen only needs the user’s name, it sends a query requesting only that field, without receiving any additional data.
Related terms
- REST API - Alternative architectural style for APIs that GraphQL is frequently compared to
- API Gateway - Entry point that can route both REST and GraphQL requests
- Microservices - Architecture where GraphQL can serve as an aggregation layer
Last updated: February 2026