teseladb admin apikey
How to use teseladb admin apikey, with its options and its examples.
Usage
teseladb admin --node <addr> apikey create --user <usuario> --db <db> [--role <rol>@<db>] [--expires-after-days <n>]
teseladb admin --node <addr> apikey list [--user <usuario>]
teseladb admin --node <addr> apikey revoke <keyId>Description
Creates API keys for the REST API and the MCP server, lists the ones there are and revokes the ones you no longer use.
Options
| Option | Default | Description |
|---|---|---|
--node | 127.0.0.1:27200 | Administration port of the node being asked. |
--format | Prints the output as JSON instead of text. | |
--dbpath | Data directory of the node. In teseladb admin, the directory whose PKI provides the credentials. | |
--tlsCertificateKeyFile | the PKI ones | Certificate and key in PEM. On a node, they replace the PKI ones; in admin and mcp, they are the client's. |
--tlsCAFile | the PKI one | CA in PEM. On a node, the one that verifies client certificates; in admin and mcp, the one that signed the node certificate. |
--user | The user who owns the key. With apikey list, it shows only that user's keys. | |
--db | The database where the user is defined. | |
--role | Limits the key to one role, written <role>@<db>, if the user has it. It can be repeated; with none, the key carries the user's roles. | |
--expires-after-days | Days until the key expires, from 1 to 365; httpOptions.apiKeys.maxExpiresAfterDays changes the maximum. Without this option, it expires after 90 days. |
Examples
Create a key for a user
Shell
teseladb admin apikey create --user agent --db admin --role read@sales --expires-after-days 30List the keys
Shell
teseladb admin apikey listRevoke a key
Shell
teseladb admin apikey revoke <keyId>Exit codes
0The command finished correctly.1The command failed while running; the error says why.2The command was written wrongly, with an argument missing or an unknown option.