Skip to main content

CLI Reference

mosaicod run

Start the server locally

mosaicod run [OPTIONS]

Options

OptionDefaultDescription
--host <HOST>127.0.0.1Specify a host address.
--port <PORT>6726Port to listen on.
--tlsfalseEnable TLS. When enabled, the following envirnoment variables needs to be set MOSAICOD_TLS_CERT_FILE and MOSAICOD_TLS_PRIVATE_KEY_FILE
--api-keyfalseRequire API keys to operate. When enabled the system will require API keys to perform any actions.

mosaicod api-key

Manage API keys.

create

Create a new API key.

mosaicod api-key create --permissions [read|write|delete|manage] [OPTIONS]
OptionDefaultDescription
-d, --descriptionSet a description for the API key to make it easily recognizable.
--expires-in <EXPIRES_IN>Define a time duration, using the ISO8601 format, after which the key in no longer valid (e.g. P1Y2M3D 1 year 2 months and 3 days)
--expires-at <EXPIRES_AT>Define a datetime, using the rfc3339 format, after which the key in no longer valid (e.g 2026-03-27T12:20:00Z)

revoke

Revoke an existing API key.

mosaicod api-key revoke <FINGERPRINT>

The fingerprint are the last 8 digits of the API key.

status

Check the status of an API key.

mosaicod api-key status <FINGERPRINT>

The fingerprint are the last 8 digits of the API key.

list

List all API keys.

mosaicod api-key list

purge

Remove API keys in bulk. By default, only expired keys are removed; use the --all flag to remove every key, regardless of its expiration status.

mosaicod api-key purge [OPTIONS]
OptionDescription
-A, --allRemove all API keys, including those that have not yet expired.

Examples

Remove only expired keys:

mosaicod api-key purge

Remove all API key:

mosaicod api-key purge --all

or, equivalently:

mosaicod api-key purge -A
warning

Using --all is irreversible: every API key will be permanently revoked, including keys currently in use by services or integrations. Make sure you have a way to reissue the keys before running this command.

Common Options

Each mosaicod command shares the following common options:

OptionsDefaultDescription
--log-format <LOG_FORMAT>prettySet the log output format. Available values are: json, pretty, plain
--log-level <LOG_LEVEL>warningSet the log level. Possible values: warning, info, debug