This document demonstrates how to use the kubera command-line interface.
After installing the package, the kubera command will be available:
pip install git+https://github.com/the-mace/kubera-python-api.git- The
updatecommand requires an API key with update permissions enabled - Read-only API keys will receive a 403 Forbidden error when attempting updates
- List and show commands work with read-only keys
- Some API keys may be restricted to specific IP addresses
- If you receive 401 authentication errors, verify your IP is in the allowlist
- Contact Kubera support to modify IP restrictions
Test your API connection and verify credentials (recommended first step):
# Human-readable format with diagnostics
kubera test
# Raw JSON output
kubera test --rawOutput Example:
Testing Kubera API connection...
→ Loading credentials...
→ Fetching portfolios...
✓ Successfully connected to Kubera API!
✓ Found 2 portfolio(s)
Portfolios:
1. Personal Portfolio (ID: abc-123, Currency: USD)
2. Business Portfolio (ID: def-456, Currency: EUR)
→ Fetching detailed data for first portfolio...
✓ Portfolio: Personal Portfolio
- Assets: 15
- Debts: 3
- Insurance: 2
- Net Worth: 250000.00 USD
==================================================
✓ All tests passed! Your Kubera API client is working correctly.
Use this command to:
- Verify your credentials are correct
- Check API connectivity
- Diagnose authentication issues
- Confirm IP address restrictions are not blocking you
# Human-readable format
kubera list
# Raw JSON output
kubera list --raw# Show detailed portfolio information
kubera show PORTFOLIO_ID
# Show in tree view
kubera show PORTFOLIO_ID --tree
# Show as raw JSON
kubera show PORTFOLIO_ID --rawNote: Requires API key with update permissions!
# Update just the value
kubera update ITEM_ID --value 50000
# Update multiple fields
kubera update ITEM_ID --name "New Name" --value 50000 --description "Updated"
# Update with raw JSON output
kubera update ITEM_ID --value 50000 --rawIf you receive a 403 error, your API key doesn't have update permissions enabled.
Launch an interactive session to explore portfolios:
kubera interactiveCredentials can be provided in multiple ways:
Create ~/.env:
KUBERA_API_KEY=your_api_key
KUBERA_SECRET=your_secretexport KUBERA_API_KEY=your_api_key
export KUBERA_SECRET=your_secret
kubera listkubera --api-key YOUR_KEY --secret YOUR_SECRET listThe default output is formatted using Rich tables for easy reading:
$ kubera list
Portfolios (2)
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ ID ┃ Name ┃ Currency ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ abc123 │ Main Portfolio │ USD │
│ def456 │ Savings │ EUR │
└────────────┴─────────────────┴──────────┘Use --raw for machine-readable output:
$ kubera list --raw
[
{
"id": "abc123",
"name": "Main Portfolio",
"currency": "USD"
},
{
"id": "def456",
"name": "Savings",
"currency": "EUR"
}
]# 1. Test connection (recommended first step)
kubera test
# 2. List portfolios to get IDs
kubera list
# 3. View details of first portfolio
kubera show abc123
# 4. View as tree for hierarchical view
kubera show abc123 --tree
# 5. Export to JSON for processing
kubera show abc123 --raw > portfolio.json
# 6. Update an asset value
kubera update asset_xyz --value 100000
# 7. Launch interactive mode
kubera interactiveThe --raw flag makes the CLI perfect for scripting:
#!/bin/bash
# Get all portfolio IDs
portfolio_ids=$(kubera list --raw | jq -r '.[].id')
# Loop through and export each
for id in $portfolio_ids; do
echo "Exporting $id..."
kubera show "$id" --raw > "portfolio_${id}.json"
done# General help
kubera --help
# Command-specific help
kubera list --help
kubera show --help
kubera update --help
kubera interactive --help
# Check version
kubera --version