Skip to content

Key Management CLI — Commands Reference

Binary: ankasecure-km
Version: 3.4.1

Every command is ankasecure-km <group> <verb> [options], except init and view-session. No command takes a tenant: the workload's token names it. Path and query parameters are options; a request body comes from --body-file <json> (- reads standard input), with convenience options for the common members, which are set over the file's content. A member the request model does not declare is refused (E_BAD_BODY, naming the member, never its value).


Global options

Option Meaning
--format json\|table Output format; json is the default
--help, -h Usage of the command
--version, -V The CLI's version

Listing commands that page accept --page <n> (zero-based), --size <n> and --sort <property[,asc|desc]>.


Exit codes

Code Meaning
0 Success, including an operation that now waits for quorum approval
1 A user error the command detects (missing or conflicting configuration, E_BAD_URL, E_BAD_UUID, E_BAD_BODY, E_TOKEN_COMMAND_NOT_ALLOWED, ...)
2 A usage error, or an authentication or authorization failure (E_AUTH_FAILED, E_AUTHZ_FORBIDDEN)
3 Any other server refusal (404, 409, 422, other 4xx, 5xx) or an unexpected failure
4 An IO or network failure

A usage error prints the usage and sends nothing. A server refusal prints the server's problem type.


Pending quorum approval

A destruction request, and an operation the tenant's quorum policy gates, print on stdout (with --format json):

{"status":"PENDING_APPROVAL","quorumRequestId":"8d2e4f60-1a3b-4c5d-9e7f-0a1b2c3d4e5f","operation":"KEY_MARK_FOR_DESTRUCTION",
 "target":"old-archive-key","requiredApprovals":1,"approvals":0,"expiresAt":"2026-11-09T09:15:00Z"}

and the human-readable lines on stderr, and exit 0. Approval and rejection are made in the Admin Console; quorum-requests reads and cancels the workload's own requests.


init

Option Required Meaning
--url <origin> Yes The deployment's address: an absolute https URL with a host (http for development). An address without a scheme or a host is refused with E_BAD_URL (exit 1); without a port, the scheme's own port is dialled
--workload-id <uuid> Yes The administrative workload
--private-key-file <path> One of three A PKCS#8 PEM or private JWK file, owner-only
--token-file <path> One of three A file holding a federated token
--token-command <cmd> One of three A command that prints a federated token; runs only with ANKASECURE_ALLOW_EXTERNAL_TOKEN_COMMAND=1, split on whitespace outside quotes, never through a shell
--auth-url <origin> No Where the CLI obtains its token, when that differs from --url; saved with the configuration. Defaults to --url; checked as --url is
--insecure No Disables TLS verification, persisted, warned on every command
--force No Replaces an existing configuration

init authenticates once, then writes the address, the workload id and the credential reference — never a key, token or secret.

view-session

Prints the workload id, the tenant, the token's expiry, its scopes and the endpoint; never the token.


keys

Verb Options
list --status, --origin, --restricted <true\|false>, --kty, --conformance, paging
get --kid
create --kid, --algorithm, --kty, --purpose, --key-ops <op,...>, --exportable <true\|false>, --body-file
update --kid, --body-file (a JSON Merge Patch of the metadata)
import-key --body-file
import-keystore, analyze-keystore --keystore-file <path>, --metadata-file <json\|->, and --password-stdin or --password-prompt
export --kid
lifecycle-cause-verdicts --kid
supported-algorithms --category, --status, --min-security-level, --max-security-level, --key-ops, --standards, --kty, --alg, --composite-mode
suspend, revoke --kid, --cause, --reason, --body-file
reactivate --kid
archive --kid, --reason (required)

The keystore password is read from standard input to its end (--password-stdin, one trailing newline removed, at most 4,096 bytes) or from the console without echo (--password-prompt), never as an option value, and zeroed after the request.

materials

Verb Options
list --kid
get --kid, --material-version <n>
revoke --kid, --material-version <n>, --cause, --reason, --body-file

rotation

Verb Options
rotate --kid, --body-file, --idempotency-key <key>
admissibility --kid
schedule --kid
replace-schedule --kid, --body-file
executions --kid, --page, --size

destruction

Verb Options
request-key --kid, --reason (required), --cooling-off-days <7..365>, --body-file
cancel-key --kid
request-version --kid, --material-version <n>, --reason (required), --cooling-off-days <7..365>, --body-file
cancel-version --kid, --material-version <n>
orders --kid

See Key Destruction for the workflow.

quorum-requests

Verb Options
list --status, --page, --size
get --id <uuid>
cancel --id <uuid>

exchange-contexts

Verb Options
list paging
get, delete, resume --id <uuid>
create --body-file (a context belongs to the tenant and names no application)
update --id <uuid>, --body-file
suspend --id <uuid>, --reason, --body-file
close --id <uuid>, --reason (required). Terminal: revokes the context's exchanges and retires its grants

exchanges

Verb Options
list --status, --counterparty, --application-id, --relationship, --exchange-context-id, --owner-principal-id, --name-search, --page, --size, --sort-by, --sort-direction <asc\|desc>
create --body-file
get, validate, preview-activation --id <uuid>
update --id <uuid>, --body-file
discard-draft --id <uuid>, --expected-version <n>
clone --id <uuid>, --name, --body-file
activate, resume --id <uuid>, --expected-version <n>, --body-file
suspend, revoke --id <uuid>, --expected-version <n>, --reason, --body-file
add-grant --id <uuid>, --actor-id <uuid>, --capability (repeatable), --asset-kid (repeatable), --pair <sourceKid:targetKid> (repeatable, in order), --constraint-policy-id <uuid>, --body-file
revoke-grant --id <uuid>, --grant-id <uuid>, --reason (required)

activate makes every live grant of the exchange authorize; it names no capability. add-grant adds a grant owned by the exchange, in its context: its actor belongs to the origin or destination application, and it names one key or, for REENCRYPT or RESIGN, ordered --pair values.

capability-grants

Verb Options
list --actor-id, --asset-kid, --exchange-context-id, --constraint-policy-id, paging
create, preview --actor-id <uuid>, --context <uuid>, --capability (repeatable), --asset-kid (repeatable), --pair <sourceKid:targetKid> (repeatable, in order), --constraint-policy-id <uuid>, --body-file
get, policy-assignments --id <uuid>
revoke --id <uuid>, --reason (required). Terminal
re-pin --id <uuid>, --constraint-policy-version-id <uuid>
effective-restrictions --id <uuid>, --at <instant> (ISO-8601; now when omitted)

--context is the grant's exchange context. re-pin pins the grant to a constraint policy version from its next request on; uses made while no limit was pinned do not count toward the new limit.

constraint-policies

Verb Options
list paging
create --body-file
get, delete, versions --id <uuid>
update --id <uuid>, --body-file
version --id <uuid>, --policy-version <n>
compare-versions --base-version-id <uuid>, --target-version-id <uuid>

internal-crypto-use-cases

Verb Options
list --status, paging
create --body-file
get, resume, renew --id <uuid>
revoke --id <uuid>, --reason (required). Terminal
suspend --id <uuid>, --reason, --body-file

create prints the new use case's client secret once, inside credential.clientSecret on stdout, and never writes it to a file or a log. Store it at once. renew extends the use case's validity to one year after the later of now and its current end, and makes an expired use case active again.

directory

Verb Options
list-applications, list-actors paging
get-application, list-application-actors --application-id <uuid>
get-actor --actor-id <uuid>
list-counterparty-types —
get-counterparty-type --id <uuid>

CLI Version: 3.4.1
Last updated: 2026-10-26