GraphQL Introspection Types

GraphQL introspection query shape — __Schema, __Type, __Field and meta-fields.

Reference for GraphQL introspection schema types and meta-fields used in tooling and schema exploration, covering __Schema, __Type, __Field, __TypeKind and the __typename, __type, __schema meta-fields.

What is GraphQL introspection?

Introspection is a built-in system that lets clients query a GraphQL server about its own schema. The server exposes meta-types like __Schema and __Type, so tools such as GraphiQL, code generators and documentation explorers can discover every type, field and directive at runtime.

How GraphQL describes itself

Every GraphQL server ships a meta-schema that lets clients ask the API about its own shape. This introspection system powers GraphiQL, schema documentation, client code generation and validation. This reference lists the introspection meta-types — __Schema, __Type, __Field, __InputValue, __EnumValue, __Directive — their fields, the __TypeKind enum, and the three meta-fields you can call directly inside any query.

How it works

You explore a schema by querying the __schema or __type root meta-fields. Because types can be wrapped in lists and non-null markers, __Type is recursive: wrapping kinds carry a null name and an ofType pointer:

{
  __type(name: "User") {
    name
    kind
    fields {
      name
      type { kind name ofType { kind name } }
    }
  }
}

To resolve a type like [String!]! you peel ofType one layer at a time: NON_NULL → LIST → NON_NULL → SCALAR(String). Which __Type fields are populated depends on kind: fields only appears on OBJECT/INTERFACE, enumValues only on ENUM, inputFields only on INPUT_OBJECT.

Notes and gotchas

The __typename meta-field is the workhorse for client-side union and interface resolution — it returns the concrete object type. All introspection names use a reserved double-underscore prefix that your own schema may never use. Finally, remember that introspection is frequently disabled in production, so do not build runtime features that depend on a live __schema query against a hardened API.