⬡ GraphQL
Beginner
What is GraphQL introspection?
Answer
Introspection is GraphQL's built-in ability to query the schema itself — to discover what types, fields, and operations are available. Special introspection queries start with __: { __schema { types { name } } } lists all types. { __type(name: "User") { fields { name type { name } } } } describes a specific type. { __typename } returns the type name of the current object. Tools like GraphiQL, Apollo Sandbox, and Insomnia use introspection to provide autocomplete and documentation. Code generators (GraphQL Code Generator) use introspection to generate TypeScript types. Important: disable introspection in production environments to prevent API schema exposure to attackers — many GraphQL security issues start with schema enumeration.