GraphQL is a way for apps to ask a server for exactly the data they want, in one request.
This guide is for students, new developers and anyone whose app team has started using GraphQL. You do not need to write code to follow it: if your product has a mobile app or website that loads data, it may use GraphQL behind the scenes.
In short
- With GraphQL, the app writes its own order and sends it to one address on the server.
- That freedom is useful, but it also lets a caller ask for far too much, or for data that is not theirs.
- The server must check who is asking for every piece of data, not just at the front door.
- Limits on how big a request can be, and care with the built-in "map" of the data, close the most common gaps.
What you will learn
- Explain how GraphQL differs from the more common REST style.
- Spot the three things that most often go wrong.
- Check that your team has limits and permission checks in place.
- Ask good questions about a GraphQL app you use or build.
- Software doorway (API)
- a way for one program to ask another for data or actions.
- Data order (query)
- a written request that lists exactly which pieces of data the app wants back.
- Data menu (schema)
- the full list of data types and fields a GraphQL server can give out.
What is GraphQL?
Think of ordering in a restaurant. In many apps, each dish has its own counter, so you queue at one for soup and another for bread. GraphQL is one counter where you write a single order slip listing exactly what you want.
In plain terms, GraphQL is a language for asking an API for data, plus the software that answers those requests.[1] An API is a doorway that lets one program ask another for data. The more common style, called REST, gives each kind of data its own web address. A GraphQL server usually works from a single address, often ending in /graphql, and every request goes there.[2]
The request is called a query. The full list of what the server can give out is called the schema, like a menu.
Where the comparison stops working: a waiter would laugh at an order for one thousand plates. A server may simply try to fill it, unless someone has set limits.
Why does it matter?
GraphQL moves choices from the server to the caller. That is handy for app builders, and it also means the server has to guard against callers who ask for the wrong things.
If you are learning to code
What could happen: you check who is logged in at the start, but forget to check who owns each record.
Check this: for every piece of data, ask "should this person see this one?"
If you own a product that uses GraphQL
What could happen: one oversized request slows the app for every customer.
Check this: ask the team what limits stop very large or very deep requests.
If you are new to testing or security
What could happen: you test the web pages and miss the single GraphQL address behind them.
Check this: list every API address an app talks to, including /graphql.
What does it look like?
Here is a made-up GraphQL order from a brewery's members app. It is laid out as a list of the fields it asks for.
Example only. All values are made up.
# one request sent to shop.example.com/graphql
member(id: "EXAMPLE-0042") (1)
name
email
homeAddress (2)
orders
items
orders (3)
items
- The app asks for a member by number. The app normally sends the logged-in person's own number here.
- Private details. The server should only send these if the caller owns this record.
- Orders inside items inside orders. Each extra layer can multiply the work the server does.
Why this is risky: if the server only checks that someone is logged in, changing the number may show another member's address. Deep layers like these can also tie up the server.
The safer way: the server checks ownership for each record and each private field. It also turns away requests that are too deep or too large before running them.
How does it work?
- The order. The app writes a query listing the data it wants and sends it to the single GraphQL address.[2]
- The menu check. The server compares the order with its schema and rejects anything not on the menu.
- The size check. A well set up server measures how deep and how big the order is, and refuses orders over its limits.[3]
- The permission check. For each piece of data, the server asks whether this caller may see it. The GraphQL project advises keeping these checks in one shared place in the app's main logic.[4]
- The answer. The server sends back only what was asked for and allowed.

Most GraphQL problems fit three groups. Asking for too much, asking for someone else's data, and reading the full menu when you should not need it.[5]
The menu point needs a word of explanation. GraphQL has a built-in feature called introspection, which lets a caller ask the server to describe its own schema. It helps developer tools. For APIs used only by a firm's own apps, it is often switched off in the live system.[6] Turning it off hides the menu, but it is not enough on its own, so the other checks still matter.[3]

A worked example
Pia Delmar is a junior developer at Birch Brewery, a fictional craft brewer with a members' club app. The app uses GraphQL to load each member's profile and orders.
Before a big launch, her team lead, Emil Thorne, asks her to test the app as a nosy member would. Pia remembers the restaurant picture. One counter takes any order slip, so the kitchen has to check every slip.
She logs in with a test account and looks at the requests the app sends. Each one goes to the same /graphql address. She changes the member number in a request to another test account's number.
The server sends back the other test member's home address. The app checks that someone is logged in, but not who owns the record.
Next, she tries an order with orders nested inside items, five layers deep. The test server takes several seconds to answer.
Pia writes up both findings. Emil and Pia agree three fixes. First, a single ownership check in the app's main logic, used for every member field. Second, a depth limit and a size limit, applied before any request runs. Third, introspection and detailed error hints are switched off in the live system, because only their own app uses this API.[3]
Pia tests again. The changed number now returns an error, and the deep order is turned away at once. The launch goes ahead a day late, with no customer data exposed in the test records they reviewed.
Myths and mistakes
| What people think | What is true |
|---|---|
| If the user is logged in, they can have what they ask for. | Logging in proves who someone is. Each record still needs a check that this person may see it.[5] |
| Turning off introspection makes the API secret. | It hides the menu, but callers can still guess field names. Treat it as one layer, not the whole defence.[3] |
| Counting requests per minute is enough to stop abuse. | One GraphQL request can hold many operations, so limits also need to count what is inside each request.[3] |
| GraphQL is less safe than REST. | Neither style is safe by default. GraphQL simply puts more choice in the caller's hands, so the server needs different checks. |
| Friendly error messages are always helpful. | Detailed hints can reveal the menu to strangers. Keep them for developers, not the live system.[3] |
What can I do this week?
- Find out whether any of your apps use GraphQL, and at which address.
- Ask the team where permission checks live, and whether every field uses them.
- Check that depth, size and batch limits are set on the live server.
- Ask whether introspection is on in the live system, and why.
Checklist
- Every GraphQL address the business runs is known and listed.
- Permission checks run for each record and private field, from one shared place in the app's logic.
- The server limits how deep, how large and how many operations a request can hold.
- Rate limits take the size of each request into account, not just the number of requests.
- Introspection is off in the live system, unless the API is meant for outside developers.
- Error messages in the live system do not reveal field names or internal details.
- Someone tests the GraphQL address itself, not just the web pages on top.
Common questions
Is GraphQL more secure than REST?
No, neither is safer by default. They need different checks. REST spreads data over many addresses, so each address can be guarded. GraphQL uses one address and lets the caller choose, so the server must check the contents of each request. See REST vs GraphQL Security.
What is GraphQL introspection?
Introspection is a built-in feature that lets a caller ask a GraphQL server to describe its own menu of data. Developer tools use it. Many firms switch it off in the live system when only their own apps use the API, while keeping other checks in place.
Why does one GraphQL request cause so much load?
Because one request can ask for lists inside lists, or pack many operations together. Each layer can multiply the work. The GraphQL project suggests limits on depth, size and batch count, checked before the request runs, so oversized requests are turned away early.
Does a web application firewall protect GraphQL?
Only partly. A firewall sees requests arriving at one address and may not understand what each one asks for. Permission checks and size limits inside the GraphQL server still do most of the work. See Web Application Firewalls for Beginners.
Where next?
Ready for the detail? Read the practitioner guide: GraphQL Security Guide. It goes further into cost limits, persisted queries, resolver design and how to test and monitor a GraphQL API.
Also useful:
- REST vs GraphQL Security
- API Security for Beginners
- Rate Limiting and API Abuse Guide
- GraphQL Federation Security Guide
Related NHI Mgmt Group resources: How the Web Works for Beginners · SQL Injection for Beginners · API Keys for Beginners
Key terms
- GraphQL
- A language for asking an API for exactly the data you want, usually through one address.
- API
- A way for one program to ask another for data or actions.
- REST API
- A common API style where each kind of data has its own web address.
- GraphQL schema
- The full list of data types and fields a GraphQL server offers.
- GraphQL introspection
- A built-in GraphQL feature that lets a caller ask the server to describe its own schema.
- Checking what a person or program is allowed to see or do.
- Query depth limiting
- A rule that turns away requests with too many layers of lists inside lists.
- Rate limiting
- Capping how much a caller can ask for in a set time.
Sources and further reading
- Learn GraphQL. GraphQL Foundation. https://graphql.org/learn/, accessed 28 Nov 2026.
- Serving over HTTP. GraphQL Foundation. https://graphql.org/learn/serving-over-http/, accessed 28 Nov 2026.
- Security. GraphQL Foundation. https://graphql.org/learn/security/, accessed 28 Nov 2026.
- Authorization. GraphQL Foundation. https://graphql.org/learn/authorization/, accessed 28 Nov 2026.
- GraphQL Cheat Sheet. OWASP Cheat Sheet Series, OWASP Foundation. https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html, accessed 28 Nov 2026.
- Introspection. GraphQL Foundation. https://graphql.org/learn/introspection/, accessed 28 Nov 2026.