Fast Track Your API Development With Insomnia REST Client

A Fast and Simple Alternative to Postman for Sending REST and GraphQL Requests

Jerry Ng
Jerry Ng
Jan 22 · 5 min read
Insomnia REST Client
Insomnia REST Client
Photo Credits: Insomnia REST Client

you are developing a set of APIs, chances are you already know Postman — an API Client for API development. Generally, one would use an API client to test APIs in terms of functionality, performance, security, reliability, and the correctness of the responses.

While Postman is the de facto standard for API testing and development, I would like to draw your attention to a fast and easy-to-use alternative to PostmanInsomnia REST Client.

The goal of this article is to share with you some of the handy tips and tricks that you can use with Insomnia, especially while developing GraphQL APIs, though it works great with REST too.

If you want to try out the APIs used in this article, feel free to check out:

Why Not Postman?

No Support for Schema Import via URL and Autocomplete

With the introspection system, GraphQL is able to provide a way for clients to discover the resources that are available in a GraphQL schema which then allows features like self-documentation and autocompletion to be used by the users.

Postman as of the date of writing this article does not directly support importing GraphQL schemas via URL directly (issue). As a result, to use autocomplete on Postman, one would need to import your schema file manually to Postman every time there are new changes made to your schema which can be very cumbersome.

Here are some useful tips when using Insomnia

Environment Variables

Like Postman, we could easily set environment variables in Insomnia and use them later on when making our requests.

For instance, we can configure our API’s BASE_URL according to our environment such as Local, Staging or Production and switch to a different environment with ease.

Do note that the environment is to be filled with JSON format.

To reference any environment variable, simply press Control/Cmd + Space on your keyboard.

NOTE: In case the autocomplete does not render, simply use{{ENV_VAR_NAME}} instead.

Chaining Requests

Insomnia provides the ability to extract values from the responses of other requests.

Imagine if we want to run thecreateArticle mutation to create a new article, the server would require us to be authorized first.

In other words, an access token or some sort would be required in the request header of the createArticle mutation.

Steps Without Chaining Requests:

  1. Send a tokenAuth mutation to obtain the token.
# Mutation
mutation TokenAuth($username: String!, $password: String!) {
tokenAuth(username: $username, password: $password) {
# Query Variables
"username": "username",
"password": "password123"
# Response
"data": {
"tokenAuth": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

2. Copy the value of token from the data.tokenAuth.token from our response.

3. Paste the token value (eyJhbGciOiJIUzI1NiI.....)in the authorization header of the createArticle request and hit ‘Send’.

4. Repeat Step 1 — 3 every time the token expires.

Steps With Chaining Requests:

  1. Setup tokenAuth mutation once as Step 1 above.
  2. Go to createArticle, under the “Bearer” option, select “Bearer Token”
  3. At “TOKEN”, hit Control/Cmd + Space, select “Response → Body Attribute”
  4. Un “Edit Tag”, under “Request”, select the request that you have set up in Step 1 (i.e. POST tokenAuth)
  5. Under “Filter”, filter your response by JSONPath i.e. $.data.tokenAuth.token
  6. Lastly, you may configure the “Trigger Behaviour” accordingly
  7. Hit ‘Send’ at your createArticle mutation

The idea here is that instead of having to copy the value of token manually every time from the response to createArticle mutation, we would only perform Step 1 — 6 ONCE only.


One of my favorite reasons for using Insomnia is that it supports numerous plugins that can be used to extend the functionality of Insomnia.

To install any plugin, simple hit Control/Cmd + , key on your keyboard, go to ‘Plugin’, and type in the npm-package-name of the plugin that you want to install on Insomnia.

You may find a list of available plugins here.

Faker Plugin (insomnia-plugin-faker)

If you come from the JavaScript world, you probably have heard of Faker. In short, one would use Faker to generate a massive amount of realistic fake data.

The insomnia-plugin-faker allows us to generate Faker data right within the Insomnia itself which can be super handy.

As an example, under query variables for your createArticle mutation, simply hit Control/Cmd + Space and type faker so that the autocomplete can render the type of Faker data you want to generate. Simple as that!

Gist Sync Plugin (insomnia-plugin-gist-sync)

Another amazing plugin that I use a lot personally is the insomnia-plugin-gist-sync plugin that allows users to sync workspaces with GitHub gist, for free! Simple just follow the steps in the link given to setup.

NOTE: Do support Insomnia with a team membership as they come with additional features.

Closing Thoughts

Prior to using Insomnia, I was using Postman a lot. Eventually, I find myself using Insomnia more and more.

Personally, I find Insomnia very easy to work with. Not forgetting to mention that I simply just like Insomnia’s cleaner and less cluttered UI. The hotkeys on Insomnia are much more intuitive to use too!

Finally, Insomnia supports the ability to import multiple file types such as Postman v2, OpenAPI, Swagger, and more!

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Jerry Ng

Written by

Jerry Ng

Software engineer. Enjoy talking about tech & finance. ✌️ Ask me anything!

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Jerry Ng

Written by

Jerry Ng

Software engineer. Enjoy talking about tech & finance. ✌️ Ask me anything!

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store