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. With no folder open, the sidebar also lists Postman collection and Insomnia export under Import. Pick the export file (or several at once: a Postman collection and its environment exports), and then:
- if a workspace is open, the requests are written into it, in a new folder named after the collection (
acme-api/), so they can't mix with or replace your own - if no workspace is open, Mercury asks for a folder to write to and opens it as the workspace; an empty folder (or one holding only
.envfiles) gets the requests directly
Environments go in the workspace root as .env.<name>, where Mercury looks for them. When the import is done, its first request is open and its environment selected, and a notification says what was imported and where.
File and folder names are sanitized: they're lowercased, and spaces and characters such as / \ : * ? " < > | become -. For example, "Get User" becomes get-user.json. Nothing is ever overwritten: a name that's taken gets a suffix (.env.acme-api-2, list-users-2.json).
Postmanβ
Export the collection from Postman as Collection v2.1 (JSON); v2.0 works too. Your environments are separate exports in Postman (Environments β β― β Export): select them together with the collection, or import each one later, and each becomes .env.<name>. A globals export becomes .env, which every environment shares (or .env.<name> if the folder already has a .env). Disabled variables are left out.
| 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 stay, switched off (# Name: value) |
| Request description | A description field in the request file |
| Raw body | Body |
| GraphQL body | The JSON body Postman sends ({"query": β¦, "variables": β¦}), with Content-Type: application/json |
| URL-encoded body | A Form body, with the matching Content-Type |
| Form-data body | A Multipart body. File fields arrive switched off: tick one once you've checked which file it uploads |
| 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. Path variables are filled in (/users/:userId with value 42 becomes /users/42), or become {{userId}} when the collection has no value for them. A raw body's language (JSON, XML, text) sets the Content-Type Postman would have sent. Postman's built-in {{$guid}}, {{$timestamp}}, {{$isoTimestamp}} and {{$randomInt}} work as they are. 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, and binary-file 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β
In Insomnia, use Export on a collection (v5 YAML, Insomnia 10 and later) or Export Data (v4 JSON or YAML, older versions). Both work.
| Insomnia | Mercury |
|---|---|
| Folder (any depth) | Folder, with the same nesting |
| Request outside any folder | <name>.json at the top |
| Sub-environment (Dev, Productionβ¦) | .env.<name>, including the base environment's values (Insomnia merges them the same way) |
| Base environment with no sub-environments | .env.<collection-name> |
{{ _.base_url }} | {{base_url}}; nested values (_.api.url) become api.url |
| Bearer, API key and Basic auth | The Authorization (or API key) header, or a query parameter |
| JSON / text body | Body, with its Content-Type |
| GraphQL body | Its JSON body, with Content-Type: application/json |
| Form URL-encoded / Multipart body | A Form / Multipart body. File fields arrive switched off |
| Headers | Headers; disabled ones stay, switched off |
| Description | A description field in the request file |
Named in the notification, because Mercury can't express them: OAuth 2 and other token-exchange auth, Basic auth whose username or password is a variable (the header is base64, which would hide it), a file as the whole body, and template tags such as {% response %} or {% uuid %}.
workspace/
βββ .env.dev
βββ .env.production
βββ users/
β βββ admin/
β β βββ ban-user.json
β βββ get-user.json
β βββ list-users.json
βββ health.json
Import from cURLβ
Paste a command that starts with curl into the URL bar. Mercury parses it into the method, URL, headers and body. Pasted over a saved request, it opens as a new unsaved request instead, so the file is never overwritten. Typing curl β¦ by hand is left alone; only a paste converts. 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 (Name; is a header with an empty value, as in curl) |
-d, --data, --data-raw, --data-binary | Body. Changes a GET to POST, unless the command says -X GET. Repeated flags are joined with &, as curl does. Without a Content-Type header, adds application/x-www-form-urlencoded, which is what curl sends. |
--data-urlencode | Body, percent-encoded: in name=value only the value is encoded. |
--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, with any -d data appended to the URL as the query string |
-F, --form, --form-string | A Multipart body, one field per -F (name=@path is a file; curl's ;type= is dropped). Changes a GET to POST. Copy as cURL writes Multipart bodies back as -F. |
-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. A value glued to a short flag (-XPOST, -HAccept:text/plain), short flags sharing one dash (-sX POST, -sI) and bash's $'β¦' quoting, which Chrome uses when a body contains a quote or a newline, all work.
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.
- The body goes in
--data-raw, so one starting with@is sent as text, not read from a file. AHEADrequest is-I, a URL with[ ]or{ }gets-gso curl doesn't read it as a pattern, and a header with an empty value is writtenName;. - Pasted back into the URL bar, the command gives the same request.
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.