v3.2.0·MIT·14kb gzip

Type-safe client for
@vault/sdk

A tiny, opinionated TypeScript SDK for the Vault API. Auto-completes every field, validates at runtime, retries idempotent requests. Works in Node + Deno + browser.

npmpnpmbun
npm install @vault/sdk
⌃C Copy
14 kBgzip0runtime deps9.4 ★npm rating620kweekly downloads

// Hello world

TypeScript
import { Vault } from '@vault/sdk' const client = new Vault({ apiKey: process.env.VAULT_KEY, region: 'us-east-1', }) // Auto-completed. Returns Promise<Customer>. const customer = await client.customers.create({ email: 'maya@reply.so', metadata: { plan: 'pro' }, }) // Retries idempotently. Strongly typed. const charge = await client.charges.create({ customer: customer.id, amount: 2400, currency: 'usd', })

Method reference

client.customers.create(params: CustomerCreateParams): Promise<Customer>

Create a new customer record. Returns the persisted customer including the server-generated id and timestamps.

email string — required · primary email
metadata Record<string, string> — optional · max 50 keys, 500 chars / value
client.charges.create(params: ChargeCreateParams): Promise<Charge>

Create + capture a charge against a customer. Idempotent on the Idempotency-Key header (auto-attached by the SDK).

client.subscriptions.list(params?: SubscriptionsListParams): AsyncIterable<Subscription>

List subscriptions. Returns an async iterable that auto-paginates. Use for await…of to iterate.