Skip to main content

Python client for the Empower (Personal Capital) unofficial API

Project description

personalcapital2

PyPI Python License

Get your financial data out of Empower (formerly Personal Capital) and into your own tools. Track net worth over time, analyze spending, monitor investment performance, or let an AI agent answer questions about your finances.

Three interfaces, one library:

  • Python API — frozen dataclasses with Decimal precision, not raw JSON
  • CLI (pc2) — structured JSON to stdout, pipe to jq, scripts, or spreadsheets
  • MCP server — give Claude or other AI agents direct access to your financial data

Built on the reverse-engineering work of haochi/personalcapital and traviscook21/personalcapital (both MIT).

Install

pip install personalcapital2
# or with uv
uv add personalcapital2

Quick start

from datetime import date
from personalcapital2 import authenticate

client = authenticate()  # interactive login with 2FA

result = client.get_accounts()
for acct in result.accounts:
    print(f"{acct.name:<30} ${acct.balance}")
print(f"Net worth: ${result.summary.networth:,.2f}")

result = client.get_transactions(date(2026, 1, 1), date(2026, 3, 31))
for txn in result.transactions:
    print(f"{txn.date}  {txn.description:<30}  ${txn.amount:.2f}")
print(f"Net cashflow: ${result.summary.net_cashflow:,.2f}")

Authentication

authenticate() reads credentials from environment variables, falling back to interactive prompts:

Variable Purpose
EMPOWER_EMAIL Empower account email
EMPOWER_PASSWORD Empower account password
PC2_SESSION_PATH Custom session file location (default: ~/.config/personalcapital2/session.json)

Sessions are saved and reused until they expire (typically 1-2 days). The session path can also be overridden per-command with --session.

CLI

The pc2 command outputs structured JSON (data to stdout, errors to stderr). Designed for scripting and AI agents — every error includes a machine-readable type and recovery suggestion.

pc2 accounts                                # all linked accounts
pc2 transactions --start 90d                # last 90 days of transactions
pc2 holdings                                # current investment positions
pc2 net-worth --start yb --format csv       # YTD net worth as CSV
pc2 performance --start mb-6 --account-ids 123,456
pc2 spending                                # current month/week/year spending

Date shortcuts: 30d (days ago), mb / me (month begin/end), yb / ye (year begin/end), mb-3 (3 months ago). See CLI Reference for the full list.

Python API

All methods return frozen dataclasses with datetime.date and decimal.Decimal fields. See API Reference for methods, response containers, and examples, and Model Reference for every field and type.

MCP Server

An MCP tool server gives AI agents (Claude Code, Claude Desktop, etc.) direct access to your financial data. The agent can call tools like get_transactions or get_holdings and reason over the results.

pip install "personalcapital2[mcp]"
pc2 login   # authenticate first
pc2 mcp     # start the server

Client config (Claude Code / Claude Desktop):

{
  "mcpServers": {
    "empower": {
      "type": "stdio",
      "command": "pc2",
      "args": ["mcp"],
      "env": {"PC2_SESSION_PATH": "~/.config/personalcapital2/session.json"}
    }
  }
}

The server is token-aware — large responses are automatically truncated to fit within context limits (~12,500 tokens by default, configurable via PC2_MCP_MAX_CHARS), while summaries are always preserved in full.

The CLI and MCP server follow an agent-first design: structured JSON errors with recovery suggestions, meaningful exit codes, self-documenting help text, and non-interactive TTY detection.

Known API quirks

This library uses Empower's unofficial internal web API, which is not affiliated with Empower and may change without notice.

  • is_spending is unreliable on refunds. Use transaction_type (e.g. "Refund") instead.
  • performance and benchmarks share one API call. get_performance() returns both in a single PerformanceResult.
  • get_accounts may not list all accounts with holdings. Some accounts (employer 401k plans, crypto exchanges) can appear in get_holdings, get_account_balances, and get_performance but not in get_accounts. Use get_holdings to discover investment account IDs.
  • Fee fields can be NaN. The API returns "NaN" for fees_per_year, fund_fees, total_fee, and advisory_fee_percentage on some investment accounts (401k plans, crypto, RSUs). These are coerced to None — the account is not dropped.
  • get_spending ignores date range and interval. The API always returns current-period spending for all three interval types (MONTH, WEEK, YEAR), regardless of the start_date, end_date, or interval parameters.
  • Sessions expire. Typically 1-2 days. Run pc2 login again on auth errors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

personalcapital2-0.1.4.tar.gz (116.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

personalcapital2-0.1.4-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file personalcapital2-0.1.4.tar.gz.

File metadata

  • Download URL: personalcapital2-0.1.4.tar.gz
  • Upload date:
  • Size: 116.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for personalcapital2-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4d8baf29f329f795a0554b80fb50e2ba322d29013201e7eec95f305a17f3c2a2
MD5 dabce44ab8817a3c688096040c5c9ba4
BLAKE2b-256 c1e6ed9b99917c433b05a5a7b21f1d6dd325c88ed0b4d19c4555e0e6798af756

See more details on using hashes here.

Provenance

The following attestation bundles were made for personalcapital2-0.1.4.tar.gz:

Publisher: release.yml on wpwilson10/personalcapital2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file personalcapital2-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for personalcapital2-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2e8f83db58a4fd73ab292fc4706ce2f5c8b22e6ca49617e1b662f1e5b65b7fae
MD5 328896aa76e4f746b4170ed6080b3c5d
BLAKE2b-256 74fd19a503b2b65ebc3461863239b9b9aa38585e8900a8ce496a391991a01185

See more details on using hashes here.

Provenance

The following attestation bundles were made for personalcapital2-0.1.4-py3-none-any.whl:

Publisher: release.yml on wpwilson10/personalcapital2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page