CLI Reference
mosaicod run
Start the server locally
mosaicod run [OPTIONS]
Options
| Option | Default | Description |
|---|---|---|
--host <HOST> | 127.0.0.1 | Specify a host address. |
--port <PORT> | 6726 | Port to listen on. |
--tls | false | Enable TLS. When enabled, the following envirnoment variables needs to be set MOSAICOD_TLS_CERT_FILE and MOSAICOD_TLS_PRIVATE_KEY_FILE |
--api-key | false | Require 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]
| Option | Default | Description |
|---|---|---|
-d, --description | Set 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]
| Option | Description |
|---|---|
-A, --all | Remove 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:
| Options | Default | Description |
|---|---|---|
--log-format <LOG_FORMAT> | pretty | Set the log output format. Available values are: json, pretty, plain |
--log-level <LOG_LEVEL> | warning | Set the log level. Possible values: warning, info, debug |