How to import Magento GraphQL schema to Postman

GraphQL is a query language that allows you to get what you want from the backend, so basically, you need to describe the fields you wish to, write a query, and you are good to go. I have been working a lot with Magento GraphQL API, and I have used the Chrome extension to send requests. The number of queries I have saved has been increasing daily, and I have started looking for something that allows me to organize all my queries and mutations.

Organize things

Then I remembered the Postman app, which has many beautiful features, and one tiny of them is that you can create your API collection and group all requests you want in folders.

How to export Magento GraphQL schema

The first question I asked myself was how can I export Magento GraphQL schema to the file. After some research, I found a perfect and super easy command-line tool.

The Rover CLI

The Rover CLI created by Apollo allowed me to export Magento Schema. Installation is super easy and took a few seconds (I installed it on Mac, it should be easy on Linux as well).

Use this command to install the Rover CLI:

$ curl -sSL | sh

Then you need to restart a terminal or use this command to configure the rover CLI with the current shell:

$ exec /bin/zsh -l

Note: this command can be different for your terminal. Please follow the instructions visible in the terminal after the Rover CLI installation.

Export Magento schema to the file

To export GraphQL Magento schema to the file, you can use this command:

$ rover graph introspect <your_magento_graphql_endpoint>  > <file_name> 

Assuming your Magento is available on, you want to export schema to magento.graphql file, the command you need to use looks like this:

$ rover graph introspect > magento.graphql

Import schema to the Postman

Once you export the schema to the file, you can import it into Postman. Open your Postman App, and click the import button:


Click “Upload Files”:

Upload files

Select the file that you previously exported using the Rover CLI.

You can optionally enable the option to import deprecated fields. Next, just click Import, and your schema should be imported.

Importing APi in Postman

You should see queries and mutations imported:

Postman collection

let’s take a look at one of query: route:

I marked some areas in the screenshots with the red square.

  1. Here you have a URL for the request. It is bound to a variable. In next step I will show you where you can add this variable
  2. This is a query body
  3. In this area, you can add/modify query variables

How to set variables in Postman

You can see variables in two ways:

  1. By filling variable in Collection’s settings
  2. By creating environment

This time, let’s use the first option:

If you set up a URL to Magento correctly, a request should be sent to Magento:

postman magento request sent

Bonus: how to disable GraphQL schema introspecting in Magento

To be honest GraphQL API intersection enabled by default has danger in terms of security because it’s possible to show a GraphQL schema of any Magento shop and use it for shameful acts such as attacks on the store, data theft, etc.

Fortunately, there is an easy way to disable introspection by configuration in Magento.

To do so, please add this entry to your app/etc/env.php file:

'graphql' => [
    'disable_introspection' => true


In this short article, I showed you how to export Magento GraphQL schema and import it to Postman. On the other hand, remember that it is recommended to disable API introspection in Magento for any store on production.



Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents

On Key

Related Posts

business requirements

Is gathering business requirements really difficult? Discover the truth

Does gathering business requirements really have to be difficult? Get ready to discover techniques that will help you revolutionize how you gather and understand business needs. Whether you’re an experienced software architect or a technical leader, this article will provide practical tips to speed up your requirements-gathering process and deliver better results. Learn the secret to effective business requirements gathering and stop stressing about collecting requirements!

software architecture

Software architecture explained: Key concepts for developers

Can anyone explain what software architecture is? Whether you are an experienced programmer or just starting your adventure with application development, this article is for you. I will show you the concepts that form the foundation of every successful software project. Thanks to this, you will gain the confidence and knowledge necessary for designing and creating applications that will work according to expectations and meet the requirements of both users and businesses.

cognitive load

Cognitive Load in Teamwork: How to Optimize Performance?

Have you ever wondered why sometimes you feel overwhelmed with work while other times everything seems to go smoothly? Why sometimes thinking and problem-solving difficult for you, while other times are easier? There is a concept that helps you understand how much cognitive effort you need to put into your work. It’s the cognitive load theory, which can help you minimize cognitive effort and work more efficiently.


Estimation without fear

What are programmers most afraid of? Estimating how long it will take to complete a task certainly causes fear. Still, there is something even worse – saying that you have exceeded your estimate by X times, often X being even five times more than the original plan. I will share my experience with you in this article regarding estimating work.