opschain tokens list
Included from Basic tier
Lists the caller's native credentials from the v2 AuthService — API keys
(ListAPIKeys) and sessions (ListSessions), metadata only; token values
are never returned. The v1 GET /api/tokens inventory is retired with its
route family: the listing answers from the session/api-key
store. Rows render as a table (TYPE DESCRIPTION EXPIRES CREATED ID), API
keys first, then sessions, each newest first. TYPE is api_key or
session. DESCRIPTION is the purpose supplied when an API key was minted;
for a session it carries the authn method (password, ldap). EXPIRES is
the API key's expiry, or the session's absolute expiry. With no credentials
it prints no tokens. -o json|yaml emits the same rows structured, with
current: true marking the session this very call rode.
--sessions keeps only the session rows and --keys only the API-key rows
(each also skips the other lane's server read); they are mutually
exclusive, and omitting both lists everything. A server target is required
(--server <url>, OPSCHAIN_SERVER or the active context); in local mode
it fails with tokens need a server target — pass --server <url> or 'opschain context use <name>' (local mode has no tokens) (exit 2).
Flags
| Flag | Meaning |
|---|---|
--sessions | List only your sessions (mutually exclusive with --keys). |
--keys | List only your API keys (mutually exclusive with --sessions). |
--filter <column>[!]=<value> | Keep only rows matching the term (repeatable; terms AND). Columns are the printed table headers lowercased (spaces/dashes fold to _); * wildcards match the whole cell case-insensitively, != negates, commas mean any-of. Applied client-side. Grammar: opschain docs cli. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Credentials listed (an empty inventory is still 0). |
| 1 | The server request failed. |
| 2 | Usage error (no server target). |
Examples
opschain tokens list
opschain tokens list --keys
opschain tokens list --sessions
opschain tokens list -o json
See also
opschain docs cli/login— how sessions are established.opschain docs cli/tokens-create— minting an API key (the value is shown exactly once, at the mint).opschain docs cli/tokens-revoke— retiring an API key by id.opschain docs identity— the session lane, API keys and the v1 retirement.