Settings → Data Export
Purpose
Export a complete snapshot of the clinic's CS Logbook records as a SHA-256-attested ZIP bundle (manifest.json + 17 CSV files + README). The export covers all 17 record categories, including sensitive client and patient data (pet-owner names and patient records). Use it for backup, audit prep, migration to another system, or to hand a copy of records to your accountant / inspector / state prescription-monitoring program.
Your records are yours. The bundle is plain CSV with a README, so you can open it in any spreadsheet program without CS Logbook.
Regulatory basis: DEA recordkeeping (records retained for 2 years, so an exporter wants confidence the backup is complete; records must be readily retrievable for inspection); CCPA/CPRA right-to-access for pet-owner Personal Information and state equivalents.
HIPAA does not apply to CS Logbook — veterinary records are not protected health information and veterinarians are not covered entities (see ADR-007). The framework here is state veterinary practice acts (animal-record confidentiality) + state consumer-privacy law, not HIPAA.
When to use it
- DEA inspection prep: export the records ahead of time so you have an electronic copy in a non-CS-Logbook format
- Annual archive: keep a snapshot file per fiscal year
- Moving to another system: plain CSV opens anywhere, so you are not locked in
- Backup outside the cloud: some clinics want an air-gapped copy as a matter of policy
Walkthrough
Step 1 — Open the export page
Navigate to /home/<slug>/settings/data-export. The page shows the 17 record categories that will be included + a single Export All Data button.

Step 2 — Click Export
Click Export All Data (data-test="data-export-trigger"). The button shows Generating export... while the request runs.
The browser issues a GET to /api/accounts/<slug>/export. The server handler (route handler at apps/web/app/api/accounts/[account]/export/route.ts) runs every loader in parallel, builds the JSON payload, and streams it back with Content-Disposition: attachment; filename="cs_logbook_<slug>_<date>.json".
The browser auto-downloads. A toast confirms Export complete with the filename.
⚠️ Sensitive client/patient data is included. Pet-owner names + patient identifiers + dispense records flow through to the export. Store the file securely; treat it with the same care as any clinic record.
Step 3 — Inspect the ZIP
Unzip the file. Contents:
cs_logbook_<slug>_<date>.zip
├── manifest.json metadata + per-CSV row counts + SHA-256 checksums
├── README.md contents description + integrity verification
├── substances.csv controlled_substances rows
├── suppliers.csv
├── clients.csv pet-owner Personal Information
├── patients.csv patient records
├── containers.csv
├── transactions.csv
├── corrections.csv
├── licenses.csv
├── invoices.csv
├── invoice_items.csv
├── biennial_inventories.csv
├── biennial_inventory_items.csv
├── disposals.csv
├── disposal_items.csv
├── theft_loss_incidents.csv
├── theft_loss_items.csv
└── clinic_info.csv account + clinic_settings rollupEach CSV's header row matches the underlying database column names; foreign keys are resolved to UUIDs. Soft-deleted rows (deleted_at IS NOT NULL) are excluded — the export is the active state of the clinic. The manifest's per-file SHA-256 lets you verify the bundle wasn't tampered with after generation.
Step 4: Store it safely
The bundle contains pet-owner Personal Information, so treat it like a paper logbook copy: encrypt it at rest and delete it from any shared computer once you are done. See Common mistakes below.
Field reference
Included data categories (17)
| Category | Underlying table | Notes |
|---|---|---|
| Substances | controlled_substances |
per-substance prefix override included |
| Suppliers | suppliers |
DEA registration number included |
| Clients | clients |
name + state + status (pet-owner Personal Information) |
| Patients | patients |
species + breed + linkage (patient records) |
| Containers | containers |
balance + status + invoice link |
| Transactions | transactions |
every dispense / waste / disposal |
| Corrections | transaction_corrections |
approved corrections to transactions |
| Licenses | licenses |
facility + individual licenses |
| Invoices | invoices |
+ linked container line items |
| Invoice Items | invoice_items |
per-substance line items |
| Biennial Inventories | biennial_inventories |
DEA biennial inventory |
| Biennial Inventory Items | biennial_inventory_items |
per-substance counts |
| Disposals | disposals |
DEA Form 41 substrate |
| Disposal Items | disposal_items |
per-container disposal |
| Theft / Loss Incidents | theft_loss_incidents |
DEA Form 106 substrate |
| Theft / Loss Items | theft_loss_items |
per-substance loss |
| Clinic Info | accounts + clinic_settings |
name + address + timezone + numbering template |
Edge cases
Owner-only
The page text reads "Only account owners can export data." Server-side, the route handler verifies is_account_owner(account_id) before running the loaders. Non-owners attempting to navigate to the page see the loading state but the response is 403.
Large accounts may take multiple seconds
The route handler runs all 17 loaders in parallel via Promise.all. For clinics with >10,000 transaction rows, expect 2-5 seconds. The button stays in Generating export... mode through completion.
Sensitive client/patient data included
Pet-owner names + patient identifiers are in the export. The clinic owner is responsible for storing the file securely. Your state veterinary board confidentiality rules, state consumer-privacy law (CCPA/CPRA and equivalents), and state prescription-monitoring program requirements may apply. HIPAA does not (ADR-007).
Soft-deleted records excluded
deleted_at IS NOT NULL rows are NOT in the export. If you need an audit-trail-grade export including deleted rows, contact support — that's a separate code path.
Export schema version
The current export schema is version: "1.0", recorded in manifest.json. If the schema changes, the version number changes with it, so a stored bundle always says which layout it uses.
Common mistakes
- Treating the export as a long-term archive without encryption. Pet-owner Personal Information is in the file. At rest, encrypt it (the local OS keychain or a password-protected zip is fine; a plain folder on the desktop is not).
- Downloading the export to a shared computer and forgetting to delete it. Same hygiene as paper logbook copies.
- Treating an export as a sync mechanism. It is a point-in-time snapshot. Re-importing a stale bundle over a live account can overwrite newer records. Use exports for backup and migration, not to keep two systems in step.
- Expecting the export to include audit-log change history. It doesn't. The audit trail (
*_change_logstables) is not part of the export — it stays in the database.
Related
- Reporting — formal PDF reports for DEA / state submissions
- Audits → DEA Audit Prep — checklist for an inspector visit
- ADR-007 — HIPAA non-applicability — why this page never says "PHI"
- Settings → Privacy Requests — the CCPA/CPRA intake for pet-owner Personal Information