SePay CLI output formats

Choose table, JSON or YAML output for SePay CLI commands, see which lines go to stdout and which to stderr, and how tables shrink to fit the terminal.

||

SePay CLI prints results as a table for you to read. To feed them to a script or jq, add --json (or -o json), or -o yaml for YAML.

Choose a format

FlagResult
None (-o table)A table, one row per record. Commands that show one record, such as transaction get and bank-account get, print a two-column FIELD, VALUE table
--json, -o jsonJSON. List commands return an array, show commands an object
-o yamlYAML, with the same structure as the JSON

Show a bank account as JSON:

$ sepay bank-account get 832529c1-xxxx-xxxx-xxxx-fa163e2f7c98 --json{"id": "832529c1-xxxx-xxxx-xxxx-fa163e2f7c98","account_holder_name": "NGUYEN VAN A","account_number": "0000000001","accumulated": 0,"last_transaction": null,"label": "Cua hang Quan 1","account_type": "individual","active": 1,"created_at": "2026-10-17 15:00:19","bank_short_name": "ACB","bank_full_name": "Ngân hàng TMCP Á Châu","bank_bin": "970416","bank_code": "ACB"}

Field names in JSON and YAML match the SePay API fields, not the table's column headers. JSON keeps &, < and > in URLs and text as they are, never as \u0026.

--json and -o yaml also work with sepay --version and sepay version:

$ sepay --version --json{"arch": "amd64","commit": "xxxxxxx","date": "YYYY-MM-DD","go_version": "go1.x.x","os": "linux","version": "x.x.x"}

stdout and stderr

stdout carries only data, so you can pipe it into jq or write it to a file. Everything else goes to stderr:

  • The env: sandbox line naming the active environment. It's left out with --json, -o yaml or -q.
  • The pagination line of list commands, such as page 1/24 · 2 of 48, with a hint to use --page and --per-page when more pages remain.
  • Errors and warnings. With --json, errors are JSON too, see the error format.

How a script reads data, errors and exit codes is in Use SePay CLI in scripts.

Tables in a narrow terminal

When the terminal is narrower than the table, the CLI tightens the gaps between columns and cuts free-text columns such as the transfer content, marking the cut with …. ID, amount and code columns stay whole:

$ sepay transaction list --per-page 2env: sandboxID                                    DATE                 AMOUNT    CONTENT  CODE    BANK    WH07ad3dc9-xxxx-xxxx-xxxx-0afffe87053b  2026-10-31 11:24:40  +50.000   Giao d…  DH1709  ACB     fail3e75c65e-xxxx-xxxx-xxxx-a6006ab65aca  2026-10-20 00:33:49  +100.000  Giao d…  -       MBBank  fail

If it still doesn't fit after that, the table wraps. When the output is piped to another command or written to a file, the table keeps every character. For complete data in a script, use --json.

Return only some fields

transaction list takes --fields so the API returns only the fields you need. The other fields are still in the JSON but empty or null; in the table they show (hidden):

$ sepay transaction list --per-page 1 --fields id,amount_in,code --json[{  "id": "07ad3dc9-xxxx-xxxx-xxxx-0afffe87053b",  "transaction_date": "",  "account_number": "",  "va": null,  "transfer_type": "",  "amount_in": 50000,  "amount_out": null,  "accumulated": null,  "transaction_content": null,  "reference_number": null,  "code": "DH1709",  "bank_brand_name": "",  "bank_account_id": "",  "va_id": null,  "webhook_success": null}]

Colors

The CLI uses color only when it prints to a terminal. Turn it off for one command with --no-color, or for every command with the NO_COLOR=1 environment variable (NO_COLOR=0 keeps color on), see Environment variables.