Software Development

What is GraphQL?

Quick answer

A query language and runtime for APIs that lets clients request exactly the data they need in a single request.

GraphQL, explained

GraphQL was developed at Facebook and released publicly in 2015. Unlike a typical REST API, where each endpoint returns a fixed shape of data, GraphQL exposes a single endpoint and a schema describing all available data types. The client writes a query specifying exactly which fields it wants.

For example, a mobile app could ask for a user's name and the titles of their last five posts in one request, without receiving unneeded fields or making several calls. This reduces over-fetching and under-fetching. GraphQL also supports mutations for changing data and subscriptions for real-time updates. Trade-offs include more complex caching, the need to guard against expensive nested queries, and a steeper learning curve for small projects.

Related terms

Guides that mention GraphQL