Monarch Money API for Python
Project description
[!WARNING] This project was forked from https://github.com/hammem/monarchmoney and would not be possible without it. The upstream fork is no longer maintained. This fork fixes issues that prevent the library from working today, including the Monarch Money domain change to
api.monarch.com, auth persistence, and theget_budget()GraphQL query. Moving forward, please report issues here.
Monarch Money Community
Python library for accessing Monarch Money data.
Installation
From Source Code
Clone this repository from Git
git clone https://github.com/bradleyseanf/monarchmoneycommunity.git
Via pip
pip install monarchmoneycommunity
Import the library as monarchmoney after installation.
Instantiate & Login
There are two ways to use this library: interactive and non-interactive.
Interactive
If you're using this library in something like iPython or Jupyter, you can run an interactive-login which supports multi-factor authentication:
from monarchmoney import MonarchMoney
mm = MonarchMoney()
await mm.interactive_login()
This will prompt you for the email, password and, if needed, the multi-factor token.
Non-interactive
For a non-interactive session, you'll need to create an instance and login:
from monarchmoney import MonarchMoney
mm = MonarchMoney()
await mm.login(email, password)
This may throw a RequireMFAException. If it does, you'll need to get a multi-factor token and call the following method:
from monarchmoney import MonarchMoney, RequireMFAException
mm = MonarchMoney()
try:
await mm.login(email, password)
except RequireMFAException:
await mm.multi_factor_authenticate(email, password, multi_factor_code)
Alternatively, you can provide the MFA Secret Key. The MFA Secret Key is found when setting up the MFA in Monarch Money by going to Settings -> Security -> Enable MFA -> and copy the Two-factor text code. Then provide it in the login() method:
from monarchmoney import MonarchMoney, RequireMFAException
mm = MonarchMoney()
await mm.login(
email=email,
password=password,
save_session=False,
use_saved_session=False,
mfa_secret_key=mfa_secret_key,
)
Use a Saved Session
You can easily save your session for use later on. While we don't know precisely how long a session lasts, authors of this library have found it can last several months.
from monarchmoney import MonarchMoney, RequireMFAException
mm = MonarchMoney()
mm.interactive_login()
# Save it for later, no more need to login!
mm.save_session()
Once you've logged in, you can simply load the saved session to pick up where you left off.
from monarchmoney import MonarchMoney, RequireMFAException
mm = MonarchMoney()
mm.load_session()
# Then, start accessing data!
await mm.get_accounts()
Accessing Data
As of writing this README, the following methods are supported:
Non-Mutating Methods
get_accounts- gets all the accounts linked to Monarch Moneyget_account_holdings- gets all of the securities in a brokerage or similar type of accountget_account_type_options- all account types and their subtypes available in Monarch Moneyget_account_history- gets all daily account history for the specified accountget_institutions- gets institutions linked to Monarch Moneyget_budgets- all the budgets and the corresponding actual amountsget_credit_history- gets credit score snapshots and Spinwheel user detailsget_subscription_details- gets the Monarch Money account's status (e.g. paid or trial)get_recurring_transactions- gets the future recurring transactions, including merchant and account detailsget_transactions_summary- gets the transaction summary data from the transactions pageget_transactions- gets transaction data, defaults to returning the last 100 transactions; can also be searched by date rangeget_transaction_categories- gets all of the categories configured in the accountget_transaction_category_groups- all category groups configured in the accountget_transaction_details- gets detailed transaction data for a single transactionget_transaction_splits- gets transaction splits for a single transactionget_transaction_tags- gets all of the tags configured in the accountget_cashflow- gets cashflow data (by category, category group, merchant and a summary)get_cashflow_summary- gets cashflow summary (income, expense, savings, savings rate)is_accounts_refresh_complete- gets the status of a running account refresh
Mutating Methods
delete_transaction_category- deletes a category for transactionsdelete_transaction_categories- deletes a list of transaction categories for transactionscreate_transaction_category- creates a category for transactionsrequest_accounts_refresh- requests a synchronization / refresh of all accounts linked to Monarch Money. This is a non-blocking call. If the user wants to check on the status afterwards, they must callis_accounts_refresh_complete.request_accounts_refresh_and_wait- requests a synchronization / refresh of all accounts linked to Monarch Money. This is a blocking call and will not return until the refresh is complete or no longer running.create_transaction- creates a transaction with the given attributesupdate_transaction- modifies one or more attributes for an existing transactiondelete_transaction- deletes a given transaction by the provided transaction idupdate_transaction_splits- modifies how a transaction is split (or not)create_transaction_tag- creates a tag for transactionsset_transaction_tags- sets the tags on a transactionset_budget_amount- sets a budget's value to the given amount (date allowed, will only apply to month specified by default). A zero amount value willunsetorclearthe budget for the given category.create_manual_account- creates a new manual accountdelete_account- deletes an account by the provided account idupdate_account- updates settings and/or balance of the provided account idupload_account_balance_history- uploads account history csv file for a given accountupload_attachment- uploads a binary file for a given transaction by the provided transaction id
Contributing
Any and all contributions - code, documentation, feature requests, feedback - are welcome!
If you plan to submit up a pull request, you can expect a timely review. There aren't any strict requirements around the environment you'll need.
FAQ
How do I use this API if I login to Monarch via Google?
If you currently use Google or 'Continue with Google' to access your Monarch account, you'll need to set a password to leverage this API. You can set a password on your Monarch account by going to your security settings.
Don't forget to use a password unique to your Monarch account and to enable multi-factor authentication!
Projects Using This Library
Open a PR adjusting the README if you would like to be added to this list
Disclaimer: These projects are neither affiliated nor endorsed by Monarch Money.
mmoney-cli - Access your MonarchMoney data via CLI
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file monarchmoneycommunity-1.2.0.tar.gz.
File metadata
- Download URL: monarchmoneycommunity-1.2.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c613f2d256625a9aad75ed63d0543dbe0b8f97a8d99901f5219a7d5c8f7734ea
|
|
| MD5 |
adf43fcdb3f8039c36dbf0b9871e3b83
|
|
| BLAKE2b-256 |
d9abfe96aa1e298ff328a4014e9d8cd8ce42c4e48c81243aaf25034aa8d2a6d7
|
Provenance
The following attestation bundles were made for monarchmoneycommunity-1.2.0.tar.gz:
Publisher:
release.yml on bradleyseanf/monarchmoneycommunity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
monarchmoneycommunity-1.2.0.tar.gz -
Subject digest:
c613f2d256625a9aad75ed63d0543dbe0b8f97a8d99901f5219a7d5c8f7734ea - Sigstore transparency entry: 894195755
- Sigstore integration time:
-
Permalink:
bradleyseanf/monarchmoneycommunity@83eb1b2d7ed3d51cfbafdb329a499c207d1f3cba -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/bradleyseanf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83eb1b2d7ed3d51cfbafdb329a499c207d1f3cba -
Trigger Event:
release
-
Statement type:
File details
Details for the file monarchmoneycommunity-1.2.0-py3-none-any.whl.
File metadata
- Download URL: monarchmoneycommunity-1.2.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6376e7aa8ffdac428634d97e370dce6b802cb667842a5868bac1ff6720793730
|
|
| MD5 |
1671c326e21049cd19bfb416009652c7
|
|
| BLAKE2b-256 |
95f7021ff0d3afe812545566b6b9a652a7b267fdb93f7432f97c9d1b6dda78a0
|
Provenance
The following attestation bundles were made for monarchmoneycommunity-1.2.0-py3-none-any.whl:
Publisher:
release.yml on bradleyseanf/monarchmoneycommunity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
monarchmoneycommunity-1.2.0-py3-none-any.whl -
Subject digest:
6376e7aa8ffdac428634d97e370dce6b802cb667842a5868bac1ff6720793730 - Sigstore transparency entry: 894195763
- Sigstore integration time:
-
Permalink:
bradleyseanf/monarchmoneycommunity@83eb1b2d7ed3d51cfbafdb329a499c207d1f3cba -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/bradleyseanf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83eb1b2d7ed3d51cfbafdb329a499c207d1f3cba -
Trigger Event:
release
-
Statement type: