Importers
recon import converts requests from other tools into Recon’s model. Without --save it only prints what it found. With --save it writes one .http file into your collections directory and one .toml file per environment.
Quick start
Section titled “Quick start”Preview an inline curl command:
recon --format human import "curl -L https://api.example.com/health"Imported 1 request(s) and 0 environment(s) from curlSave a Postman collection into the workspace:
recon --format human import src/pm.json --saveImported 5 request(s) and 1 environment(s) from postmanThis writes collections/postman-import.http and environments/shop-api.toml. Use --format json to see the full result, including the converted requests and any warnings.
recon import
Section titled “recon import”recon import [OPTIONS] <SOURCE>| Argument or flag | Default | Meaning |
|---|---|---|
<SOURCE> |
required | A file path, a directory, or an inline curl command. If a file or directory exists at that path, it is read. Otherwise the text itself is imported. |
--type <KIND> |
auto |
auto, curl, postman, insomnia, bruno (or bru), openapi (or swagger), har. Case-insensitive. |
--save |
off | Write the result into the workspace. |
Global flags such as --workspace and --format apply. Human output is the single summary line shown above. JSON output (--format json, --format agent, or piped auto) is the import bundle:
{ "detected_format": "curl", "requests": [ { "id": "imported-curl", "name": "POST https://api.example.com/v1/users?dry=1", "folder": null,... "follow_redirects": false } ], "environments": [], "warnings": []}Only the HAR importer adds warnings. They are shown only in JSON output.
Where --save writes
Section titled “Where --save writes”| Output | Path | Notes |
|---|---|---|
| Requests | <collections_dir>/<format>-import.http, for example collections/curl-import.http |
One file per format. Written only if at least one request was imported. |
| Environments | <environments_dir>/<name>.toml |
One file per environment. |
Saved requests get the IDs <format>-import-<n> in the printed bundle. When the file is loaded again, IDs come from the file name and request name as usual, for example postman-import-search-orders. See Names and IDs.
The file is written with the standard .http writer, so its limits apply: disabled headers and parameters are dropped, form and multipart bodies are reloaded as text, and query values with spaces break. See How files are written back.
Imported values are copied as they are. Tokens and passwords in curl flags, Postman auth blocks or HAR headers end up in plain text in the .http file. Move them into secret environment variables before you commit the file.
Format detection
Section titled “Format detection”With --type auto, Recon checks these rules in order and uses the first that matches:
- The source is a directory: Bruno (every
.brufile inside it). - The file extension is
.bru: Bruno. The extension is.har: HAR. - The text starts with
curl(orcurlfollowed by a tab or newline): curl. - The text is a JSON object and:
- has an
openapiorswaggerkey: OpenAPI; - has
log.entries: HAR; - has
"_type": "export"or aresourceskey: Insomnia; - has both
infoanditem, or has_postman_variable_scope: Postman.
- has an
- The text contains
meta {and one ofget {,post {,put {,delete {,patch {: Bruno. - The text is a YAML mapping with an
openapiorswaggerkey (OpenAPI) or_type: export(Insomnia).
If nothing matches:
failed to import auto payload: unable to detect import format; specify curl, postman, insomnia, bruno, openapi, or har explicitlyA directory is always imported as Bruno, whatever --type says.
Recon joins backslash-continued lines, splits the command like a POSIX shell (single quotes, double quotes, backslash escapes), and reads these flags. Each flag must be a separate token.
| Flag | Mapped to |
|---|---|
-X, --request |
Method. |
--url |
URL. |
first argument that does not start with - |
URL, if none is set yet. |
-H, --header |
A header, split at the first :. A value without : is dropped. |
-d, --data, --data-raw, --data-binary, --data-ascii, --data-urlencode |
Body. Several data flags are joined with &. Values are not URL-encoded. |
--json |
Body, plus Content-Type: application/json if no Content-Type header was given. |
-u, --user |
Basic auth, split at the first :. No : means an empty password. |
-A, --user-agent |
User-Agent header. |
-L, --location |
Follow redirects. |
-s, --silent, -S, --show-error, -i, --include, -v, --verbose, -k, --insecure, --compressed |
Ignored. |
Other rules:
- Without
-X, the method isPOSTif there is a body andGETotherwise. - The body is JSON if a
Content-Typeheader containsjsonor the body starts with{or[. Otherwise it is text. - Redirects are off unless
-Lor--locationis present, so a saved curl import gets# @no-redirect. - The query string stays in the URL. The request name is
METHOD URL.
Limits you should know about:
- Combined short flags are not understood.
-sSLis ignored as a whole, so-Linside it is lost. - Unknown flags are skipped, but their values are not. In
curl -o out.json https://api.example.com/x, the URL becomesout.json, because it is the first argument without a leading-. Put the URL first, or remove flags such as-o,-F,-band-ebefore importing. - Multipart (
-F), cookies (-b) and output options are not imported.
Errors: a command that does not start with curl fails with expected command starting with `curl` . A command with no URL fails with no URL found inside curl command.
Postman
Section titled “Postman”Recon reads Postman Collection v2.1 JSON and Postman environment JSON.
Collections
Section titled “Collections”| Postman | Recon |
|---|---|
Folders (nested item arrays) |
# @folder, nested names joined with /, for example Orders/Admin. |
Request name |
Name. Missing names become Unnamed Request. |
request.method |
Method. Default GET. |
request.url as a string |
URL, with the query string kept in it. |
request.url as an object |
URL from raw up to the first ?; query parameters from the query array. host and path arrays are not used. |
request.header |
Headers. Entries with "disabled": true are kept as disabled (and dropped when saved). |
body.mode: raw |
JSON if options.raw.language is json or the text starts with {; otherwise text. |
body.mode: urlencoded |
URL-encoded form fields, keeping the disabled flag. |
body.mode: formdata |
Multipart parts. src becomes the file name, contentType the part content type. File contents are not read. |
other body modes (graphql, file, …) |
No body. |
request.auth |
See the auth table below. |
event on a request item |
Pre- and post-scripts, translated. See below. |
Collection variable array |
One environment named after the collection: lower-cased, spaces replaced with - (Shop API becomes shop-api). |
Collection-level auth and event, and folder-level auth and event, are not imported. Path variables such as :id are left as written.
Collection variables whose key contains secret, token, key or pass (case-insensitive) become secret variables with an empty allowed_hosts list. The rest are plain.
Postman auth.type |
Recon @auth kind |
Notes |
|---|---|---|
bearer |
bearer |
token |
basic |
basic |
username, password |
apikey |
api_key |
key (default X-Api-Key), value, in: query gives location: query, anything else header |
awsv4 |
aws_sigv4 |
accessKey, secretKey, sessionToken, region (default us-east-1), service (default execute-api) |
oauth2 |
oauth2 |
grant_type authorization_code or authorization_code_with_pkce gives authorization_code, refresh_token gives refresh_token, anything else client_credentials. Also accessTokenUrl, authUrl, clientId, clientSecret, scope. PKCE is on. |
anything else (digest, noauth, …) |
none |
Script translation
Section titled “Script translation”Recon converts the prerequest event to # @pre-script and the test event to # @post-script. Each script line is handled on its own:
| Postman line | Rhai output |
|---|---|
pm.environment.set(k, v), pm.variables.set(...), pm.collectionVariables.set(...), pm.globals.set(...) |
env_set(k, v); with single quotes turned into double quotes. The value expression is copied as is. |
pm.response.to.have.status(200) |
expect(res.status == 200, "<label>"); |
pm.expect(pm.response.code).to.eql(201) |
expect(res.status == 201, "<label>"); |
console.log(...) |
log(...); with single quotes turned into double quotes. |
pm.test("Name", function () { and its closing }); |
Removed. Name becomes the label of the status checks inside it. Outside a test, the label is status == <code>. |
| blank line | Removed. |
| any other line | Kept as a Rhai comment: // [postman] <line> |
For example, this test script:
pm.test("Status is 200", function () { pm.response.to.have.status(200);});pm.expect(pm.response.code).to.eql(201);pm.collectionVariables.set("last", pm.response.json().id);becomes:
# @post-script expect(res.status == 200, "Status is 200");# @post-script expect(res.status == 201, "status == 201");# @post-script env_set("last", pm.response.json().id);The last line keeps the JavaScript expression pm.response.json().id, which is not valid Rhai. Review translated scripts before you run them. The Rhai functions are described in Pre/Post Scripting.
Environments
Section titled “Environments”A Postman environment file (one with _postman_variable_scope, or with values and no item) becomes one environment:
- The name is the file’s
name, lower-cased with spaces replaced by-(Shop Stagingbecomesshop-staging). Defaultpostman-env. - Entries with
"enabled": falseare skipped. - Entries with
"type": "secret", or whose key containssecret,token,keyorpass, become secret variables with an emptyallowed_hostslist. Other entries are plain.
base_url = "https://staging.shop.example.com"
[client_password]value = "pw"secret = trueallowed_hosts = []allow_query_param = falselabel = "client_password"An empty allowed_hosts list does not restrict where the secret may go. Add hosts before you use it; see Outbound Secret Firewall.
Insomnia
Section titled “Insomnia”Recon reads Insomnia v4 exports in JSON or YAML. The export must have a resources array, or the import fails with missing `resources` array in Insomnia export.
| Insomnia resource | Recon |
|---|---|
request_group |
Folder name. Nested groups are joined with /, for example Core/Health. |
request |
One request: name (default Insomnia Request), method (default GET), url, headers and parameters (with their disabled flags), body.text. |
request.authentication bearer |
bearer with token. |
request.authentication basic |
basic with username and password. |
| other authentication types | none. |
environment |
One environment, named from name (lower-cased, spaces replaced by -). Every value in data becomes a plain variable; non-string values are stored as their JSON text (3 becomes "3"). |
A body is JSON if body.text starts with { or [, otherwise text. Other body forms (form fields, files) are not imported. Other resource types, such as workspaces and cookie jars, are ignored.
Recon reads Bruno .bru files. Pass a single file, or a directory to import every .bru file under it (recursively, in sorted path order). Each file gives one request.
.bru block |
Recon |
|---|---|
meta |
name sets the request name. Other keys are ignored. |
get, post, put, patch, delete, head, options |
Method, and url from inside the block. |
headers |
Headers. |
query or params:query |
Query parameters. |
auth:bearer |
bearer with token. |
auth:basic |
basic with username and password. |
body:json |
JSON body (block content, trimmed). |
body:text, body:xml, body:graphql |
Text body. |
body:form-urlencoded |
URL-encoded form fields. |
anything else (script:*, tests, vars:*, assert, docs, other auth and body blocks) |
Ignored. |
In key-value blocks, each line is split at its first :. Lines starting with # or ~ (disabled entries in Bruno) are skipped. Without a name, the request is named METHOD URL.
The folder comes from the path:
- In a directory import, it is the file’s directory relative to the imported directory.
users/list.brugets# @folder users; files at the top level get no folder. - In a single-file import, it is the directory part of the path you typed.
recon import src/bru/create.brugets the foldersrc/bru.
A file with no method block fails with no HTTP method block (`get { url: ... }`) found in .bru file. A directory with no .bru files fails with no supported collection files found under `<dir>` . Bruno environment files (environments/*.bru) have no method block, so importing a collection directory that contains them fails; import the request folders instead.
OpenAPI
Section titled “OpenAPI”Recon reads OpenAPI documents in JSON or YAML. It accepts anything with an openapi or swagger key, but it only reads servers, paths and requestBody, which are OpenAPI 3 fields.
- Environment. The first
servers[].url, without a trailing/, becomesbase_urlin an environment namedlocal. Withoutservers,base_urlishttp://127.0.0.1:8080. - Requests. One request per operation, for the methods
get,post,put,patch,delete,headandoptions, in that order within each path. The URL is{{base_url}}followed by the path as written. - Name.
summary, elseoperationId, elseMETHOD /path. - Folder. The first tag.
- Parameters.
in: queryparameters become query parameters andin: headerparameters become headers. The value is the parameter’sexampleif it is a string, otherwise{{<name>}}. Path and cookie parameters are skipped, so/pets/{petId}keeps its single-brace placeholder, which Recon does not resolve. - Body. Only
requestBody.content["application/json"]. It addsContent-Type: application/json. The body is the media type’sexample, pretty-printed, or{and}on two lines when there is no example. Schemas are not used to build bodies. - Assertion. Every request gets
# @assert status in 200..299. $refreferences are not followed. A document withoutpathsfails withmissing `paths` object in OpenAPI document.
### listPets# @name listPets# @folder pets# @assert status in 200..299GET {{base_url}}/pets?limit=25X-Request-Id: {{X-Request-Id}}To validate responses against a spec instead of importing it, see OpenAPI & ODCS Contracts.
Recon reads HAR 1.2 JSON (as saved from browser developer tools). The file must have log.entries, or the import fails with missing `log.entries` array in HAR file.
- Each entry’s
requestbecomes one request namedMETHOD URL, in the folderHAR Capture. - URLs whose path ends in
.png,.jpg,.jpeg,.gif,.svg,.webp,.woff,.woff2,.ttf,.cssor.icoare skipped, and a warning such asFiltered 1 static asset requestsis added..jsfiles are not skipped. - All headers are kept except HTTP/2 pseudo-headers that start with
:. That includesCookieandAuthorization. postData.textbecomes the body: JSON if it starts with{or[, otherwise text.- The query string stays in the URL. Responses, timings and cookies arrays are not imported.
Errors
Section titled “Errors”Import errors are reported as E_CLI_RUNTIME with exit status 2. All of them start with failed to import <format> payload:.
| Message | Cause |
|---|---|
failed to import yaml payload: expected auto|curl|postman|insomnia|bruno|openapi|har |
Unknown --type value (here yaml). |
failed to import auto payload: unable to detect import format; ... |
Auto-detection found nothing. |
failed to import curl payload: no URL found inside curl command |
No URL in the curl command. |
failed to import <format> payload: <parser message> |
Invalid JSON or YAML for an explicitly chosen format. |
failed to import directory payload: no supported collection files found under ... |
Empty directory import. |
Also available via
Section titled “Also available via”- HTTP API:
POST /api/v1/importwith{"payload": "...", "format": "auto", "save": false}returns{"bundle": {...}}. It takes text only, not paths or directories. When saving, it renames only IDs that start withimported-orpm-. See HTTP API. - Web UI: the Import dialog (“Import Collection or cURL (Auto-Detect)”) accepts pasted text with a format picker and saves with “Import & Save .http”. Pasting a curl command into the URL field of the request editor fills the current request from it (through the same endpoint, without saving). See Web Studio.
- There is no MCP tool for importing.