Skip to content

CreateAPIKey

Source: src/AWS/WAFv2/APIKeys.ts

Runtime binding for wafv2:CreateAPIKey — mint an API key for the CAPTCHA JavaScript integration, scoped to up to 5 token domains (e.g. onboarding a new tenant domain in a SaaS). The returned key is embedded in client-side JavaScript by design (it is not a secret credential).

Provide WAFv2.CreateAPIKeyHttp on the hosting Lambda Function to satisfy the requirement.

// init — grants wafv2:CreateAPIKey
const createAPIKey = yield* AWS.WAFv2.CreateAPIKey();
// runtime
const { APIKey } = yield* createAPIKey({
Scope: "REGIONAL",
TokenDomains: ["example.com"],
});