Personal Capital library for accessing its API

personal, capital, financial, money
pip install personalcapital==1.0.1


Personal Capital

Python library for accessing Personal Capital data


You need to first create an instance.

pc = PersonalCapital()

Then you will need to authenticate the account by logging in:

pc.login(email, password)

login may throw a RequireTwoFactorException, if two factor is enabled on your account and the current session is not yet associated with the account. In this case, you will need to pick a way to complete the two factor authenticate by calling


mode can either be TwoFactorVerificationModeEnum.SMS or TwoFactorVerificationModeEnum.EMAIL.
Then you need to finish the two factor challenge by verifying the code and continue the login process.

pc.two_factor_authenticate(mode, raw_input('code'))

Once authenticated, you can start fetching data from the Personal Capital API.

accounts_response = pc.fetch('/newaccount/getAccounts')

The above request will load your accounts data, and with that response you can get your net worth.

print('Networth', accounts_response.json()['spData']['networth'])

To avoid two factor authentication every time you run the script, you can use get_session() to store your session somewhere and set_session(session) to re-use the session.

Here's the entire thing.

from personalcapital import PersonalCapital, RequireTwoFactorException, TwoFactorVerificationModeEnum

pc = PersonalCapital()

email, password = "email@domain.tld", "password"

    pc.login(email, password)
except RequireTwoFactorException:
    pc.two_factor_authenticate(TwoFactorVerificationModeEnum.SMS, raw_input('code: '))

accounts_response = pc.fetch('/newaccount/getAccounts')
accounts = accounts_response.json()['spData']

print('Networth: {0}'.format(accounts['networth']))


See for an example script.

To run it, simply run python

Or set the environment email and password so you don't need to enter it every time.

PEW_PASSWORD="password" PEW_EMAIL="email" python 

Personal Capital API

Please inspect the network requests to see what requests are possible. The example includes two such calls.