OverviewProductsPlatformsAPI ReferenceResources

Options and output

Discover commands, use global flags, parse JSON output, follow pagination, and distinguish API failures from CLI parser errors.


Use command help as the source of truth for the installed CLI. API field names and CLI flag names are not always the same.

First command

Terminal
zernio --help
zernio posts:update --help

The first command lists available commands. The second prints positional arguments, supported flags, and required inputs without updating a post.

Commands

These options work across commands:

OptionResult
--help, -hPrint help
--version, -vPrint the installed CLI version
--prettyIndent JSON output

JSON is already the default. There is no global --json, --token, --body, or --yes flag. Supply credentials through authentication and use only the flags registered by each command.

Inputs

Input shapeExampleRule
Positional IDzernio posts:get "$POST_ID"Order matters; discover the ID first
Comma-separated IDs--accounts "$ACCOUNT_ID,$OTHER_ACCOUNT_ID"Used by posts:create
JSON value--media-json '[{"type":"image","url":"https://example.com/photo.jpg"}]'Quote JSON as one shell argument
Command-specific field--text on create; --content on updateDo not infer from API field names

Generated commands can have longer names, such as adcampaigns:list-ad-campaigns. Do not shorten them to match another command group.

Output and errors

Capture API output and the exit status before parsing. This example reads only:

Terminal
if zernio accounts:list > accounts.json 2> cli-error.txt; then
  jq '.accounts' accounts.json
else
  printf '%s\n' 'CLI request failed; inspect cli-error.txt' >&2
fi

Command-handler failures normally exit 1 and write this shape to stderr:

JSON
{"error":true,"message":"Request failed","status":403}

status is optional. This is the CLI error wrapper, not the original API response body. Do not depend on API-only fields being present in stderr.

Help and version output are text. Unknown commands, unknown flags, and missing required inputs produce parser diagnostics, not this JSON shape. auth:login also writes text progress to stderr.

Pagination

CommandPagination inputsContinue with
posts:list--page, --limitNext page number; defaults are page 1, limit 10
analytics:posts--page, --limitNext page number; default limit is 50
inbox:conversations--cursor, --limitReturned pagination.nextCursor while hasMore is true; default limit is 20

Check each response and command help. Pagination is not uniform across groups, and the CLI does not fetch every page automatically.

How it behaves

  • --pretty changes formatting, not response fields.
  • A zero exit status means the handler succeeded, not that every asynchronous operation completed. Inspect response statuses and per-target results.
  • Errors can include private request details. Redact credentials and customer data before sharing logs.
  • If a documented API field has no CLI flag, use the API or SDK rather than inventing a flag.
Was this page helpful?

On this page