GraphQL is a query language for APIs, plus a server runtime that executes those queries against a typed schema. Instead of many fixed endpoints, a client sends one query to a single URL and names the exact fields it needs.
Why it matters
With a REST API, a screen may need three requests that each return more data than required. GraphQL lets the client fetch a user and their latest posts in one round trip and receive only the requested fields, which helps on slow mobile networks. The schema also serves as living documentation.
Example
query {
user(id: 42) {
name
posts(first: 2) { title }
}
}
The response mirrors the query shape:
{"data": {"user": {"name": "Asha", "posts": [{"title": "Hello"}]}}}
Common mistakes
- Assuming HTTP status codes show failures; GraphQL often returns 200 with an
errorsarray, so monitor the body. - Allowing unbounded nested queries, which can overload the server. Add depth and cost limits.
- Exposing introspection and verbose errors in production without thinking about who can see them.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.