Skip to the page

Output and scripts

Tables for people, JSON for programs, and exit codes a script can trust.

What it prints

In a terminal, a list is a table and one item is a list of its fields. Anywhere else, such as a pipe, a file or a CI job, a command prints the answer of the API as JSON, as it came. --json asks for JSON in a terminal too.

Shell
opensend emails get em_02 | jq -r .status

Notes meant for a person, such as one that says there are more pages, go to the error stream, so they never mix with the JSON.

Every page of a list

A list answers one page at a time. --all reads every page and prints them as one list, and --max stops after that many items, with or without --all. A read the API answers with 429, 502, 503 or 504 is tried up to three times in all, after the wait it asks for.

Shell
opensend emails list --all --max 500 | jq '.data | length'

See the request first

--dry-run prints the request a command would send, its verb, address and body, and sends nothing. It works before you sign in. Commands that act only on this computer, such as login and mcp serve, refuse it.

Shell
opensend emails send --to ada@example.com --subject Hi --text Hello --dry-run

Removing things

A command that deletes something asks first when it runs in a terminal: every command the reference marks as removing, and api with DELETE. Anywhere else it refuses unless it has --yes, and --no-input makes it refuse instead of asking, even in a terminal. Ctrl+C at the question stops it with code 130.

Shell
opensend domains remove dom_02 --yes

Errors

An error goes to the error stream: its message, then its code, the HTTP status and the request id when there is one. With --json it is one JSON object, { "error": { ... } }, with the same four fields. The code is the API's own when the API answered, and the one in this table when the command stopped by itself.

Exit
0
Code
Meaning
It worked.
Exit
1
Code
failed
Meaning
The API refused the request, or something else failed.
Exit
2
Code
usage
Meaning
A command, a flag or a value is wrong. Nothing was sent.
Exit
3
Code
signed_out
Meaning
No key was found, or the API refused it.
Exit
4
Code
not_found
Meaning
What the command names does not exist.
Exit
5
Code
rate_limited
Meaning
Too many requests. Wait a moment, then try again.
Exit
6
Code
unreachable
Meaning
The API could not be reached, or failed on its side.
Exit
7
Code
unconfirmed
Meaning
A removal was not confirmed, so nothing was removed.
Exit
130
Code
Meaning
Stopped with Ctrl+C.

Versions

The command line follows semantic versioning. A minor version adds commands and flags. A major version is the only one that removes or changes one, changes an exit code or raises the lowest version of Node.js.

An installed command line still reaches what the API adds after it: opensend api sends any request, and opensend mcp serve passes on the tools the server lists. opensend --version prints yours, and the CLI changelog lists every version.

In a CI job

Shell
export OPENSEND_API_KEY=...opensend emails send --input @release-mail.json --no-input

Keep the key in a secret of the job, never in the command itself. --no-input makes sure nothing waits for an answer, and the exit code tells the job whether OpenSend took the request.