listApiKeys()
Lists persisted key metadata for one API auth app. Like app listing, the SDK unwraps the backend list envelope and returns only the key array.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function listKeys(appName: string) { const client = await wachtClient(); return client.apiKeys.listApiKeys(appName, { include_inactive: true });}Signature
function listApiKeys( appName: string, options?: { include_inactive?: boolean; },): Promise<ApiKey[]>Parameters
›appName?: string | undefined;
appName?: string | undefined;Slug of the app whose keys should be listed.
›include_inactive?: boolean | undefined;
include_inactive?: boolean | undefined;When `true`, includes revoked/inactive keys in the response.
Return value
›id?: string | undefined;
id?: string | undefined;Stable key identifier.
›app_slug?: string | undefined;
app_slug?: string | undefined;App slug this key belongs to.
›name?: string | undefined;
name?: string | undefined;Display name of the key.
›key_prefix?: string | undefined;
key_prefix?: string | undefined;Public key prefix.
›key_suffix?: string | undefined;
key_suffix?: string | undefined;Public key suffix.
›permissions?: string[] | undefined;
permissions?: string[] | undefined;Permissions attached to the key.
›is_active?: boolean | undefined;
is_active?: boolean | undefined;Whether the key is active.
›revoked_at?: string | undefined;
revoked_at?: string | undefined;Revocation timestamp when the key has been revoked.
Behavior
- Returns a backend-scoped list response for this resource.
- Use pagination and filters from this method to build admin list views.
Examples
List active keys for one app
import { wachtClient } from '@wacht/nextjs/server';export async function listActiveKeys(appName: string) { const client = await wachtClient(); return client.apiKeys.listApiKeys(appName);}Include revoked keys for audit screens
import { wachtClient } from '@wacht/nextjs/server';export async function listAllKeys(appName: string) { const client = await wachtClient(); return client.apiKeys.listApiKeys(appName, { include_inactive: true });}