Webhook signature verification
When you define webhooks in your API spec, Fern automatically generates utilities that allow your SDK users to verify webhook signatures and ensure events originate from your API.
Fern supports two signature verification methods:
- Hash-based Message Authentication Code (HMAC) — Symmetric key verification using shared secrets
- Asymmetric — Public key verification using RSA, Elliptic Curve Digital Signature Algorithm (ECDSA), or Ed25519 keys
Webhook signature verification is currently supported for TypeScript SDK generation only.
Generated SDK behavior
The generated SDK exposes a verifyWebhookSignature utility:
Setting up webhook signature verification
Configure signature verification in your API definition. Settings can be applied at the document level (inherited by all webhooks) or per-webhook (overrides document-level settings).
OpenAPI
Fern Definition
openapi.yml
For full configuration details, see the docs for your API definition format: