Examples
CLI Examples — Common Workflows
Practical examples of using the Synento CLI for day-to-day operations.
Practical examples of using the Synento CLI for day-to-day operations.
Setup
# Install from local monorepo
cd cli && npm install -g .
# Or use npx (no global install needed)
npx synento --helpLogin & Authentication
Interactive Login
Run the command — it will prompt for your API key:
synento login
# Enter your API key (sk_live_xxx): sk_live_abc123...Non-Interactive Login (Scripts/CI)
Pass the API key as an argument or via stdin:
# Via argument (recommended for scripts)
synento login sk_live_xxxxx --url https://api.synento.com
# Via stdin (piping from secure env storage)
echo "$SYNENTO_API_KEY" | synento login
# Via environment variable (CLI reads automatically)
export SYNENTO_API_KEY=sk_live_xxxxx
synento login # no argument needed — reads from env varCredentials are stored in ~/.config/synento/credentials.json:
{ "apiKey": "sk_live_xxxxx", "apiUrl": "https://api.synento.com" }Creating Projects
Interactive Mode
Prompts for project name and optional environment:
synento create-project
# Enter project name: Acme Video Platform
# Environment (optional, press Enter to skip): production
Output: {"id":"proj_xyz123","name":"Acme Video Platform","orgId":"org_abc456"}Non-Interactive Mode
Provide all arguments inline:
synento create-project "Staging Environment" --env staging
# → {"id":"proj_staging","name":"Staging Environment","orgId":"..."}Creating Sessions
Sessions require a project ID (use -p or --project):
# Interactive — prompts for session name (defaults to "Untitled session")
synento create-session -p proj_xyz123
# Non-interactive with custom name
synento create-session "Weekly Standup" -p proj_xyz123
# → {"id":"sess_daily456","name":"Weekly Standup"}Automation Scripts
Daily Session Creator
Create recurring sessions with the CLI in a cron job:
#!/bin/bash
# create-daily-standup.sh
PROJECT_ID="$(synento list | grep '"id"' | head -1)" # or hardcode the ID
SESSION_NAME="Daily Standup — $(date +%Y-%m-%d)"
RESULT=$(synento create-session "$SESSION_NAME" -p "$PROJECT_ID" --url https://api.synento.com)
echo "Created session: $RESULT"Session Token Generator (Future CLI Command)
When synento create-session-token is added, you'll be able to:
# Get a live connection token for CLI-based streaming
TOKEN=$(synento create-session-token -s sess_abc123 --url https://api.synento.com)
echo "Connection URL: wss://.../ws?session=$SESSION_ID&access_token=$TOKEN&user_id=alice"Session Export Script (via HTTP API)
The CLI doesn't have an export command yet, but you can pipe cURL through the stored credentials:
#!/bin/bash
# Read credentials (same store CLI uses)
CRED_FILE="$HOME/.config/synento/credentials.json"
API_KEY=$(node -e "console.log(require('$CRED_FILE').apiKey)")
# Export a session to MP4
curl -o "recording.mp4" \
"https://api.synento.com/v1/sessions/sess_abc123/export" \
-H "Authorization: Bearer $API_KEY"
echo "Exported to recording.mp4 ($(du -h recording.mp4 | cut -f1))"Bulk Session Deletion (HTTP API)
The CLI doesn't support deletion yet — use the HTTP API directly:
#!/bin/bash
PROJECT_ID="proj_abc123"
API_KEY="$(node -e "console.log(require('$HOME/.config/synento/credentials.json').apiKey)")"
# List all sessions and filter to old ones
curl -s "https://api.synento.com/v1/sessions" \
-H "Authorization: Bearer $API_KEY" | \
node -e "
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8');
const {data: sessions} = JSON.parse(stdin);
// Filter to sessions older than 7 days
const cutoff = Date.now() - (7 * 24 * 60 * 60 * 1000);
const old = sessions.filter(s => new Date(s.createdAt).getTime() < cutoff);
console.log(`Found ${old.length} sessions older than 7 days`);
for (const s of old) console.log(` - ${s.id} (${s.name})`);
"Troubleshooting CLI Commands
"Authentication required" or connection errors
- Verify
synento logincompleted successfully (check for success message) - Check that credentials file exists:
cat ~/.config/synento/credentials.json - Verify the URL is reachable:
curl -s https://api.synento.com/health - Use the
--urlflag to override for a single command
"API key invalid" or 401 errors
- Ensure the API key starts with
sk_(invalid prefix = rejection) - Check that your Synento server is running and accessible
- Try re-running
syneto loginto refresh stored credentials
"ENOENT: no such file" for config
- Run
synento loginto create the credentials directory and file