Skip to content

SDK Installation

Terminal window
npm install @pabox/sdk
import { PassBox } from '@pabox/sdk';
// Option 1: Service token (recommended for servers/CI)
const pb = new PassBox({
token: 'pb_your_service_token',
});
// Option 2: Login with email + password
const pb = await PassBox.login({
email: 'you@example.com',
password: 'your-password',
});
// Store a secret
await pb.secrets.set('DATABASE_URL', 'postgres://...', {
vault: 'my-app',
});
// Retrieve a secret
const value = await pb.secrets.get('DATABASE_URL', {
vault: 'my-app',
});
console.log(value); // postgres://...
const pb = new PassBox({
serverUrl: 'https://api.passbox.dev', // default
token: 'pb_...', // optional service token
});
OptionTypeDefaultDescription
serverUrlstringhttps://api.passbox.devServer URL
tokenstringService token for machine auth

Set a default vault to avoid passing vault on every call:

pb.setDefaultVault('vault-uuid-here');
// Now these work without specifying vault
await pb.secrets.get('API_KEY');
await pb.secrets.set('API_KEY', 'new-value');

If no default vault is set and no vault is specified, the SDK auto-selects the first vault in your account.

All types are exported for use in your code:

import type {
VaultData,
CreateVaultOptions,
SecretData,
GetSecretOptions,
SetSecretOptions,
EnvironmentData,
MemberData,
WebhookData,
ServiceTokenData,
EncryptedBlob,
} from '@pabox/sdk';

The PassBox instance exposes these resource objects:

ResourceDescription
pb.vaultsVault CRUD operations
pb.secretsSecret get/set/delete/list
pb.environmentsEnvironment management
pb.env.env file parsing and import
pb.importersImport from .env/JSON/CSV
pb.membersVault member management
pb.webhooksWebhook CRUD
pb.rotationSecret rotation config
pb.tokensService token management
pb.accountAccount operations