Features

Beta
View as Markdown
Early access

The CLI generator is in early access. Reach out to get started.

Generated CLIs ship with a common set of runtime flags and environment variables: output formatting, pagination, dry-run previewing, TLS and proxy configuration, exit codes, and structured logging. APIs with templated server URLs also expose per-variable flags and environment variables.

Output formatting

Use the --format flag to control how responses are displayed.

FormatFlagDescription
JSON--format jsonDefault. Pretty-printed JSON.
Table--format tableColumnar table. Nested objects flatten to parent.child column names.
YAML--format yamlYAML representation of the response.
CSV--format csvComma-separated values, suitable for piping into spreadsheet tools.
$# Display plants in a table
$contoso plants list --format table
$
$# Export orders as CSV
$contoso orders list --format csv > orders.csv

Dry-run mode

Pass --dry-run to validate arguments and preview the HTTP request without sending it. The CLI prints the method, URL, headers, and body it would send, then exits.

$contoso plants get --params '{"plantId": "abc"}' --dry-run

Pagination

For endpoints annotated with x-fern-pagination, the CLI auto-paginates when the --page-all flag is set.

FlagDescriptionDefault
--page-allFetch every page and emit one JSON line per page (NDJSON).Off
--page-limit <N>Maximum number of pages to fetch.10
--page-delay <MS>Delay in milliseconds between page requests.100
$# Fetch all plants, one JSON line per page
$contoso plants list --page-all
$
$# Limit to 5 pages with a 200 ms delay
$contoso plants list --page-all --page-limit 5 --page-delay 200

Paginated output works with all output formats. For table and CSV formats, headers are only emitted on the first page so the output concatenates cleanly.

Passing parameters

FlagPurpose
--params <JSON>URL path and query parameters as a JSON object.
--json <JSON>Request body for POST, PUT, and PATCH methods.
$# Path + query parameters
$contoso plants get --params '{"plantId": "abc"}'
$
$# Request body
$contoso plants create \
> --json '{"name": "Monstera", "species": "Monstera deliciosa", "sunlight": "indirect"}'

Server URL variables

For APIs with templated server URLs (such as https://api.example.com/stores/{store_hash}/v3), the CLI automatically exposes each template variable as a CLI flag and environment variable.

$# Pass the variable as a flag
$bigcommerce --store-hash abc123 v3 customers list
$
$# Or set it via an environment variable
$export BIGCOMMERCE_STORE_HASH=abc123
$bigcommerce v3 customers list

File uploads and downloads

For endpoints with format: binary request bodies, pass a file path as the --file argument. For binary responses, use --output <PATH> to save the response body to a file.

Exit codes

CodeMeaningExample cause
0SuccessCommand completed normally.
1API errorServer returned a 4xx/5xx response.
2Auth errorCredentials missing or invalid.
3Validation errorBad arguments, unknown command, or invalid JSON.
4Discovery errorCouldn’t load API schema.
5Internal errorUnexpected failure.

All errors are emitted as structured JSON on stderr, making them easy to parse in scripts and CI pipelines.

TLS, proxies, and CA bundles

Every generated CLI honors environment variables for TLS and proxy configuration at runtime. Variables are scoped by binary name — <NAME> is the CLI’s binary name uppercased with hyphens mapped to underscores (for example, CONTOSO).

VariableEffect
<NAME>_CA_BUNDLEPath to a PEM file appended to the default trust roots.
<NAME>_INSECURE=1Disable TLS verification. Logs a warning. Not for production use.
<NAME>_PROXYHTTP/HTTPS proxy URL, overriding HTTPS_PROXY / HTTP_PROXY.
<NAME>_NO_PROXYComma-separated proxy bypass list scoped to this CLI.
<NAME>_TIMEOUT_SECSTotal request timeout. None by default.
<NAME>_CONNECT_TIMEOUT_SECSConnection-establishment timeout.

Standard environment variables (HTTPS_PROXY, HTTP_PROXY, NO_PROXY, SSL_CERT_FILE) are honored when the scoped overrides are absent.

Behind a MITM proxy (Proxyman, Charles, mitmproxy):

$export SSL_CERT_FILE=~/path/to/proxyman-ca.pem
$export HTTPS_PROXY=http://127.0.0.1:9090
$contoso plants list

Corporate network with a custom root CA:

$export CONTOSO_CA_BUNDLE=/etc/ssl/corp-roots.pem
$contoso plants list

Structured logging

Logging is off by default. Set <NAME>_LOG to a tracing filter to emit structured logs to stderr. Set <NAME>_LOG_FILE to a directory path to write daily rotated JSON log files.

$CONTOSO_LOG=debug contoso plants list