Import API collections from the command line

The app's import dialog is the easy way to bring one collection in. The CLI is the repeatable way: the same command for twenty files, in a script, in CI, or on a server with no desktop.

The basics

Terminal
requestarium import orders.postman_collection.json
requestarium import openapi.yaml --name "Billing API" --environments
requestarium import https://api.example.com/openapi.yaml
cat export.json | requestarium import -

The format is detected from the content: Postman v2.0/v2.1, OpenAPI 3 and Swagger 2 (JSON or YAML), Requestarium JSON, Insomnia v4 and v5, Thunder Client, Bruno (a folder, its zip, or one .bru file), Hoppscotch, HAR, .http files, and curl commands. A URL is downloaded by the CLI, up to 20 MB.

Look before you import

Terminal
requestarium import big-export.json --preview

--preview lists the folders and requests as paths, with notes about anything that can't come over, and creates nothing. --dry-run goes one step further and shows exactly what would be created where.

Only part of a file

A Postman export with 300 requests, of which you need the Orders folder and one health check:

Terminal
requestarium import big-export.json --select "Orders" --select "Health/Ping"
requestarium import big-export.json --select "**/Login"

* matches within one name, ** across folders. A path that matches nothing stops the import, so a typo doesn't quietly import nothing.

Merge into a collection you already have

Terminal
requestarium import orders-v2.postman_collection.json --into "Shop API" --folder "Orders" --on-conflict skip --dry-run

Folders are matched by path and requests by folder path and name:

--on-conflictWhen a request already exists
skipkeep yours
overwritereplace it with the file's version (it keeps its history)
keep-bothadd the file's as "Name (2)"

Requests that are already identical are skipped either way, so running the same merge twice changes nothing. Check with --dry-run, then run it without.

Secrets

Exports are full of pasted tokens. Decide what happens to them:

Terminal
requestarium import export.json --secrets store
  • store moves each secret into a secret environment variable and replaces it in the requests with a {{variable}}.
  • empty does the same, without the values.
  • keep imports them as they are.

For full control over which environment each variable goes to, see import without leaking secrets.

Scripts

Postman, Insomnia, Bruno, Hoppscotch and Thunder Client scripts are converted to the pm API by default. For a full list of what was converted and what wasn't:

Terminal
requestarium import export.json --preview --script-report scripts.md

More in Postman scripts compatibility.

Many files at once

Terminal
for f in exports/*.postman_collection.json; do
  requestarium import "$f" --secrets store || echo "✗ $f"
done

Each import is recorded in the import history, so you can undo one without touching the others: requestarium import history, then requestarium import undo ID. See undo an import.