Export Your Data

Export your full account data or individual vault archives for backup, migration, or compliance — request an export, poll for completion, and download the archive.

beginner9 min read

What You'll Learn

Data export lets you package your Lifestream Vault content into portable archives. There are two export types: a full account export that bundles all your vaults, documents, metadata, and settings into a single archive, and a per-vault export that produces a zip of one specific vault's content.

By the end of this guide you will be able to:

  • Export your full account data across all vaults
  • Export individual vaults as standalone zip archives
  • Poll export status and wait for processing to complete
  • Download completed archives
  • Automate periodic backups using the SDK
Plan Required

Account export is available on all tiers. Vault export requires Pro or Business tier.

Exports are processed asynchronously — you request an export, then poll for completion and download the archive. Large vaults may take several minutes to package.

Export Your Full Account

A full account export packages all your vaults, documents, metadata, and settings into a single archive. This is useful for disaster recovery, migrating to a self-hosted instance, or responding to data portability requests.

The flow has three steps: request the export, poll until it finishes, then download the archive.

typescript
import { LifestreamVaultClient } from '@lifestreamdynamics/vault-sdk';

const { client } = await LifestreamVaultClient.login(
  'https://vault.lifestreamdynamics.com',
  'you@example.com',
  'your-password',
);

// Step 1: Request export
const exp = await client.user.requestDataExport('zip');
console.log('Export requested:', exp.id);

// Step 2: Poll until complete
let status = exp;
while (status.status === 'pending' || status.status === 'processing') {
  await new Promise(r => setTimeout(r, 5000));
  status = await client.user.getDataExport(exp.id);
}

// Step 3: Download
const data = await client.user.downloadDataExport(exp.id);

Export a Single Vault

A vault export packages one vault into a zip archive containing all its Markdown documents and, optionally, a JSON metadata file alongside each document with frontmatter, tags, and other stored metadata. This is useful for targeted backups, sharing a vault with an external collaborator, or importing into another Markdown-based tool.

Plan Required

Vault export requires Pro or Business tier.

typescript
import { LifestreamVaultClient } from '@lifestreamdynamics/vault-sdk';

const { client } = await LifestreamVaultClient.login(
  'https://vault.lifestreamdynamics.com',
  'you@example.com',
  'your-password',
);

const VAULT_ID = 'vault-uuid';

// Step 1: Request vault export (includeMetadata defaults to true)
const exp = await client.vaults.createExport(VAULT_ID, { includeMetadata: true });
console.log('Vault export requested:', exp.id);

// Step 2: Poll until complete
let status = exp;
while (status.status === 'pending' || status.status === 'processing') {
  await new Promise(r => setTimeout(r, 5000));
  const exports = await client.vaults.listExports(VAULT_ID);
  status = exports.find(e => e.id === exp.id) ?? status;
}

// Step 3: Download
const data = await client.vaults.downloadExport(VAULT_ID, exp.id);

Vault exports expire after 7 days. Download your archive before it is automatically deleted.

Automate Periodic Backups

You can automate backups by combining the SDK with an API key and a scheduler such as cron. The script below requests a full account export, polls until it completes, and writes the archive to a date-stamped file on disk.

typescript
// backup.mjs — run with Node.js 18+
import { LifestreamVaultClient } from '@lifestreamdynamics/vault-sdk';
import { writeFile } from 'node:fs/promises';

const client = new LifestreamVaultClient({
  baseUrl: 'https://vault.lifestreamdynamics.com',
  apiKey: process.env.LSVAULT_API_KEY,
});

// Step 1: Request export
const exp = await client.user.requestDataExport('zip');
console.log(`[backup] Export ${exp.id} requested, waiting for completion...`);

// Step 2: Poll until complete
let status = exp;
while (status.status === 'pending' || status.status === 'processing') {
  await new Promise(r => setTimeout(r, 5000));
  status = await client.user.getDataExport(exp.id);
  console.log(`[backup] Status: ${status.status}`);
}

if (status.status !== 'completed') {
  console.error(`[backup] Export failed with status: ${status.status}`);
  process.exit(1);
}

// Step 3: Download to a date-stamped file
const date = new Date().toISOString().slice(0, 10); // e.g. 2026-02-25
const filename = `lsvault-backup-${date}.zip`;
const data = await client.user.downloadDataExport(exp.id);
await writeFile(filename, Buffer.from(await data.arrayBuffer()));
console.log(`[backup] Archive saved to ${filename}`);

Combine exports with version history — exports give you a point-in-time snapshot of all your documents, while version history gives you document-level undo within the application. Together they provide both off-site disaster recovery and fine-grained revision control.

Tips & Best Practices

  • Export regularly for disaster recovery — even with cloud hosting, local backups are good practice. A weekly automated export gives you a reliable off-site copy.

  • Use the zip format for account exports if you need to preserve the directory structure for re-importing or manual inspection.

  • Vault exports include metadata by default (includeMetadata: true) — this adds JSON files alongside each Markdown document containing frontmatter, tags, and document metadata, making the archive self-contained and useful for migrations.

  • Exports are processed asynchronously by background workers — the data-export worker handles account exports and the vault-export worker handles vault exports. Large vaults may take several minutes to package; build polling into any script.

  • Vault export archives expire after 7 days — download promptly or include the download step in your automation so the archive is never lost to expiry.

  • For GDPR/compliance data requests, account export includes all user data and can serve as a data portability response — the zip format preserves the full vault directory structure with all Markdown content and metadata.

What's Next

  • Version History and Document Diffs — browse, diff, pin, and restore individual document versions for fine-grained revision control alongside your bulk exports
  • API Keys & Scoping — create a scoped API key for your backup automation scripts so you never need to store your account password
  • Automate Your Vault — use hooks and webhooks to trigger workflows on document events, including automated archival pipelines
  • Secure Your Account with MFA — protect the account whose data you are exporting with multi-factor authentication