Skip to main content

Integration CLI Reference

Command-line reference for managing Trix integrations.

Overview

The trix integrations command group manages connections to third-party services. Use these commands to connect, sync, and manage your integrations from the terminal.

help.sh
trix integrations <command> [options]

Commands:
  connect <provider>     Connect to a third-party service
  disconnect <id>        Remove a connection
  list                   List all connections
  status <id>            Show connection status and sync history
  sync <id>              Trigger a sync job

trix integrations connect

Initiates OAuth flow to connect a third-party service.

connect-help.sh
trix integrations connect <provider> [options]

Arguments:
  provider    Service to connect: notion, google

Options:
  --scopes    Comma-separated OAuth scopes (Google only)
  --name      Custom name for this connection
  --no-open   Don't auto-open browser

Examples

connect-examples.sh
# Connect Notion
trix integrations connect notion

# Connect Google with all services
trix integrations connect google

# Connect Google with specific scopes
trix integrations connect google --scopes gmail,calendar

# Connect with custom name
trix integrations connect notion --name "Work Notion"

How It Works

  1. CLI starts a local HTTP server on a random port
  2. Opens your browser to the provider's OAuth page
  3. After authorization, provider redirects to local server
  4. CLI exchanges authorization code for tokens
  5. Tokens are encrypted and stored on Trix servers

If your browser doesn't open automatically, copy the URL from the terminal and paste it in your browser manually.

trix integrations disconnect

Removes a connection and deletes associated OAuth tokens.

disconnect-help.sh
trix integrations disconnect <connection-id> [options]

Arguments:
  connection-id    The connection ID (e.g., conn_abc123)

Options:
  --force          Skip confirmation prompt
  --keep-memories  Don't delete imported memories

Examples

disconnect-examples.sh
# Disconnect with confirmation
trix integrations disconnect conn_abc123

# Force disconnect without prompt
trix integrations disconnect conn_abc123 --force

# Keep imported memories when disconnecting
trix integrations disconnect conn_abc123 --keep-memories

By default, disconnecting removes all memories imported from that connection. Use --keep-memories to preserve them.

trix integrations list

Lists all connected integrations.

list-help.sh
trix integrations list [options]

Options:
  --provider    Filter by provider (notion, google)
  --status      Filter by status (active, error, syncing)
  --json        Output as JSON

Examples

list-examples.sh
# List all connections
trix integrations list

# List only Notion connections
trix integrations list --provider notion

# Output as JSON for scripting
trix integrations list --json

Output Format

list-output.txt
ID              PROVIDER   NAME           STATUS   LAST SYNC
conn_abc123     notion     Work Notion    active   2 hours ago
conn_def456     google     Personal       active   15 minutes ago
conn_ghi789     notion     Side Project   error    Failed: token expired

trix integrations status

Shows detailed status and sync history for a connection.

status-help.sh
trix integrations status <connection-id> [options]

Arguments:
  connection-id    The connection ID

Options:
  --history        Show sync job history
  --limit          Number of history entries (default: 10)
  --json           Output as JSON

Examples

status-examples.sh
# Show connection status
trix integrations status conn_abc123

# Show with sync history
trix integrations status conn_abc123 --history

# Show last 20 sync jobs
trix integrations status conn_abc123 --history --limit 20

Output Format

status-output.txt
Connection: conn_abc123
Provider:   notion
Name:       Work Notion
Status:     active
Created:    2024-01-01T10:00:00Z
Last Sync:  2024-01-15T10:30:00Z

Sync Statistics:
  Total Memories:    156
  Last Sync Added:   12
  Last Sync Updated: 3
  Last Sync Deleted: 0

Recent Sync Jobs:
  TIME                  TYPE         STATUS     DURATION
  2024-01-15 10:30:00   incremental  completed  45s
  2024-01-14 10:30:00   incremental  completed  32s
  2024-01-13 15:00:00   full         completed  3m 12s

trix integrations sync

Triggers a sync job for a connection.

sync-help.sh
trix integrations sync <connection-id> [options]

Arguments:
  connection-id    The connection ID

Options:
  --full           Full sync (re-import everything)
  --service        Sync specific service (Google only: gmail, calendar, drive)
  --since          Only sync content newer than (e.g., "7d", "2024-01-01")
  --labels         Filter by labels/tags (Gmail only)
  --wait           Wait for sync to complete
  --watch          Watch sync progress in real-time

Examples

sync-examples.sh
# Incremental sync (default)
trix integrations sync conn_abc123

# Full sync (re-import everything)
trix integrations sync conn_abc123 --full

# Sync only Gmail
trix integrations sync conn_def456 --service gmail

# Sync recent content only
trix integrations sync conn_abc123 --since "7d"

# Wait for completion
trix integrations sync conn_abc123 --wait

# Watch progress
trix integrations sync conn_abc123 --watch

Sync Types

TypeDescriptionWhen to Use
IncrementalOnly syncs changed content since last syncRegular syncs, daily use
FullRe-imports all accessible contentAfter permission changes, fixing sync issues

Sync jobs run in the background by default. Use --wait to block until completion, or --watch to see real-time progress.

Environment Variables

Configure CLI behavior with environment variables:

VariableDescriptionDefault
TRIX_API_KEYAPI key for authentication-
TRIX_API_URLBase URL for API requestshttps://api.trixdb.com/v1
TRIX_OAUTH_PORTPort for OAuth callback serverRandom available port
TRIX_NO_BROWSERDisable auto-opening browserfalse

Exit Codes

CodeMeaning
0Success
1General error
2Authentication error
3Connection not found
4OAuth flow cancelled
5Sync job failed

Scripting Examples

Automated Daily Sync

sync-all.sh
#!/bin/bash
# sync-all.sh - Sync all integrations

for conn in $(trix integrations list --json | jq -r '.[].id'); do
  echo "Syncing $conn..."
  trix integrations sync "$conn" --wait
done

Health Check

check-integrations.sh
#!/bin/bash
# check-integrations.sh - Alert on failed connections

failed=$(trix integrations list --status error --json | jq length)

if [ "$failed" -gt 0 ]; then
  echo "WARNING: $failed integration(s) in error state"
  trix integrations list --status error
  exit 1
fi

echo "All integrations healthy"
exit 0

Export Connection List

export-connections.sh
# Export to CSV
trix integrations list --json | \
  jq -r '["ID","Provider","Name","Status"], (.[] | [.id, .provider, .name, .status]) | @csv' \
  > connections.csv