Skip to content

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.

Preview an inline curl command:

Terminal window
recon --format human import "curl -L https://api.example.com/health"
Imported 1 request(s) and 0 environment(s) from curl

Save a Postman collection into the workspace:

Terminal window
recon --format human import src/pm.json --save
Imported 5 request(s) and 1 environment(s) from postman

This 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 [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.

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.

With --type auto, Recon checks these rules in order and uses the first that matches:

  1. The source is a directory: Bruno (every .bru file inside it).
  2. The file extension is .bru: Bruno. The extension is .har: HAR.
  3. The text starts with curl (or curl followed by a tab or newline): curl.
  4. The text is a JSON object and:
    • has an openapi or swagger key: OpenAPI;
    • has log.entries: HAR;
    • has "_type": "export" or a resources key: Insomnia;
    • has both info and item, or has _postman_variable_scope: Postman.
  5. The text contains meta { and one of get {, post {, put {, delete {, patch {: Bruno.
  6. The text is a YAML mapping with an openapi or swagger key (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 explicitly

A 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 is POST if there is a body and GET otherwise.
  • The body is JSON if a Content-Type header contains json or the body starts with { or [. Otherwise it is text.
  • Redirects are off unless -L or --location is 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. -sSL is ignored as a whole, so -L inside it is lost.
  • Unknown flags are skipped, but their values are not. In curl -o out.json https://api.example.com/x, the URL becomes out.json, because it is the first argument without a leading -. Put the URL first, or remove flags such as -o, -F, -b and -e before 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.

Recon reads Postman Collection v2.1 JSON and Postman environment JSON.

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

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.

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 Staging becomes shop-staging). Default postman-env.
  • Entries with "enabled": false are skipped.
  • Entries with "type": "secret", or whose key contains secret, token, key or pass, become secret variables with an empty allowed_hosts list. Other entries are plain.
base_url = "https://staging.shop.example.com"
[client_password]
value = "pw"
secret = true
allowed_hosts = []
allow_query_param = false
label = "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.

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.bru gets # @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.bru gets the folder src/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.

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 /, becomes base_url in an environment named local. Without servers, base_url is http://127.0.0.1:8080.
  • Requests. One request per operation, for the methods get, post, put, patch, delete, head and options, in that order within each path. The URL is {{base_url}} followed by the path as written.
  • Name. summary, else operationId, else METHOD /path.
  • Folder. The first tag.
  • Parameters. in: query parameters become query parameters and in: header parameters become headers. The value is the parameter’s example if 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 adds Content-Type: application/json. The body is the media type’s example, 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.
  • $ref references are not followed. A document without paths fails with missing `paths` object in OpenAPI document.
### listPets
# @name listPets
# @folder pets
# @assert status in 200..299
GET {{base_url}}/pets?limit=25
X-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 request becomes one request named METHOD URL, in the folder HAR Capture.
  • URLs whose path ends in .png, .jpg, .jpeg, .gif, .svg, .webp, .woff, .woff2, .ttf, .css or .ico are skipped, and a warning such as Filtered 1 static asset requests is added. .js files are not skipped.
  • All headers are kept except HTTP/2 pseudo-headers that start with :. That includes Cookie and Authorization.
  • postData.text becomes 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.

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.
  • HTTP API: POST /api/v1/import with {"payload": "...", "format": "auto", "save": false} returns {"bundle": {...}}. It takes text only, not paths or directories. When saving, it renames only IDs that start with imported- or pm-. 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.