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.
Import and export reference for Insomnia
Typical use cases
|
Use case |
Method |
|---|---|
| Export an API Collection for version control |
UI export from the API Collection 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 legacy test suites in CI |
In CI, use inso run test <identifier> to run defined tests and return pass/fail exit codes. Legacy unit tests are hidden in the app by default since Insomnia 13.3.
|
| Import a Postman environment into Insomnia |
|
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 API Collection 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 into an API Collection.
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 "<API Collection 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 "<API Collection Name>" --output <filename>.yaml: Extracts the raw OpenAPI spec tied to an API Collection. 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
Each export option is labeled with the name of what you’re exporting, for example Export the "Flights Service 0.1.0" API Collection. You can export at the following scopes:
- API Collection: Exports only that API Collection, including its spec, requests, environment settings, and tests. It doesn’t include other workspace data.
- Project: Exports every workspace in that project.
- All data: Exports everything in your account. Go to Preferences > Data and click Export all data.
Each export asks which format to use. The UI method supports the following formats:
- Insomnia v5
- HAR (HTTP Archive Format)
CLI export
Use Inso CLI to automate exports of your OpenAPI specification from an API Collection. 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 "<API Collection Name>" --output spec.yamlto extract the raw OpenAPI specification tied to an API Collection 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 "<API Collection Name>"without--outputto 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
Why aren’t all environment variables visible in the table view?
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.
What’s the difference between “Export all data” and scoped export options?
- 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 API Collection or Project, for more targeted backups or sharing.