# GraphQL

GraphQL is a query language for APIs and a server-side runtime for executing queries against a type system defined for your data. Developed by Facebook in 2012 and open-sourced in 2015, GraphQL allows clients to request exactly the data they need, avoiding the over-fetching and under-fetching problems common with REST APIs.

A GraphQL API exposes a single endpoint and uses a schema to define available types, queries (reads), mutations (writes), and subscriptions (real-time updates). Clients send queries specifying the exact fields and relationships they need, and the server returns a JSON response matching that structure. This reduces the number of network round trips required to fetch related data.

API gateways can sit in front of GraphQL APIs to provide authentication, rate limiting, and caching. However, caching GraphQL is more complex than caching REST because queries are typically sent as POST requests with varying bodies. Some gateways also support GraphQL-to-REST translation, allowing teams to expose a GraphQL interface while routing to existing REST backend services.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.serverlessapigateway.com/glossary/g/graphql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
