Overview
The export and import commands provide tools for bulk data
operations, enabling backups, data portability, and migrations. Export memories to JSON,
Markdown, or CSV formats, and import them back to recreate your memory collection.
Import and export operations are ideal for backups, migrating between accounts, and integrating Trix with external tools and workflows.
Export Memories
Export memories to various formats including JSON (with full metadata), Markdown (human-readable), and CSV (spreadsheet-compatible).
Basic Export
# Export all memories to JSON (stdout)
trix export
# Export to file
trix export > backup.json
# Export to markdown
trix export --format markdown --file notes.md
# Export to CSV
trix export --format csv --file memories.csvExport Formats
| Format | Description | Use Case |
|---|---|---|
json | JSON format with full metadata (default) | Backups, re-import, API integration |
markdown / md | Human-readable markdown documents | Documentation, reading, note-taking apps |
csv | CSV spreadsheet format | Excel, Google Sheets, data analysis |
Filtered Export
# Export from specific space
trix export --space work --file work-memories.json
# Export memories with specific tags
trix export --tags important,project --file important.json
# Export recent memories
trix export --since 30d > recent-30days.json
trix export --since 7d --format md > weekly-notes.md
# Export matching a search query
trix export --query "meeting notes" --format json > meetings.json
# Combine filters
trix export --space work --tags project --since 14d > recent-project-work.jsonExport Options
| Option | Description |
|---|---|
--format | Output format: json, markdown, csv |
--file | Output file (default: stdout) |
--space | Export only from specific space |
--tags | Export only memories with these tags |
--since | Export memories newer than duration (e.g., 30d) |
--query | Export memories matching search query |
When using --query, the export is limited to 100 results. For bulk exports
of large datasets, use the list-based approach without --query.
Import Memories
Import memories from a JSON export file. The import process recreates memories in your account, but original IDs are not preserved (new IDs are generated).
Basic Import
# Import from file
trix import backup.json
# Import from stdin
cat backup.json | trix import -
# Import into specific space
trix import backup.json --space archive
# Add additional tags to all imported memories
trix import backup.json --tags imported,2024
# Preview what would be imported
trix import backup.json --dry-run
# Skip confirmation prompt
trix import backup.json --forceImport Process
The import command:
- Reads and parses the JSON export file
- Shows a preview of what will be imported
- Prompts for confirmation (unless
--forceis used) - Creates each memory individually
- Reports successes and failures
- Displays new memory IDs for successful imports
Important notes about import:
- Original memory IDs are not preserved
- New IDs are generated for all imported memories
- Relationships between memories are not preserved
- Timestamps are not preserved (new creation time is set)
Import Options
| Option | Description |
|---|---|
--space | Import into specific space (overrides original) |
--tags | Add additional tags to all imported memories |
--dry-run | Preview what would be imported without making changes |
--force | Skip confirmation prompt |
Common Examples
Complete Backup & Restore
# Create a backup
trix export --file backup-$(date +%Y%m%d).json
# Later, restore from backup
trix import backup-20260115.json --dry-run # Preview first
trix import backup-20260115.json # Confirm and importMigrate Between Spaces
# Export from one space
trix export --space old-project --file old-project.json
# Import into new space
trix import old-project.json --space new-project --tags migratedSelective Export & Import
# Export only important tagged memories
trix export --tags important,critical --file important-backup.json
# Export recent work memories
trix export --space work --since 7d --file recent-work.json
# Import and add archive tag
trix import old-memories.json --tags archived,legacyExport to Markdown for Reading
# Export all memories as markdown
trix export --format markdown --file all-memories.md
# Export specific category
trix export --tags meeting-notes --format md --file meetings.md
# Export recent notes
trix export --since 14d --format markdown > recent-notes.mdExport to CSV for Analysis
# Export to CSV
trix export --format csv --file memories.csv
# Open in spreadsheet application
# Use for data analysis, reporting, or importing to other toolsScheduled Backups
#!/bin/bash
# backup-trix.sh - Run daily via cron
BACKUP_DIR="$HOME/backups/trix"
DATE=$(date +%Y%m%d)
mkdir -p "$BACKUP_DIR"
# Create daily backup
trix export --file "$BACKUP_DIR/trix-backup-$DATE.json"
# Keep only last 30 days of backups
find "$BACKUP_DIR" -name "trix-backup-*.json" -mtime +30 -delete
echo "Backup completed: trix-backup-$DATE.json"
# Add to crontab:
# 0 2 * * * /path/to/backup-trix.shMigrate Between Accounts
# Export from old account
trix export --file full-export.json
# Switch to new account
trix auth logout
trix auth login --email [email protected]
# Import to new account
trix import full-export.json --tags migrated-from-old-accountData Portability
JSON Export Structure
The JSON export includes all memory metadata, making it suitable for backups and programmatic processing:
{
"exported_at": "2026-01-15T10:30:00Z",
"version": "1.0",
"count": 3,
"memories": [
{
"id": "<memory-uuid>",
"content": "Memory content here",
"space_id": "<space-uuid>",
"is_private": false,
"tags": ["important", "work"],
"priority": 5,
"metadata": {
"source": "cli",
"custom_field": "value"
},
"created_at": "2026-01-10T15:20:00Z",
"updated_at": "2026-01-12T09:15:00Z"
}
]
}External Tool Integration
The export formats enable integration with various tools:
- JSON: API integration, custom processing, backups
- Markdown: Obsidian, Notion, Bear, other note-taking apps
- CSV: Excel, Google Sheets, data analysis tools
# Process exported JSON with jq
trix export -o json | jq '.memories[] | select(.tags | contains(["important"]))'
# Convert to CSV and analyze in Excel
trix export --format csv --file data.csv
# Open data.csv in Excel for pivot tables, charts, etc.
# Export to markdown and import to Obsidian
trix export --format markdown --file obsidian-import.md
# Copy to Obsidian vaultBest Practices
Backup Strategy
- Schedule regular automated backups (daily or weekly)
- Store backups in multiple locations (local, cloud)
- Test restore process periodically
- Keep backups for a retention period (30-90 days)
- Use compressed storage for backup files
Import Safety
- Always use
--dry-runbefore importing large datasets - Import into a test space first to verify data
- Use tags to identify imported memories (
--tags imported) - Monitor import progress for failures
- Keep the original export file until import is verified
Performance
- Large exports (10,000+ memories) may take several minutes
- Imports are rate-limited to prevent API abuse
- Break very large imports into smaller batches
- Use
--queryfor targeted exports (limited to 100 results)
Command Reference
export Command
trix export [OPTIONS]
Export memories to JSON, Markdown, or CSV format.
Options:
-f, --format FORMAT Output format: json, markdown, csv (default: json)
--file FILE Write to file instead of stdout
-s, --space SPACE Export from specific space
-t, --tags TAGS Export memories with these tags (comma-separated)
--since DURATION Export memories newer than duration (e.g., 30d)
--query QUERY Export memories matching search query (limit 100)import Command
trix import [FILE] [OPTIONS]
Import memories from a JSON export file.
Arguments:
FILE Path to import file, or '-' for stdin
Options:
-s, --space SPACE Import into specific space (overrides original)
-t, --tags TAGS Add tags to all imported memories (comma-separated)
--dry-run Preview without importing
-f, --force Skip confirmation promptNext Steps
- Background Jobs - Monitor bulk import job progress
- Spaces - Organize imported memories into spaces
- Memory Commands - Learn about memory management
- Memories API - Programmatic import/export via API