What is Introspection in GraphQL?

Adhithi Ravichandran
5 min readOct 20, 2020

What is Introspection in GraphQL

GraphQL stands out with its strong type system. Because of the strong typed system, GraphQL is able to provide an introspection system to query the schema. The introspection system in GraphQL provides a way for clients to discover the resources that are available in a GraphQL schema. The introspection system is a feather in the hat for GraphQL. It has plenty of uses and we will see some of them below.

Why is Introspection Useful?

Provides clients a deep view of the schema

Through introspection queries, the client can get a complete view of the resources in the GraphQL schema. This can save the client tons of time going back and forth with documentation. Instead they can introspect the schema and understand the resources available to them in depth.

Build Awesome Tools

The introspection system allows the community to build awesome tools for GraphQL. Some of the tools that we use today that owe their existence to the introspection system are GraphiQL, GraphQL Playground, to name a few. These tools help clients to explore the GraphQL schema, in an easy and user-interactive way.

Self Documentation

These GraphQL tools like GraphQL Playground use the introspection system, to provide features like self documentation of the API, auto completion and code generation.

Introspection Queries

Let’s dive into some introspection queries and learn how to write them.

To demonstrate and learn GraphQL introspection queries, I am going to use the GitHub API that is available to the public. You can follow along by opening https://developer.github.com/v4/explorer/. Make sure you are signed in to your GitHub account to run the introspection queries.

On the GitHub GraphQL explorer, we can start typing our queries on the left side and hit play to see the JSON response on the right side. We can also browse…

Adhithi Ravichandran

Software Consultant, Author, Speaker, React|Next.js|React Native |GraphQL|Cypress Dev & Indian Classical Musician