APIs & Authentication

What is GraphQL?

A query language for APIs that lets the client specify exactly the fields it wants from a typed graph of data, returned in one round trip.

GraphQL was released by Facebook in 2015. Instead of REST's many endpoints with fixed shapes, GraphQL exposes a single endpoint and a typed schema. The client sends a query naming the fields it wants, possibly traversing relationships, and the server returns exactly those fields, no more, no less.

The headline benefit is over-fetching elimination: a mobile app can ask for user { id, name, avatar.url } and skip the 30 other user fields a REST endpoint would return. The cost is operational complexity: query caching, depth limits, and N+1 resolution all become server-side problems that REST never had.

GraphQL is dominant inside large product orgs (GitHub, Shopify, Airbnb) where many clients hit the same data. For public APIs and small teams, REST plus careful field selection often wins on simplicity.

In the wild

  • query { user(id: 42) { name, posts { title } } }
  • Mutations: mutation { createPost(input: {...}) { id } }
  • Subscriptions over WebSocket for live updates

FAQ

GraphQL vs REST?

REST is many endpoints with fixed shapes; GraphQL is one endpoint with client-specified shapes. GraphQL solves over- and under-fetching at the cost of harder caching and more server-side work.

Is GraphQL faster than REST?

Per request, sometimes, fewer round trips, less data over the wire. Per server, often slower, resolvers have to be careful to avoid N+1 queries against the database.

When should I avoid GraphQL?

Public APIs where caching matters more than flexibility, or small teams that don't want to operate the toolchain.

Related terms

Ship an agent that actually knows things.

Free tier, 10-minute integration, and the same API powering agents at Mintlify, daily.dev, and Propane. No credit card to start.