Skip to content
DunSocial Docs

Flags and output

Reference for the DunSocial CLI's global flags, JSON output shape, environment variables, and exit codes, for scripting and CI use of the dun command.

Global flags

Flag Purpose
--json / -j Machine-readable output (default in CI / non-TTY)
--workspace / -w Override workspace for this command
--api-url Override API base URL
--token Override bearer token for this command
--debug Log HTTP method/path/status to stderr
--quiet / -q Suppress human success output
--yes / -y Skip destructive confirmations
--help / -h Help
--version / -v Version

Env vars

Variable Purpose
DUN_TOKEN Bearer token
DUN_WORKSPACE_ID Default workspace
DUN_API_URL API base
DUN_CONFIG Config file path
DUN_JSON=1 Force JSON (0 forces human)
DUN_DEBUG=1 Debug HTTP
CI=1 Treat as CI (JSON + --yes)

Success and error JSON

Success:

{
"ok": true,
"data": { }
}

Failure:

{
"ok": false,
"error": {
  "code": "validation",
  "message": "Missing --text",
  "details": null
}
}

Progress and debug lines go to stderr, so scripts can parse stdout safely.

Exit codes

Code Meaning
0 Ok
1 Usage / unknown command
2 Auth
3 Forbidden / missing scope
4 Validation
5 Not found
6 Rate limited
7 Network

Help

dun --help
dun posts --help
dun auth --help

Common pitfalls

  • Need a workspace: workspace use or --workspace / DUN_WORKSPACE_ID
  • --accounts wants DunSocial account ids, not handles
  • Upload local files with media upload before attaching
  • Platform options go in --meta '{…}'
  • Destructive delete needs --yes unless CI=1