Insomnia logo
  • Documentation
  • Download
  • Upgrade
    • Introduction to Insomnia
    • Install Insomnia
    • Migrate from Designer
    • Import and Export Data
    • Environment Variables
    • HTTP(S) Proxy
    • Insomnia Configuration File
    • Responses
    • Request Collections
    • Request Timeouts
    • Chaining Requests
    • Post CSV Data
    • SOAP Requests
    • Teams
    • Projects
    • Sync with Git
    • Version Control Sync
    • Design Documents
    • Linting
    • GraphQL for OpenAPI
    • Live Preview
    • Unit and Stress Testing
    • Key Security Features
    • Security Standards
    • Signup and Authentication
    • Data Encryption
    • Authentication
    • Client Certificates
    • Generate Code Snippet
    • Cookie Management
    • Encoding
    • GraphQL Queries
    • gRPC
    • Run in Insomnia Button
    • Key Maps
    • Introduction to Plugins
    • Context Object Reference
    • Template Tags
    • Hooks and Actions
    • Custom Themes
    • FAQ
    • Application Data
    • SSL Validation
    • Password Recovery
    • Introduction to Inso CLI
    • Install Inso CLI
    • CLI Command Reference
      • inso generate config
      • inso run test
      • inso lint spec
      • inso export spec
      • inso script
    • Configuration
    • Continuous Integration
    • Publish API to Dev Portal
    • Kong Declarative Config (for decK)
    • Kong for Kubernetes

Introduction to Inso CLI

Inso CLI (Command Line Interface) for Insomnia is built on Node.js and the Insomnia core libraries. It allows you to use Insomnia application functionality in your terminal and CI/CD environments for automation.

Inso CLI is open source on GitHub.

Note: At this time, Inso CLI only works with Design Documents, and not Request Collections.

Usage

Install Inso CLI to get started.

In your terminal, work in a directory that contains an .insomnia directory. Alternatively, ensure you have Insomnia installed with at least one Design Document.

All of the Inso CLI commands will prompt for more information, if needed. For example, if the unit test suite to run is not provided, Inso will prompt according to the data source. Prompts for more information can be disabled using the --ci global option.

Global Options

Global options are valid with any Inso command, in conjunction with command-specific options.

Global option Alias Description
--version -v output the version number
--workingDir <dir> -w set working directory, for both input (Git) and output (export a spec)
--src <file or dir>   specify the Insomnia v4 export file or the Insomnia app data directory
--config <path>   path to the configuration file
--verbose   show additional logs while running a command
--printOptions   print the loaded options
--ci   run in CI, disables all prompts
--help -h display help for a command

Note: We have deprecated the option --appDataDir <dir>. Use --src <file or dir> instead to define the location of the Insomnia v4 export file or the Insomnia app data directory.

Data Sources

Inso CLI can work with three data sources.

  • Insomnia app data directory. Inso CLI will attempt to locate the directory based on your operating system. To overwrite the default location, search for app data using --src and the Application Data location of your operating system.
  • Git data directory if Git Sync is set up and no --src is set. For example, when running in CI, InsoCLI will find the .insomnia directory at the root of the repository automatically, but you can override the location using --workingDir.
  • Insomnia export file. Search for an export file using --src.

Note: The .insomnia directory is generated automatically in your git repository when using Git Sync.

Data Search Flow

Inso CLI will first try to find a .insomnia directory in its working directory. This directory is generated in a git repository when using Git Sync. When Inso is used in a CI environment, it will automatically run against the .insomnia directory at the root of the repository, unless you specify a --workingDir or --src option.

If Inso CLI cannot find the .insomnia directory, it will try to run against the Insomnia app data directory. You can override both the working directory, and the app data directory, using the --workingDir and --src global options.

The identifier Argument

Insomnia database ids are quite long, for example: wrk_012d4860c7da418a85ffea7406e1292a. When specifying an identifier for Inso CLI, similar to Git hashes, you may choose to concatenate and use the first x characters (for example, wrk_012d486), which is likely to be unique. If in the rare chance the short id is not unique against the data, Inso CLI will indicate that.

The identifier can also be the entity name. For example, if a unit test suite ID is “uts_012d4860c7da418a85ffea7406e1292a” and the unit test suite name is “foobar”, both of the following will work:

inso run test uts_012d48 inso run test foobar

Additionally, if the identifier argument is omitted from the command, Inso CLI will search in the database for the information it needs, and prompt the user. Prompts can be disabled with the --ci global option.

Git Bash

Git Bash on Windows is not interactive, so prompts from Inso CLI will not work as expected. You can specify identifiers for each command explicitly, or run Inso CLI using a tool like winpty. The following is an example Inso CLI command using winpty:

winpty inso.cmd generate config
Edit this page
Report an issue
    COMPANY
  • Insomnia
  • Blog
  • Changelog
  • Pricing
  • Careers
    PRODUCTS
  • Insomnia
  • Inso (CLI)
    RESOURCES
  • Sign In
  • Documentation
  • Support
    LEGAL
  • Privacy Policy
  • Terms & Conditions
© Kong Inc. 2021