GraphQL malicious query protection
Last updated Sep 29, 2026 GraphQL is a query language for APIs. In addition to protecting RESTful APIs, Cloudflare can also protect GraphQL APIs.
GraphQL malicious query protection scans your GraphQL traffic for queries that could overload your origin and result in a denial of service. Query size is the number of terminal fields, or leaves, in a query. You can build rules that limit the query depth and size of incoming GraphQL queries in order to block suspiciously large or complex queries.
Availability
GraphQL malicious query protection is available for all API Shield customers. Enterprise customers who have not purchased API Shield can preview API Shield as a non-contract service ↗︎ in the Cloudflare dashboard or by contacting your account team.
Limitations
The following limitations apply:
- Parsing is limited to GraphQL
POSTbodies up to 20 KiB. This limit will be raised in a future release. - Only
POSTrequests with content types ofapplication/jsonorapplication/graphqlare inspected. - Queries containing fragments or multiple operations are not supported.
- Parsing and rules are limited to paths with the case-sensitive
/graphqlsuffix.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/api-shield/security/graphql-protection/#page","headline":"GraphQL malicious query protection","description":"Scan GraphQL traffic and block queries that could overload your origin.","url":"https://developers.cloudflare.com/api-shield/security/graphql-protection/","inLanguage":"en","image":"https://developers.cloudflare.com/api-shield/security/graphql-protection/og.png?v=28a2d411af4a980b","dateModified":"2026-09-29","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Use the GraphQL API to configure query size and depth limits for your API. title: Configure GraphQL malicious query protection via the API image: https://developers.cloudflare.com/api-shield/security/graphql-protection/api/og.png?v=5fe3f58bb103ab4d
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/api-shield/llms.txt
Use this file to discover all available pages before exploring further.
Docs