Import and export reference for Insomnia

Uses: Insomnia

Insomnia offers a unified workflow for importing and exporting API artifacts. Whether you’re using the desktop UI or automating tasks through the Inso CLI, this page outlines the methods, their compatibility, and the practical use cases to fit a variety of developer workflows.

Typical use cases

Use case

Method

Export a design document for version control UI export from document menu or Preferences; or inso export spec for OpenAPI in CI.
Transfer all API work to another machine UI → Preferences → Data → Export all data.
Import a Postman collection or OpenAPI spec into Insomnia UI → Import → choose File/Clipboard/URL.
Integrate spec validation into CI pipelines In CI, use inso lint spec <identifier> to lint OpenAPI and fail builds on errors.
Automate test execution from Insomnia test suites in CI In CI, use inso run test <identifier> to run defined tests and return pass/fail exit codes.
Import a Postman environment into Insomnia
  1. Organize each project into its own folder.
  2. Use Import > From Folder from within the Insomnia UI.

Import methods

Depending on your workflow requirements, you can import into Insomnia with either of the following methods:

  • UI import
  • CLI import

UI import

In a workspace or document header, select Import and then specify your import method:

  • File
  • URL
  • Clipboard

Insomnia supports the following formats:

  • Import formats: Insomnia JSON (v4), Insomnia YAML (v5), Postman v2.0/v2.1, HAR, OpenAPI 3.0/3.1, Swagger, WSDL, and cURL
  • Export formats (UI): Insomnia YAML (v5) and HAR
  • Export formats (CLI): OpenAPI spec

For more information on importing with the UI, go to how to import an API spec as a document.

CLI import

Use Inso CLI to supplement UI workflows with command-line capabilities. Instead of importing files into the application directly, you can use Inso CLI to run tests, execute collections, validate specs, export OpenAPI artifacts, and run custom scripts.

An example of our key commands:

  • Execute test suites via CLI

    inso run test "<Design Document Name>" --env "<Environment Name>": Runs unit tests defined in the Insomnia application. The execution runs as in CI pipelines and returns a non-zero exit code if tests fail.

  • Validate an OpenAPI specification

    inso export spec "<Design Document Name>" --output <filename>.yaml: Extracts the raw OpenAPI spec tied to a design document. Without --output, the CLI prints the spec to stdout for easy scripting.

  • Run request collections automatically

    inso run collection "<Collection Name>" --env "<Environment Name>": Runs all requests and scripts in a collection as a batch. This is ideal for automation and guarantees consistency across environments.

For more information, see the Inso CLI reference.

Export methods

Insomnia supports flexible export options that are tailored to both manual and automated workflows. You can either use the desktop app, ideal for immediate data transfer or archival, or use Inso CLI to script OpenAPI specification exports within CI pipelines.

UI export

In a workspace or document header, select Export and then specify the file type. The following file types are supported:

  • Document: Export only the active design document. This includes the requests, environment settings, and tests. It does not include other workspace data.
  • Project: Export the selected collection. This includes all contained requests and environments.
  • All data: Export everything in your workspace.

The UI method supports the following formats:

  • Insomnia YAML (v5)
  • HAR

CLI export

Use Inso CLI to automate exports of your OpenAPI specification from a design document. You can write the spec to a file, or let the CLI print to standard output for piping in scripts and CI. For a full overview, see the Inso CLI reference.

An example of the key commands:

  • Export an OpenAPI spec to a file

    Use inso export spec "<Design Document Name>" --output spec.yaml to extract the raw OpenAPI specification tied to a design document and save it to a file. The identifier can be the spec name or its ID.

  • Export to standard output for piping

    Use inso export spec "<Design Document Name>" without --output to print the spec to the console. This is useful for shell redirection or piping into other tools.

v4 and v5 file formats

Insomnia exports in the v5 file format and can still import legacy v4 JSON files. The two formats are structured differently, as described in the following tabs.

FAQs

Nested environment variables may not appear in the table view. If this happens, switch to the JSON view to see the full environment variable structure.

  • Export all data: Includes your entire account’s data.
  • Scoped export options: Allow you to export only specific parts of your data, such as a single Document or Project, for more targeted backups or sharing.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!