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).
| Postman | Mercury |
|---|---|
| Request | <name>.json |
| Folder (any depth) | Folder, with the same nesting |
| Collection variables | .env.<collection-name> in the import folder |
| Headers | Headers (disabled ones are skipped) |
| Raw body | Body |
| URL-encoded body | A Form body, with the matching Content-Type |
| Bearer / Basic / API key auth | The Authorization (or API key) header, or a query parameter |
| URL | The 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.
| Insomnia | Mercury |
|---|---|
| Request inside a request group | <group-name>/<name>.json |
| Request not in a group | imported/<name>.json |
| Environment (non-empty) | .env.<environment-name> |
| Headers | Headers (disabled ones are skipped) |
| Body text | Body |
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"}'
| Flag | Effect |
|---|---|
-X, --request | Method |
-H, --header | Header |
-d, --data, --data-raw, --data-binary | Body. Changes a GET to POST. |
--json | Body plus Content-Type: application/json. Changes a GET to POST. |
-u, --user | Authorization: Basic ... |
-A, --user-agent | User-Agent header |
-b, --cookie | Cookie header |
-I, --head | HEAD |
-G, --get | GET |
-o, -x, -c, -m, -w, -e, --output, --proxy, --cookie-jar, --connect-timeout, --max-time, --write-out, --cacert, --cert, --key, --referer | Ignored, 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.