Skip to content

CLI: API keys

Commands to issue API keys for the Content API, change their permissions, and revoke them. Common flags that you can add to any command (--host, --json, and others) are in the CLI command reference.

For how to choose permissions, see Create API keys and set permissions.

Command Description
hakocms-cli api-keys create Issue an API key
hakocms-cli api-keys list List API keys
hakocms-cli api-keys reactivate Re-enable a revoked API key
hakocms-cli api-keys revoke Revoke an API key (you can re-enable it later)
hakocms-cli api-keys update Change an API key’s name and permissions

Issue an API key.

ターミナルウィンドウ
hakocms-cli api-keys create [OPTIONS]
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
--name <TEXT> A name to tell it apart
--permissions <JSON> If omitted, only GET is allowed. Use @file to read from a file, - to read from standard input
--data <JSON> The whole body (JSON). Use @file to read from a file, - to read from standard input. Other flags are applied on top of it

List API keys.

ターミナルウィンドウ
hakocms-cli api-keys list [OPTIONS]
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order

Re-enable a revoked API key.

The same key works again.

ターミナルウィンドウ
hakocms-cli api-keys reactivate [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID

Revoke an API key (you can re-enable it later)

Revokes an API key.

A revoked key can no longer be used. It stays in the list, and you can re-enable it with api-keys reactivate.

ターミナルウィンドウ
hakocms-cli api-keys revoke [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID
--force Do it without asking for confirmation

Change an API key’s name and permissions.

ターミナルウィンドウ
hakocms-cli api-keys update [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID
--name <TEXT> A name to tell it apart
--permissions <JSON> If given, replaces both the default permissions and the per-item permissions entirely. Use @file to read from a file, - to read from standard input
--data <JSON> The whole body (JSON). Use @file to read from a file, - to read from standard input. Other flags are applied on top of it