API Keys API
TheapiKeys module allows your backend to act as an identity provider for other applications. Using this module, you can programmatically provision and manage API Keys that your users can then use to authenticate against your own public APIs.
Note: These are keys you issue to your customers, not the key you use to authenticate the @wacht/backend SDK.
API Auth Apps
Before you can issue API Keys, you must define an API Auth App. An App defines the capabilities, rate limits, and contextual boundaries for the keys issued underneath it.createApiAuthApp(request)
Create a new category of API keys.
listApiAuthApps()
List the active API configurations in your environment.
client.apiKeys.getApiAuthApp(appName)client.apiKeys.updateApiAuthApp(appName, request)client.apiKeys.deleteApiAuthApp(appName)
Provisioning Keys
API Keys are provisions underneath a specific App.createApiKey(appName, request)
Generates a new secure API key. This is the only time the full secret key (wk_live_...) is returned. Record it carefully.
The parent API Auth App’s name or slug.
listApiKeys(appName)
Retrieve metadata about all keys provisioned under an app (but never the secrets themselves).
The parent App slug whose keys you wish to list.
Rotating and Revoking
API Keys are critical security credentials. If a customer accidentally leaks a key, it must be neutralized.revokeApiKey(request)
Instantly invalidates the key. Any requests made to your API (validated via gateway.verifyApiKeyRequest) using this key will immediately return HTTP 403.
