Skip to main content

Create a vault

Vaults are normally created automatically by vaultMiddleware. For non-Express workflows or custom orchestration, you can also create vaults manually via the API.

Automatic creation via vaultMiddleware

The recommended approach — add vaultMiddleware() after payMiddleware in your Express chain:
vaultMiddleware creates the vault, attaches it to req.vault, and handles cleanup if your handler throws.

Manual vault creation

For queue workers, Lambda functions, or other non-Express workflows:

Parameters

Plan TTL defaults

Error handling