Open App

Output formats

json, table, csv, and error schema

The CLI can output data as JSON, a table, or CSV. You choose the format with the global --output flag (short -o).

Choosing a format

monoid --output json organisations list
monoid -o table projects list
monoid -o csv tasks list

Allowed values: json, table, csv.

Default behaviour

  • When stdout is a TTY (e.g. you run the command in a terminal), the default is table for human-readable output.
  • When stdout is not a TTY (e.g. piping or redirecting), the default is json so scripts and tools can parse the result.

Examples:

monoid organisations list              # table (TTY)
monoid organisations list | cat       # json (piped)
monoid organisations list > out.txt   # json (redirected)

Error output

When a command fails (e.g. 401 Unauthorized, 404 Not Found), the CLI exits with a non-zero code and can print a structured error payload.

JSON error shape (when output format is json or when not a TTY):

{
  "error": true,
  "status": 401,
  "code": "UNAUTHORIZED",
  "message": "Missing or invalid token"
}

Exit codes:

  • 1 — Auth-related (e.g. 401, 403).
  • 2 — Other errors (e.g. 404, 500, validation).

Examples by format

Same command, different formats:

Table (default in TTY):

monoid -o table organisations list

JSON:

monoid -o json organisations list

CSV:

monoid -o csv organisations list

Use --output (or -o) consistently in scripts so behaviour is predictable.