NewWacht Bench is live — AI-assisted development for Wacht

revokeApiKey()

Revokes an API key using the app-scoped backend route so that key can no longer authorize requests.

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 revokeKey(appName: string, keyId: string) {  const client = await wachtClient();  await client.apiKeys.revokeApiKey(appName, keyId, {    reason: 'Compromised credential',  });}

Signature

function revokeApiKey(  appName: string,  keyId: string,  options?: RevokeApiKeyOptions,): Promise<void>

RevokeApiKeyOptions

appName?: string | undefined;
Slug of the app that owns the key.
keyId?: string | undefined;
Identifier of the key to revoke.
reason?: string | undefined;
Optional revocation reason stored with the revocation event.

Behavior

  • Performs a destructive operation against the target resource.
  • Callers should treat this as irreversible unless a separate restore flow exists.

Examples

Revoke a retired key

import { wachtClient } from '@wacht/nextjs/server';export async function revokeRetiredKey() {  const client = await wachtClient();  await client.apiKeys.revokeApiKey('internal-api', '12345', {    reason: 'Service decommissioned',  });}

On this page