Skip to main content

Import & Export

Mercury imports Postman and Insomnia exports and cURL commands, and it can copy any request as a cURL command.

Where imports go​

Choose Import from Postman… or Import from Insomnia… from the workspace menu in the top bar. The empty sidebar also has Import from ... links. Pick the export file, and then:

  • if a workspace is open, the requests are written into that workspace
  • if no workspace is open, Mercury asks for a folder to write to, then opens it as the workspace

A notification reports how many requests and environments were imported.

File and folder names are sanitized: they're lowercased, and spaces and characters such as / \ : * ? " < > | become -. For example, "Get User" becomes get-user.json. Existing files with the same name are overwritten.

Postman​

Export the collection from Postman as Collection v2.1 (JSON).

PostmanMercury
Request<name>.json
Folder (any depth)Folder, with the same nesting
Collection variables.env.<collection-name> in the import folder
HeadersHeaders (disabled ones are skipped)
Raw bodyBody
URL-encoded bodyA Form body, with the matching Content-Type
Bearer / Basic / API key authThe Authorization (or API key) header, or a query parameter
URLThe raw URL. Without one, the URL is rebuilt from its parts, skipping disabled query params.

Auth set on the collection or a folder applies to every request under it, and a request's own auth wins over it.

Postman {{variables}} stay as they are in URLs, headers and bodies, so they work with the generated .env file. Scripts and tests aren't imported.

What Mercury can't express is named in the notification rather than dropped quietly: OAuth 2 and other token-exchange auth, form-data and binary bodies, which need a file a request file cannot point at, and GraphQL bodies. Anything listed there needs finishing by hand on the Auth tab or the Body tab.

Example: importing a collection named "My API":

workspace/
β”œβ”€β”€ .env.my-api
β”œβ”€β”€ auth/
β”‚ └── login.json
β”œβ”€β”€ users/
β”‚ └── admin/
β”‚ └── list-admins.json
└── health-check.json

Insomnia​

Export from Insomnia as JSON or YAML.

InsomniaMercury
Request inside a request group<group-name>/<name>.json
Request not in a groupimported/<name>.json
Environment (non-empty).env.<environment-name>
HeadersHeaders (disabled ones are skipped)
Body textBody

Each request goes into a folder named after its direct parent group. Nested groups aren't recreated as nested folders. Auth settings aren't imported.

workspace/
β”œβ”€β”€ .env.base-environment
β”œβ”€β”€ users/
β”‚ β”œβ”€β”€ get-user.json
β”‚ └── list-users.json
└── imported/
└── health.json

Import from cURL​

Paste a command that starts with curl into the URL bar. Mercury parses it and replaces the method, URL, headers and body. This works with commands copied from browser DevTools or API docs, including multi-line commands that use \ continuations.

curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name": "John"}'
FlagEffect
-X, --requestMethod
-H, --headerHeader
-d, --data, --data-raw, --data-binaryBody. Changes a GET to POST.
--jsonBody plus Content-Type: application/json. Changes a GET to POST.
-u, --userAuthorization: Basic ...
-A, --user-agentUser-Agent header
-b, --cookieCookie header
-I, --headHEAD
-G, --getGET
-o, -x, -c, -m, -w, -e, --output, --proxy, --cookie-jar, --connect-timeout, --max-time, --write-out, --cacert, --cert, --key, --refererIgnored, along with their argument
Other flags (-s, -L, -k, -v, --compressed, ...)Ignored

The first argument that isn't a flag is used as the URL. If there isn't one, you get an error.

Copy as cURL​

Press ⌘ Shift C to copy the current request to the clipboard as a cURL command:

curl -X GET 'https://api.example.com/users' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer abc123'
  • Variables from the selected environment are substituted in. Undefined ones stay as {{NAME}}.
  • Disabled (#) headers are left out.
  • Arguments are single-quoted, so you can paste the command into a POSIX shell as is.

Sharing request files​

Requests are plain .json files, so you can also share them by copying them, committing them to Git, or sending them to someone. See File Format.