Skip to content

tomLadder/magenta-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‘ magenta-cli

The unofficial command-line interface for Magenta Telekom Austria

Manage your Magenta account directly from the terminal. Built with TypeScript, powered by Bun.

πŸ“– Documentation β€’ Features β€’ Installation β€’ Quick Start β€’ Commands β€’ Contributing

Documentation Version License Bun TypeScript Platform


Caution

Legal Disclaimer / Rechtlicher Hinweis

This is an unofficial tool and is not affiliated with Magenta Telekom (T-Mobile Austria GmbH). Using this program may violate Magenta's terms of service. You are solely responsible for ensuring your use complies with applicable terms and laws. The developers accept no liability for any damages or legal consequences arising from its use. Use at your own risk.

Dies ist ein inoffizielles Tool und steht in keiner Verbindung zu Magenta Telekom (T-Mobile Austria GmbH). Die Verwendung dieses Programms kann gegen die Nutzungsbedingungen von Magenta verstoßen. Sie sind selbst dafür verantwortlich, die RechtmÀßigkeit Ihrer Nutzung sicherzustellen. Die Entwickler übernehmen keine Haftung für SchÀden oder rechtliche Konsequenzen. Die Nutzung erfolgt auf eigenes Risiko.


Features

Account Management

  • View customer information
  • Check login status
  • Secure password authentication with RSA encryption

Invoice Management

  • List all invoices with status
  • Download invoices as PDF
  • View invoice details

Tariff Information

  • View active tariffs and contracts
  • See contract details and status

Developer Experience

  • JSON output for scripting and AI agents
  • Beautiful terminal UI with spinners
  • Cross-platform compatibility

Installation

Quick Install (macOS / Linux)

curl -fsSL https://raw.githubusercontent.com/tomLadder/magenta-cli/main/install.sh | sh

Pre-built binaries are also available on the Releases page.

From Source

Prerequisites: Bun v1.0 or higher

# Clone the repository
git clone https://github.com/tomLadder/magenta-cli.git
cd magenta-cli

# Install dependencies
bun install

# Build the standalone executable
bun run build

# Move to your PATH (optional)
mv dist/magenta /usr/local/bin/

Development Mode

# Run directly without building
bun run dev -- --help

Quick Start

1. Login to your account

magenta login

You'll be prompted for your email and password.

2. Check your identity

magenta whoami

3. List your tariffs

magenta tariffs

4. List your invoices

magenta invoices list

5. Download an invoice

magenta invoices download 123456789012

Commands

Quick Reference

Command Description
magenta login Authenticate with Magenta
magenta logout Clear stored credentials
magenta whoami Display current user info
magenta status Check login status
magenta tariffs List all tariffs/contracts
magenta invoices list List all invoices
magenta invoices get <id> Get invoice details
magenta invoices download <id> Download invoice as PDF
magenta config get Show all settings
magenta config set <key> <value> Set a configuration value
magenta config reset Reset to defaults
magenta config path Show config file location

Global Options

These options are available on all commands:

Option Description
-h, --help Display help for the command
-V, --version Display CLI version (root command only)
# Show general help
magenta --help

# Show help for a specific command
magenta login --help
magenta invoices --help
magenta invoices download --help

# Show version
magenta --version

Command Reference

magenta login

Authenticate with your Magenta account using email and password.

magenta login [options]
Option Description
-u, --username <username> Username or email
-p, --password <password> Password
--json Output result as JSON

Examples:

# Interactive login (prompts for credentials)
magenta login

# Provide username upfront
magenta login --username [email protected]

# Non-interactive login (for scripts/AI agents)
magenta login --username [email protected] --password mypassword --json

magenta logout

Clear stored session and credentials.

magenta logout

No options available.


magenta whoami

Display detailed information about the currently logged-in user.

magenta whoami [options]
Option Description
--json Output result as JSON

Examples:

# Pretty output
magenta whoami

# JSON output (for scripting)
magenta whoami --json

magenta status

Check current login status and session information.

magenta status [options]
Option Description
--json Output result as JSON

Examples:

# Pretty output
magenta status

# JSON output
magenta status --json

magenta tariffs

List all tariffs and contracts associated with your account.

magenta tariffs [options]
Option Description
--json Output result as JSON

Examples:

# Pretty output
magenta tariffs

# JSON output
magenta tariffs --json

magenta invoices list

List all invoices.

magenta invoices list [options]
Option Description
--json Output result as JSON

Examples:

# List all invoices
magenta invoices list

# JSON output
magenta invoices list --json

magenta invoices get <id>

Get detailed information about a specific invoice.

magenta invoices get <id> [options]
Argument Description
<id> Invoice ID or Bill Number (e.g., 123456789012 or TMA.123456789012)
Option Description
--json Output result as JSON

Examples:

# Get invoice details
magenta invoices get 123456789012

# Using full bill ID
magenta invoices get TMA.123456789012

# JSON output
magenta invoices get 123456789012 --json

magenta invoices download <id>

Download an invoice as PDF.

magenta invoices download <id> [options]
Argument Description
<id> Invoice ID or Bill Number
Option Description
-o, --output <path> Custom output file path

Examples:

# Download invoice as PDF (default filename)
magenta invoices download 123456789012

# Custom output path
magenta invoices download 123456789012 --output ~/invoices/march-2026.pdf
magenta invoices download 123456789012 -o /path/to/invoice.pdf

magenta config get

Display current CLI configuration.

magenta config get [options]
Option Description
--json Output result as JSON

Examples:

# Pretty output
magenta config get

# JSON output
magenta config get --json

magenta config set <key> <value>

Set a configuration value.

magenta config set <key> <value>
Argument Description
<key> Configuration key (see available keys below)
<value> Value to set

Available Keys:

Key Values Description
outputFormat pretty, json Default output format for all commands

Examples:

# Set default output to JSON
magenta config set outputFormat json

# Set default output to pretty (human-readable)
magenta config set outputFormat pretty

magenta config reset

Reset all configuration to default values. This clears settings but preserves authentication.

magenta config reset

No options available.


magenta config path

Display the path to the configuration file.

magenta config path

No options available.

Example output:

/Users/username/.magenta/config.json

Configuration

Configuration is stored in ~/.magenta/:

File Description
config.json Settings and session data

Available Settings

Key Values Default Description
outputFormat pretty, json pretty Default output format

Scripting & Automation

JSON Output

All commands support --json for machine-readable output:

# Get user email
magenta whoami --json | jq '.username'

# Get latest invoice amount
magenta invoices list --json | jq '.[0].amountDue.amount'

# Calculate total invoices
magenta invoices list --json | jq '[.[].amountDue.amount] | add'

Batch Operations

# Download all invoices
for id in $(magenta invoices list --json | jq -r '.[].billNo'); do
  magenta invoices download "$id"
done

# Export invoice summary to CSV
magenta invoices list --json | jq -r '.[] | [.billDate, .billNo, .amountDue.amount] | @csv'

Architecture

src/
β”œβ”€β”€ index.ts           # CLI entry point
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ client.ts      # HTTP client with session handling
β”‚   β”œβ”€β”€ auth.ts        # Password authentication with RSA encryption
β”‚   β”œβ”€β”€ profile.ts     # User profile
β”‚   β”œβ”€β”€ dashboard.ts   # Dashboard/tariffs
β”‚   └── invoices.ts    # Invoice operations
β”œβ”€β”€ cli/
β”‚   └── commands/      # Command implementations
β”œβ”€β”€ store/
β”‚   └── config.ts      # Configuration management
└── types/
    └── index.ts       # TypeScript interfaces

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


FAQ

How does authentication work?

Magenta uses password-based authentication:

  1. You provide your email/username and password
  2. The password is encrypted using RSA-OAEP with Magenta's public key
  3. The session tokens are stored locally in ~/.magenta/config.json
How long does a session last?

Access tokens expire after approximately 15 minutes, but refresh tokens last much longer (about 14 days). The CLI will show token expiration in magenta status.

Where are my credentials stored?

Your session tokens are stored in ~/.magenta/config.json with secure file permissions (0600). Your password is never stored - only the session tokens.

What's the difference between invoice ID formats?

Magenta uses two formats:

  • Bill Number: 123456789012 (just the number)
  • Bill ID: TMA.123456789012 (with prefix)

The CLI accepts both formats for convenience.


Acknowledgments


License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with care in Austria

About

πŸ“‘ CLI for managing your Magenta Telekom Austria account from the terminal

Resources

License

Contributing

Stars

Watchers

Forks

Contributors