Getting Started with Insomnia
Insomnia is a free cross-platform desktop application that takes the pain out of interacting with HTTP-based APIs. Insomnia combines an easy-to-use interface with advanced functionality like authentication helpers, code generation, and environment variables. There is also the option to subscribe to a paid plan to gain access to encrypted data sync and team collaboration.
This article will show you how to install the desktop application and send your first HTTP request.
Step 1. Install the App
Insomnia is available for Mac, Windows, and popular Linux distributions. Visit the Downloads page to download the installer for your operating system.
There are further installation instructions here if you are having problems installing Insomnia
After downloading the installer, double click the file to install the Insomnia. Now, open the application and get ready to create your first HTTP request.
Step 2. Create an HTTP Request
To create your first request, click the plus icon at the top of the sidebar and select New Request. You will then be prompted to give the request a name and choose it's HTTP method.
For this example, we'll make a request that fetches the Insomnia changelog as JSON so we'll name the request Fetch Insomnia Changelog.
After the request is created, set the URL to
changelog.insomnia.rest/changelog.json and click the Send button beside it to execute the request.
Once the request completes, the details will be visible in the response pane on the right side of the application. Here, you will see status code, time, size up top and the JSON body, headers, cookies, as well as a Timeline (useful for debugging) in the tabs below.
Step 3. Environment Variables (Bonus!)
Environment Variables are one of the most powerful features of Insomnia. They save time by allowing you to define common values in a single place and then referenced those values in multiple requests.
In this example, we'll make a
base_url variable to store the commonly-repeated part of the URL (changelog.insomnia.rest). To add an environment variable, click Manage Environments from within the environment dropdown in the sidebar.
After the environment editor appears, type the JSON object in the base environment, as seen in the following screenshot.
Once you have the variable defined, it will show up in the autocomplete as you type. Start typing the name of the variable, then press Enter to insert it into the start of the URL.
And that's it! You have now learned the basics on environments. Now, you can reference the same variable in multiple requests and, if you need to change it, have the ability to modify it in a single place.
Environment are more powerful then this! Check out the Docs to learn more
Step 5. Learn More
Now that you know how to create and send a basic HTTP request, head over to the Features Documentation to see what else is possible.