Postman · Import · Export

How to import a Postman collection into Swastik Codes (and export it back)

Step by step: export a collection, environment and globals from Postman as JSON, import them into Swastik Codes, read the import notes, and export back out when you need to.

By · · Updated · 8 min read

Paste a cURL command and get a saved request in a collection, ready to send.
Paste a cURL command and get a saved request in a collection, ready to send.

To import a Postman collection into Swastik Codes, export it from Postman as Collection v2.1 JSON, open the app, click Import in the top bar (or press Ctrl+O / Cmd+O), and drop the file in. The format is detected automatically, you get a preview of what will be created, and one click imports it. Environments and globals work the same way.

The rest of this guide covers each step in more detail, the other formats the same dialog accepts (Insomnia, OpenAPI, Swagger, cURL, HAR, WSDL, RAML, GraphQL), what the import notes mean, and how to export your work back out.

Step 1: export from Postman

Postman lets you export each collection and environment as a JSON file. The exact menu wording changes between versions, but the flow has been stable for years:

  1. In Postman, open the Collections sidebar, open the menu (the three dots) next to the collection, and choose Export.
  2. Pick Collection v2.1 when you are asked for a format. Version 2.1 is the current, widely supported schema. Version 2.0 also imports fine.
  3. Save the .json file.

For environments, open the Environments sidebar, open the menu next to the environment, and choose Export. Globals can be exported from the globals view in the same way.

If you have many collections, Postman's account settings also offer a full data export (a "data dump"). It is a single JSON file containing your collections, environments and globals. Swastik Codes imports that file in one go.

Step 2: open the import dialog

Create a free account and open Swastik Codes. Signing up creates a personal cloud workspace called "My Workspace"; import there to sync the collection across devices and share it with a team. To keep it on this device only, import into the Scratch Pad instead.

There are several ways into the same Import dialog:

  • the Import button in the top bar;
  • the import icon at the top of the Collections sidebar;
  • the keyboard shortcut Ctrl+O (Cmd+O on macOS);
  • the command palette (Ctrl+K / Cmd+K), then "Import…".

The dialog has four tabs:

TabUse it for
FileDrag one or more files in, or click Choose files
FolderImport every .json, .yaml, .yml, .raml, .wsdl, .graphql and .har file in a folder and its sub-folders
LinkFetch a collection, OpenAPI/Swagger spec or HAR file from a URL
Raw textPaste a cURL command, collection JSON or OpenAPI YAML

The Link tab fetches the file from your browser, so the host has to allow cross-origin requests. Raw files on most code hosts and public spec URLs usually do.

Step 3: review the preview and import

After you add a file, the dialog shows each source with a label for the format it detected: a Postman collection or environment, OpenAPI, HAR and so on. Below that is a list of everything that will be created: collections, environments and globals, each with a checkbox. By default everything is selected; untick anything you do not want and click Import.

If you imported a single request (a cURL command, for example), you also get Open as new request, which opens it in a tab without creating a collection.

The first imported collection opens in a tab straight away. Environments appear in the environment selector in the top bar.

Import a collection and its environment together

You can drop the collection file and the environment file in the same go. Both appear in the preview, and both are imported in one step. After importing, pick the environment in the selector and send a request to check variables resolve. Variables that resolve are highlighted, and missing ones are flagged in a different colour, so a typo in {{baseUrl}} is easy to spot.

You can also pin environments to a collection and choose a default one, so the right environment is selected whenever you open that collection's requests.

Step 4: read the import notes

When something in the file cannot be represented exactly, the preview shows a Notes list. Nothing is silently dropped. Common notes:

  • "mocks in the data dump are not imported" (also monitors, headerPresets): a Postman data dump can contain these, but they are not imported. Recreate mocks and monitors from the imported collection.
  • "collection 3: …" or "environment 1: …": one item in a data dump could not be read. The rest of the dump is still imported.
  • cURL notes such as "proxy … was not imported; set it in the app's proxy settings" or "--cert was not imported; add certificates in settings": the option was understood, but it belongs in settings rather than in the request.
  • OpenAPI notes such as "unresolved $ref" (only local #/... references are followed from a single file) or "security scheme … is not defined".

If a whole file fails, its row shows the error next to the file name and the other files can still be imported.

Other formats in the same dialog

The same dialog accepts much more than Postman files. The format is sniffed from the content, so you do not have to choose it:

  • Postman: Collection v1, v2.0, v2.1 and v3, environments, globals and data dumps.
  • Insomnia: v4 exports and v5 YAML. Workspaces become collections, request groups become folders, the base environment becomes collection variables, and Nunjucks references like {{ _.host }} become {{host}}. Insomnia scripts are kept with insomnia. changed to swc.. gRPC, WebSocket and Socket.IO requests become requests of those types.
  • OpenAPI 3.x and Swagger 2.0, in JSON or YAML, from a file or a URL.
  • cURL commands, including headers, data, form fields, basic auth and cookies.
  • HAR 1.2 files from browser dev tools. Every entry becomes a request, and its response becomes a saved example.
  • WSDL 1.1 and 2.0: each SOAP operation becomes a POST request with a sample envelope and the right SOAP headers.
  • RAML 0.8 and 1.0: resources become folders and methods become requests.
  • GraphQL SDL and introspection results.

RAML, WSDL and Postman v3 are converted by the server, so you need to be signed in for those.

OpenAPI import settings

When the source is OpenAPI or Swagger, a View import settings toggle appears. These are the options:

SettingWhat it does
Naming requestsUse the summary/operationId, or always the URL
Folder organizationGroup by tags, by paths, or no folders
Nested tag foldersAn operation tagged [a, b] goes into folder a › b
Parameter generationFill values from examples, or from the schema as type placeholders
Enable optional parametersTurn optional query and header parameters on (otherwise added but off)
Include deprecatedImport deprecated operations and parameters
Keep implicit headersKeep Accept, Content-Type and Authorization header parameters
Always inherit authenticationRequests inherit auth from the collection
Auth in examplesExample requests carry the request's auth
Include webhooksOpenAPI 3.1 webhooks become requests in a "Webhooks" folder

Change a setting and click Apply settings to re-parse before importing. If you maintain the spec itself in Swastik Codes, the API design tools can keep a generated collection in sync with it instead of re-importing.

Folders and v3

Choose the Folder tab to import a folder. This is useful for a repository of exported collections, and for Postman's Collection v3 folder layout (*.request.yaml files with a .resources/definition.yaml). Request kinds that have no equivalent are skipped with a note.

Step 5: export back out

Importing is not a one-way door. Open the menu next to a collection and choose Export, or use Export… in settings to export something else. You can export:

WhatFormats
A collectionCollection v2.1 (recommended), Collection v2.0, Collection v3 (keeps gRPC, WebSocket, Socket.IO, MQTT and MCP requests), OpenAPI 3, or the Swastik Codes native format
An environmentPostman environment format
GlobalsPostman format
HistoryHAR
EverythingA data dump

The export dialog shows a preview of the file, which you can copy or download. A v2.1 export is the right choice for importing back into Postman or other tools that read Postman collections.

For keeping a workspace in Git, there is also a sync option that exports a workspace as a ZIP with one JSON file per collection and environment, and imports one back with a preview of the changes.

Troubleshooting

"Nothing importable was found." The file is valid JSON or YAML but not a recognised format. Check you exported a collection rather than, for example, a run result.

Variables show as missing after import. The collection expects an environment you have not imported, or the variable only had a current value in Postman. Current values are local to each device in Swastik Codes and are never stored on the server, so set an initial value for anything the team needs.

The Link tab fails. The host does not allow cross-origin requests. Download the file and use the File tab instead.

Requests import fine but fail to send. If they target localhost or a private IP, the web app cannot reach them because requests go through the swastik.codes server, which refuses private addresses. Use a publicly reachable URL.

Frequently asked questions

Which Postman collection version should I export?

Collection v2.1. It is the current schema and the one most tools read. v2.0 and v1 also import, and v3 imports when you are signed in.

Do I need an account to import?

In the web app, yes: a free account (GitHub or email). Import into a cloud workspace to sync across devices and share with a team, or into the Scratch Pad to keep the collection in your browser only. The desktop app imports without an account.

Are my pre-request and test scripts imported?

Yes, at collection, folder and request level. They run in a sandbox that implements the documented pm.* API, so they work as imported. swc.* is Swastik Codes' name for the same API; tick Convert Postman scripts to swc.* when importing to rewrite them, and exporting to Postman writes pm.* back. See Writing API tests with swc.* scripts.

Can I import an OpenAPI spec straight from a URL?

Yes, on the Link tab, as long as the host allows cross-origin requests.

Next steps

Open the app and import a collection now, then create a free account to send requests. The import and export feature page lists every format, and Moving from Postman covers what to check once your collections are across. When you are ready to run the whole collection with a CSV of test data, read data-driven API testing.

Try it on your own API

Swastik Codes runs in the browser and is free to use. Create an account to send requests, sync your workspaces and invite your team.