Create a vault
Vaults are normally created automatically byvaultMiddleware. For non-Express workflows or custom orchestration, you can also create vaults manually via the API.
Automatic creation via vaultMiddleware
The recommended approach — addvaultMiddleware() 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:- SDK
- cURL
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
label | string | No | Human-readable description of the vault’s purpose |
ttlHours | number | No | Time-to-live in hours (default: plan default; max: plan limit) |
paymentId | string | No | Link to a payment record for traceability |
Plan TTL defaults
| Plan | Default TTL | Maximum TTL |
|---|---|---|
| Hobby | 24 hours | 24 hours |
| Pro | 7 days (168 hours) | 7 days |
| Enterprise | 30 days | Unlimited |
Error handling
| Error | Status | Cause | Resolution |
|---|---|---|---|
vault-quota-exceeded | 429 | Active vault limit reached | Seal or delete unused vaults |
ttl-exceeds-plan | 422 | TTL greater than plan maximum | Use a lower TTL or upgrade plan |
Related
- Vaults overview — vault concepts and lifecycle
- Seal a vault — close a vault for writes
- Vault quota — check your active vault count

