Trying to upload transactions to Mint using a CSV and Python? Find the source code and examples on Github.
Page Contents
Why You Might Need to Add Transactions into Mint
To create a budget you are going to want data to base spending habits on. While mint.com allows for up to a 3-month auto-import, it is not guaranteed. This also neglects periodic purchases like new brakes or tires for your car.
The whole reason to have Mint is to be able to see all the data in one place. All in all, let’s face it: The software’s “from 30 to 90 days” just doesn’t cut it for new users.
My Search for Tools that do Mint Import Transactions
Having worked in technology for as long as I have, I knew I could not be the only one with this problem. So I immediately went on Google to see if there was anyone else who had solved this issue for me.
Low and behold, I did find a YouTube video of a proof of concept approach for automating manual transactions with a plug for their premium product. There was no code available though, so I would have to reverse engineer that myself.
Not wanting to totally start from scratch, I figured I’d check out GitHub too. I stumbled upon some similar code specifically for the UK locale and date formats. It was clearly written by someone else like me who had a one-off problem and decided to solve it themselves.
The code did lack some features and process clarity that I needed, so I figured I’d write my own version with the documentation where other people could easily extend or augment it for themselves in the future.
My Python 3 Import CSV Tool
First, I had to pick a language to write this tool in. At the time of writing this article, I have had professional experience in Java, Javascript, PHP, Ruby, Python, LUA, and Bash.
I chose Python for the ease of use of an interpreted language (one that is compiled on the fly by the machine, not the user) and the ease of PIP for extending functionality for things like CSVs.
Python Package Dependencies
We are going to need the following Python packages for our script. For those not familiar with installing packages via PIP, we have included instructions in the import.py documentation.
"""
#################################
Pre-requisites needed
#################################
If you are missing any of the following you can install with:
pip install $name
Example: pip install csv
OR if you are using pip3
pip3 install $name
Example: pip3 install csv
"""
import csv
import datetime
import os
import random
import requests
import time
import urllib.parse
- CSV – used to parse the input file
- datetime – used to manipulate date strings and objects
- os – used to interact with our local machine
- random – used to implement random numbers
- requests – used to submit HTTP requests (note we are actually just using curl right now)
- time – used to interact with time strings and objects
- urllib – used to HTTP encode strings so they can be submitted over POST and form data
Process to Importing Transactions
- Upload CSV data to python
- Process date for correct format and HTTP encode the result
- Process merchant text for HTTP encode
- Process categories and change your bank’s category name into a Mint category ID (limited in scope based on the categories I needed when I wrote this)
- Process amount for positive or negative value, indicating the transaction data is income or an expense
- Create CURL string post request
- Send POST Request to Mint as new transaction data.
- Force Randomized Wait Time before starting next request
Setting Up a Mint CSV Import Client
Because there is no public Mint API, we are going to need to find a way to mimic manual transaction adds using the UI’s form post.
William Lorfing (Intuit Developer Group)3 years ago
There are no APIs to access Mint data.
Mint HelpDesk as of 05/04/20
To do this we are going to need to use your browsers DevTools:
"""
#################################
Mint Client Credentials
#################################
You will need the tags, cookie, and token to simulate a UI form submission. You can get these by opening developer tools > network analysis tab and doing
a test submission in mint.com. From there look for the post request to "updateTransaction.xevent" and grab the credentials from the header and body
"""
account = 'XXXXXXX' # grab from POST request form body in devtools
tag1 = 'tagXXXXXX' # in form of tagXXXXXXX
tag2 = 'tagXXXXXXX' # in form of tagXXXXXXX
tag3 = 'tagXXXXXXX' # in form of tagXXXXXXX
cookie = 'XXXXXXX' # grab from POST request header in devtools
referrer = 'XXXXXXX' # grab from POST request header in devtools
token = 'XXXXXXX' # grab from POST request form body in devtools
- Go to Mint and login
- Go to transactions and click “+transaction”
- Open your DevTools (F12 on Chrome) and go to Network Tab
- Submit a TEST transaction for $0.01, the network analysis tab will record the POST submission under “updateTransaction.xevent”
- Click on “updateTransaction.xevent” and you can see the headers of your request. Specifically, you will want the “request headers” for the cookie and the “form data” for things like tags and your token.
Setting Up a Bank’s Transactions CSV
Each bank will have a different way to get your transactions as CSV data. If your bank really doesn’t have this functionality,
- Get a new bank 😉
- Reach out to support as ask for a CSV file
- If they won’t do that, you can manually extract and copy the data into a spreadsheet, transform it into CSV format, then load it in (this is beyond the scope of this article, but we’ll have an article on scraping and text transformations later).
**STRONG RECOMMENDATION**
If you are uploading thousands of transactions like I did, you are going to want to sort your CSV by transaction date. This will allow you to retry from where it left off in the event of a failure.
What is important is understanding the format that the program expects. My script is based on a Chase.com CSVs export. If your bank uses a different format, you can adjust the column maps OR scrub it to match.
To those not familiar with reading Python, row[X] means the item X from left to right of that row starting with number 0. In my script, the first column must be the date of the transactions, followed by post date, merchant memo, categoryID, typeID, and amount of transaction (signed +-).
# Initialize Variables
date = (row[0])
postDate = (row[1])
merchant = (row[2])
catID = (row[3])
typeID = (row[4])
amount = (float(row[5]))
Adding Transaction Categories
One of the main areas I did not fully develop is in category mapping. Mint requires you to use categoryIDs and names defined by them, which means the ones from your bank will not work. To deal with this, I have implemented two functions:
# Category ID Mapping Function
def category_id_switch(import_category):
category_id_switch maps the Chase named categories to Mint category ids. To make this match your bank’s categories, you just change the keys like “Credit Card Payment” to whatever your bank calls it. To add additional category support, I have included Mint’s category menu in html format as of 05/04/20 where you can grab the category names and ids from the markup.
# Category NAME Mapping Function
def category_name_switch(mint_id):
def category_name_switch maps Mint category ids to their Mint names. To add additional category support I have included Mint’s category menu in html format as of 05/04/20 where you can grab the category names and ids from the markup.
There was only one special case in my 1,800 transactions, and that is when Chase’s type = “payment”. In these scenarios, we had to handle them as catID 2101 in Mint. If your bank uses a different payment category, you can either comment this code out or map it to a category of your choosing.
# typeID payment overrides all categories
if typeID == "Payment":
catID = '2101' # Since I was importing credit cards I have mine set to credit card payment. If you are doing bank accounts you many want to change this to payment general
Running CSV Import
Once you’ve got your client all setup and your category maps set all you need to do is run the following command from the directory your code and the CSV are in:
python3 import.py
OR if you are not using the python3 namespace
python import.py
That is it! You can sit back and watch the transactions add into your profile.
![software image](https://nathanielkam.com/wp-content/uploads/2020/05/chart-close-up-data-desk-590022-scaled.jpg)
![1star](https://nathanielkam.com/wp-content/plugins/all-in-one-schemaorg-rich-snippets/images/1star.png)
![1star](https://nathanielkam.com/wp-content/plugins/all-in-one-schemaorg-rich-snippets/images/1star.png)
![1star](https://nathanielkam.com/wp-content/plugins/all-in-one-schemaorg-rich-snippets/images/1star.png)
![1star](https://nathanielkam.com/wp-content/plugins/all-in-one-schemaorg-rich-snippets/images/1star.png)
![gray](https://nathanielkam.com/wp-content/plugins/all-in-one-schemaorg-rich-snippets/images/gray.png)
FYI, I was playing around with the “category menu in HTML format” you published to see if I could generate a complete list of categories and IDs. I noticed there are several categories with an ID beginning with “1963”. These categories are 7 digits long and have some oddly specific names. My guess is they’re custom categories you added to mint.
I did manage to make a full list and added it into your import.py switcher. I’ll put it up on github when I get it working.
Thank you Joseph! Submit a PR whenever you get a chance and I’ll check it out 🙂
Thanks for the PR submission! Hoping these new category mappings will help more people get their transactions imported into mint successfully.
Almost got this to work but not quite…the category name was always being set to “Uncategorized” because the catID was stringified before the lookup. Solved this by stringifying after setting category. The second problem is, the curls look successful (response 0) but I do not see the transactions appear in my account. The HTTP location shows ‘internalError.event’, but not sure what that means.
HTTP/2 302
date: Fri, 14 Aug 2020 06:53:53 GMT
content-length: 0
location: http://mint.intuit.com/internalError.event
server: Mint App
x-frame-options: SAMEORIGIN
cache-control: no-cache, no-store, must-revalidate,
expires: 0
pragma: no-cache
x-is-fdp-user: true
x-mint-start: 1597388033155
x-mint-end: 1597388033166
content-language: en-US
strict-transport-security: max-age=16000000; includeSubDomains; preload;
x-xss-protection: : 1;mode=block
x-content-type-options: : nosniff
@christine HTTP/2 302 means you were redirected to there. Since this is mimic’ing front end UI not a real API my assumption would be your credentials expired and it was trying to bounce you somewhere else rather than 403 you. Obviously for security reasons do not post your token in here, will check to see if I can replicate this on my version today.
A good way to check to see if this is the case is to just do a single curl using command line, if that works all the script does is duplicate that same request.
Did you have any luck with re authentication of token and cookie?
I am getting same issue as well..Executing single curl command gives same issue as well. Also, I removed accountId from referrer query as mint seems to be not having that any more in its request and form body..Adding referrer to command results in same outcome..
Here is my curl command (I removed Cookie and token :-))
curl -i -s -k -X POST ‘https://mint.intuit.com/updateTransaction.xevent’ -H ‘Host: mint.intuit.com’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36’ -H ‘Accept: */*’ -H ‘Accept-Language: en-US,en;q=0.5’ –compressed -H ‘X-Requested-With: XMLHttpRequest’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ -H ‘Referer: https://mint.intuit.com/transaction.event‘ -H ‘Cookie: ‘ -H ‘Connection: close’ –data ‘cashTxnType=on&mtCheckNo=&tag2917210=0&tag2917209=0&=0&task=txnadd&txnId=%3A0&mtType=cash&mtAccount=10866214&symbol=¬e=&isInvestment=false&catId=20&category=Imported&merchant=Citi%3A%20AMAZON%20MKTPLACE%20PMTS%20AMZN.COM/&date=1/16/17&amount=-4.88&mtIsExpense=true&mtCashSplitPref=2&token=’
HTTP/2 302
date: Sat, 26 Sep 2020 12:43:07 GMT
content-length: 0
location: http://mint.intuit.com/internalError.event
server: Mint App
x-frame-options: SAMEORIGIN
cache-control: no-cache, no-store, must-revalidate,
expires: 0
pragma: no-cache
x-is-fdp-user: true
x-mint-start: 1601124187536
x-mint-end: 1601124187545
content-language: en-US
strict-transport-security: max-age=16000000; includeSubDomains; preload;
x-xss-protection: : 1;mode=block
x-content-type-options: : nosniff
Checking this out tonight, thanks for getting me the print out 🙂
Thanks.
Hmm not able to re produce on Windows, will need to try it out on my Mac.
It happened on my Mac.. I will give it a try on Windows..
Hey there!
Just wondering how you fixed the category issue/ if you could provide the code! I got the rest of the code working but am having the same issue as you, Uncategorized shows up in mint, and I’m not sure how to fix it from your response or where to look. Thanks in advance if you have it!
If you are getting uncategorized there are 2 places that comes from
1) is no category in your csv
2) no category mapping in your python file
Check line 307 and 291 in the current build. Basically it’s taking what is in your CSV, and then running a giant switch statement to turn it into an ID. If your catName is not in the switch it defaults to uncategorized. If csv has no category it defaults to uncategorized.
I keep getting a 255 curl response. When I try and run a single curl statement from the terminal, I get “xxx is not recognized as an internal or external command” where xxx is a string from the cookie.
I’m getting the same 255 Curl Response… Any idea where is my potential error?
Okay did quite a bit of testing and was able to reproduce the 255 error. Issue seems to be with the windows libcurl syntax vs the linux subsystem’s. I am planning to move this project off curl in the near future. But if you wanted to try and verify, you can copy the curl command in your browser’s network tab as curl for bash and run it using linux subsystem and it works. Do the same as curl for cmd and it fails with 255 (at least i does on my system).
I’m also getting the 255 response. Hope you are able to come up with a new solve. Most of this is way over my head so definitely relying on you to create a new solution.
FWIW: I just tried this on my windows laptop – and see the same ‘not recognized as internal or external command’ 255 error response.
Does this mean that I need to run this from a linux box? I have a git bash shell for windows…but I see the same issue there.
I just installed and ran your latest code. All seems like it should work. I presume the cookie is as long as I’m seeing. Running on a mac. Any quick tips after checking that the session is alive?
HTTP/2 500
date: Mon, 02 Nov 2020 00:59:58 GMT
content-length: 0
server: Mint App
strict-transport-security: max-age=16000000; includeSubDomains; preload;
x-xss-protection: : 1;mode=block
x-content-type-options: : nosniff
Transaction Date: 01/15/2020
Merchant Restaurants
Category ID: 707
Category Name: Uncategorized
Amount: -00.01
Expense: true
CURL Request: curl -i -s -k -X POST ‘https://mint.intuit.com/updateTransaction.xevent’ -H ‘Host: mint.intuit.com’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36’ -H ‘Accept: */*’ -H ‘Accept-Language: en-US,en;q=0.5’ –compressed -H ‘X-Requested-With: XMLHttpRequest’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ -H ‘Referer: https://mint.intuit.com/transaction.event?accountId=https://mint.intuit.com/transaction.event‘ -H ‘Cookie: ivid=XXX; ixp_ivid=XXX; ccpa=XXX; ivid_b=XXX; visitCount=XXX; tt_ipgeo=XXX; ivid_p=XXX; AMCV_969430F0543F253D0A4C98C6%40AdobeOrg=XXX; qbn.gauthid=XXX; qbn.agentid=XXX; qbn.uidp=XXX; qbn.parentid=50000003; userIdentifier=XXX; ius_at.enabled=true; ius_at=XXX; _exp_mintPN=10; MINTJSESSIONID=XXX; ROUTEID=XXX; mintPN=XX; currentClientType=XX; brandingOption=whitelabel; current-config-source=Back-end; userguid=XX; mintUserName=””; pseudonymID=XXX; _transactionIframeLocation=undefined’ -H ‘Connection: close’ –data ‘cashTxnType=on&mtCheckNo=&tag1303xxx=0&tag1303xxx=0&tag1303xxx=0&task=txnadd&txnId=%3A0&mtType=cash&mtAccount=XXX&symbol=¬e=&isInvestment=false&catId=707&category=Uncategorized&merchant=Restaurants&date=01/15/2020&amount=-0.01&mtIsExpense=true&mtCashSplitPref=2&token=XXX’
CURL Response: 0
I got this script to run after re-configuring the header to match the Mint curl request that I copied from my browser’s network tab. Also, I was getting the ‘HTTP/1.1 302 Moved Temporarily’ response for many transactions, which I discovered was caused by special characters in my .csv data ‘Description’ column. Here’s what I fixed in the .csv to get the transactions to go through:
> date format must be in mm/dd/yyyy
> description:
> remove where there are two spaces together (‘ ‘)
> remove apostrophes (‘)
> remove double percent signs (%%)
> remove single percent signs (%)
Here’s an example CURL which was successful:
curl -i -s -k -X POST ‘https://mint.intuit.com/updateTransaction.xevent’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:85.0) Gecko/20100101 Firefox/85.0’ -H ‘Accept: */*’ -H ‘Accept-Language: en-US,en;q=0.5’ –compressed -H ‘X-Requested-With: XMLHttpRequest’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ -H ‘Origin: https://mint.intuit.com‘ -H ‘Connection: keep-alive’ -H ‘Referer: https://mint.intuit.com/transaction.event‘ -H ‘Cookie: ‘ –data-raw ‘cashTxnType=on&mtCheckNo=&tag1263673=0&tag1263674=0&tag1263675=0&task=txnadd&txnId=%3A0&mtType=cash&mtAccount=&symbol=¬e=&isInvestment=false&catId=20&category=&merchant=Check%20#%200000000107&date=04%2F10%2F2020&amount=-172.9&mtIsExpense=true&mtCashSplitPref=1&mtCashSplit=on&token=’
Thought I’d leave this comment for others like me who have no idea what to do with the above but want to use it… it looks complicated but after poking around asking for internet help it was really easy! I just used a live USB of linux (in my case Linux Lite 3.8 on a crappy old netbook), copied the downloaded repository zip to the live linux, extracted, put in the parameters from Mint into import.py, copied over my csv to import, then in a terminal window from the folder with import.py entered “python3 import.py” and off it went, worked like a charm! I also was importing data exported from a Chase credit card so the categories and columns all were the same and I did this on 2/11/2021. Thanks!!!
I’ve edited import.py… and tried just importing the test file import.csv
(venv) ronb@mercury:~/Programs/mint-csv-import-master$ python3 import.csv
File “import.csv”, line 1
Transaction Date,Post Date,Description,Category,Type,Amount
^
SyntaxError: invalid syntax
Ideas where I could be going wrong?
Have you updated all dependent libraries? Sounds like its a csv library issue. You can also try removing the header row and seeing if just data works.
Nathaniel,
Thanks a lot for making your code available. I had to port over 11,000 transactions saved up from my FinanceWorks account to Mint for years 1999 through 2018. I changed my CSV file a bit following your example file. I had to add a few categories to map FinanceWork categories to Mint categories on “def category_id_switch” function. This change made all the transactions to be categorized into Mint rather than being tagged as “Uncategorized”. While running your code, I frequently refreshed Mint page to make sure that the account stayed logged in. After about 6 hours, I had to leave the computer unattended for the night. Today I found that about 9,000 new transactions came through in my Mint account – although the python code seems to indicated that it has uploaded all of the 11,000 transactions. Probably my Mint account was logged out automatically in the night. I re-ran the code with the rest of the CSV file and with the new login credentials. While I do get CURL Response: 0, the Mint is not actually registering those transactions. Do you think Mint prevents accounts from accepting too many manual transactions? At any rate, thanks a lot for your post and codes, which have saved me a lot of time & money (MintImporter charges $20 for 200 transaction uploads).
Hello Manoj,
I do believe there is rate limiting on mint’s side, though it would be a bit painful on 11,000 transactions you could try to work with the random delay setting to side skirt that issue.
Hello, I’m getting this error when trying to import a test CSV.
‘42527477667680677663131521192981840264’ is not recognized as an internal or external command,
operable program or batch file.
Transaction Date: 7/22/2010
Merchant LITTLE%20SHEEP%20MONGOLIAN
Category ID: 7
Category Name: Food%20%26%20Dining
Amount: -58.29
Expense: true
CURL Request: curl -i -s -k -X POST ‘https://mint.intuit.com/updateTransaction.xevent’ -H ‘Host: mint.intuit.com’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36’ -H ‘Accept: */*’ -H ‘Accept-Language: en-US,en;q=0.5’ –compressed -H ‘X-Requested-With: XMLHttpRequest’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ -H ‘Referer: https://mint.intuit.com/transaction.event?accountId=https://mint.intuit.com/transaction.event‘ -H ‘Cookie: ivid=4205e908-cd28-4bf6-8dce-75700e067529; _gcl_au=1.1.404251089.1607277876; s_ecid=MCMID|42527477667680677663131521192981840264; aam_uuid=42721064086277510113114305412852936029; ivid_b=b27ea5ad-8907-459b-9dde-fb0021271bfd; did=SHOPPER2_dc35634359c0bd263c786adbfba6f738bafbcfae550e1978bd1dca0f9e4382f409277ccb583e50f2000b4314a97fbd25; s_fid=7F12202BE92FA4C1-0532FAED98542588; s_vi=[CS]v1|2FE6808E0515C2F4-6000084AA5CF1BEC[CE]; currentClientType=Mint; brandingOption=whitelabel; current-config-source=Back-end; mu=1; userguid=7F2284557A8C3D8B; wa_login=1; ivid_p=4205e908-cd28-4bf6-8dce-75700e067529; _fbp=fb.1.1610341990594.1960179897; aam_newdil=42721064086277510113114305412852936029; tms_mint=14277:6:37527; tt-d1a=1; refundMonitorState=true; ccpa=1|1; optimizelyEndUserId=oeu1611004471033r0.8010930886257095; BVBRANDID=03003985-0444-4fb0-bfbe-b1a249ea4482; mint.glogin=mohammedawa; cjConsent=MXxOfDB8WXww; cjevent_dc=b7fa8bca5c5311eb808e00320a1c0e14; cjevent_sc=b7fa8bca5c5311eb808e00320a1c0e14; aam_mcid=42527477667680677663131521192981840264; aam_uuid=42721064086277510113114305412852936029; aam_aud=mesg1=20607648:20607655:20607660:20608396:20643848:20643895:20643896:20666892:20862765:20862768:21304497; utag_mint_mktid=fbp:fb.1.1610341990594.1960179897$s_ecid:MCMID|42527477667680677663131521192981840264; tms=14192:7:37331|14256:1:37476|14913:3:39205|14883:2:39126|14261:6:37488|14295:7:37587|14281:5:37544|14794:4:38906; aam_qbus=mesg1=16601754:16602502:16602973:17547791:17547551:17726372; qbn.glogin=mohammedawa; ajs_user_id=”16b8d2fee92904fcf80741c23cb286db8″; ajs_anonymous_id=”4205e908-cd28-4bf6-8dce-75700e067529″; ensmktids={“ecid”:”|9″,”s_ecid”:”MCMID|42527477667680677663131521192981840264″,”fbp”:”fb.1.1610341990594.1960179897″,”dcm_id”:”0″}; RT=”z=1&dm=intuit.com&si=0e98039b-f94e-46fc-ab9d-41e410f55722&ss=klpeybpd&sl=4&tt=82u&bcn=//173e255e.akstat.io/&ld=3rba&ul=4p9f&hd=4t4e”; _uetvid=72f332a053cb11ebbfcc6f28cc0c3c7a; tt_ipgeo=1261144642|US|***|Y|37.751|-97.822|0|null|null; priorityCode=3468337910; visitCount=94|1615080902119; BVBRANDSID=b11059b9-4baf-4baa-bb19-3f6ca552dcb1; AMCVS_969430F0543F253D0A4C98C6@AdobeOrg=1; websdk_swiper_flags=first_sc_hit,wait_for_sc; s_cc=true; ius_session=B96338CEEE0F429E86E0178A276C2D71; s_sq=[[B]]; mint.ticket=V1-110-X0werik6qmbdy6jm3q8cp8; mint.tkt=V1-110-X0werik6qmbdy6jm3q8cp8; mint.authid=1236623825; mint.gauthid=1236623825; mint.agentid=1236623825; mint.parentid=50000003; login.offering=Mint; qbn.ticket=V1-110-X0werik6qmbdy6jm3q8cp8; qbn.tkt=V1-110-X0werik6qmbdy6jm3q8cp8; qbn.authid=1236623825; qbn.gauthid=1236623825; qbn.agentid=1236623825; qbn.uidp=16b8d2fee92904fcf80741c23cb286db8; qbn.parentid=50000003; qbn.account_chooser=7YebYZ1EazmRVVJcPL15GD8i-XeGXW4_p6M1mUtiwky5Skhd14JpCTYSkylvsGpBvUt1NLQLOfo086Z5HFOZysC9toH5TvEHO76nOJ8nK1uKSw5x06Z-veZQPzHFPPl6phFCJScotdN16myWGsWktLUuXcuQI4QgfDsSzH0yURMbmqtnnCeuRP9gvQSh3lybDycT9JAkLhZ-HIpe1McvsoOQOzcEzOYpS_HIrMNWTGyFoSNxm3-ihRAKXpdsdde51YwvtVb4GWvuReGsEJ07Ufi2QtqD_xhIPk_YGZOVubUR4r5HhHk1hDaYdg8AE12D9n-HHDSDOl9-CjQ0ttYy4OzwfPM6ZJ1bZTpWC53i9-Gv42fUU6hVbKYItmYzu2FMV_qK9AaKcwcvEr3GUJJazkmoE_7xKKymz18m__nqYVrbXobfnX5QjJevmyKG2m_n5yNMPkt9rWCmBh920Tx_wQ; userIdentifier=1236623825; ADRUM=s=1615080911179&r=https://accounts.intuit.com/index.html?-1697223410; AMCV_969430F0543F253D0A4C98C6@AdobeOrg=-637568504|MCIDTS|18694|MCMID|42527477667680677663131521192981840264|MCAAMLH-1615685711|7|MCAAMB-1615685711|RKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y|MCOPTOUT-1615088111s|NONE|MCAID|NONE|vVersion|5.1.1; mintPN=1; _exp_mintPN=1; MINTJSESSIONID=B0C9E2A1310D367E778955E1E66BA665; mintUserName=””; ROUTEID=.8LSIB6NLQ01; pseudonymID=16b8d2fee92904fcf80741c23cb286db8; utag_main=v_id:0177840193f4001adfa366f08b5d03073001806b00bd0$_sn:16$_se:4$_ss:0$_st:1615082716446$vapi_domain:intuit.com$ses_id:1615080899549;exp-session$_pn:3;exp-session; CONSENTMGR=dns:false|consent:true|ts:1615080916447; _transactionIframeLocation=undefined’ -H ‘Connection: close’ –data ‘cashTxnType=on&mtCheckNo=&tag1379779=0&tag965157=0&tag965123=0&task=txnadd&txnId=%3A0&mtType=cash&mtAccount=3960762&symbol=¬e=&isInvestment=false&catId=7&category=Food%20%26%20Dining&merchant=LITTLE%20SHEEP%20MONGOLIAN&date=7/22/2010&amount=-58.29&mtIsExpense=true&mtCashSplitPref=1&mtCashSplit=on&token=68251220IDEMEw7UWtwQhBZB8h0OFGW0MFp4xj5unQZtJPg’
CURL Response: 255
Replace the quotes from ” to ‘ seems to be an operating system difference.
Hello Nathaniel,
I’m getting this error when I try to run your code and not sure what’s going on. The numbers that are not recognized are from the cookie. Any help?
(venv) PS C:\Users\Mohammed\Desktop> python import.py
C:\Users\Mohammed\Desktop\import.py:88: DeprecationWarning: ‘U’ mode is deprecated
csv_object = csv.reader(open(csv_name,’rU’))
‘42527477667680677663131521192981840264’ is not recognized as an internal or external command,
operable program or batch file.
Transaction Date: 7/22/2010
Merchant NORTH%20PARK%20PRODUCE
Category ID: 1
Category Name: Entertainment
Amount: -1.04
Expense: true
CURL Request: curl -i -s -k -X POST ‘https://mint.intuit.com/updateTransaction.xevent’ -H ‘Host: mint.intuit.com’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36’ -H ‘Accept: */*’ -H ‘Accept-Language: en-US,en;q=0.5’ –compressed -H ‘X-Requested-With: XMLHttpRequest’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ -H ‘Referer: https://mint.intuit.com/transaction.event?accountId=https://mint.intuit.com/transaction.event‘ -H ‘Cookie: ivid=4205e908-cd28-4bf6-8dce-75700e067529; _gcl_au=1.1.404251089.1607277876; s_ecid=MCMID|42527477667680677663131521192981840264; aam_uuid=42721064086277510113114305412852936029; ivid_b=b27ea5ad-8907-459b-9dde-fb0021271bfd; did=SHOPPER2_dc35634359c0bd263c786adbfba6f738bafbcfae550e1978bd1dca0f9e4382f409277ccb583e50f2000b4314a97fbd25; s_fid=7F12202BE92FA4C1-0532FAED98542588; s_vi=[CS]v1|2FE6808E0515C2F4-6000084AA5CF1BEC[CE]; currentClientType=Mint; brandingOption=whitelabel; current-config-source=Back-end; mu=1; userguid=7F2284557A8C3D8B; wa_login=1; ivid_p=4205e908-cd28-4bf6-8dce-75700e067529; _fbp=fb.1.1610341990594.1960179897; aam_newdil=42721064086277510113114305412852936029; tt-d1a=1; refundMonitorState=true; ccpa=1|1; optimizelyEndUserId=oeu1611004471033r0.8010930886257095; BVBRANDID=03003985-0444-4fb0-bfbe-b1a249ea4482; cjConsent=MXxOfDB8WXww; cjevent_dc=b7fa8bca5c5311eb808e00320a1c0e14; cjevent_sc=b7fa8bca5c5311eb808e00320a1c0e14; aam_mcid=42527477667680677663131521192981840264; aam_uuid=42721064086277510113114305412852936029; utag_mint_mktid=fbp:fb.1.1610341990594.1960179897$s_ecid:MCMID|42527477667680677663131521192981840264; tms=14192:7:37331|14256:1:37476|14913:3:39205|14883:2:39126|14261:6:37488|14295:7:37587|14281:5:37544|14794:4:38906; aam_qbus=mesg1=16601754:16602502:16602973:17547791:17547551:17726372; qbn.glogin=mohammedawa; ensmktids={“ecid”:”|9″,”s_ecid”:”MCMID|42527477667680677663131521192981840264″,”fbp”:”fb.1.1610341990594.1960179897″,”dcm_id”:”0″}; tms_mint=14277:7:37522; cid=all_bancfi_aff_3468347121; tt_cid=all_bancfi_aff_3468347121; aam_aud=mesg1=20607648:20607655:20607660:20608396:20643848:20643895:20643896:20666892:20862765:20862768:21304497; _uetvid=72f332a053cb11ebbfcc6f28cc0c3c7a; tt_ipgeo=1261144642|US|***|Y|37.751|-97.822|0|null|null; mint.glogin=mohammedawa; ajs_user_id=”16b8d2fee92904fcf80741c23cb286db8″; ajs_anonymous_id=”4205e908-cd28-4bf6-8dce-75700e067529″; visitCount=106|1615780369051; priorityCode=3468337910; BVBRANDSID=f6dc0550-45c2-4be0-898f-37e5f27ec1e3; AMCVS_969430F0543F253D0A4C98C6@AdobeOrg=1; websdk_swiper_flags=first_sc_hit,wait_for_sc; s_cc=true; ius_session=6382D4D979CB4842A72C9A192165474E; s_sq=[[B]]; mint.ticket=V1-39-X04z781gjsxtb8jaxozmz6; mint.tkt=V1-39-X04z781gjsxtb8jaxozmz6; mint.authid=1236623825; mint.gauthid=1236623825; mint.agentid=1236623825; mint.parentid=50000003; login.offering=Mint; qbn.ticket=V1-39-X04z781gjsxtb8jaxozmz6; qbn.tkt=V1-39-X04z781gjsxtb8jaxozmz6; qbn.authid=1236623825; qbn.gauthid=1236623825; qbn.agentid=1236623825; qbn.uidp=16b8d2fee92904fcf80741c23cb286db8; qbn.parentid=50000003; qbn.account_chooser=7pyot6OzMV-tf5wyj5m3dOkcQLieM_QDWXsTkhV9586u61CdtnWczmuNoCCT1OxT1U8QELUocWv5cPgn7nMbHDpmEKmyUG9hwrCcHRyVuT_xrIpnD1wQaFyu55qQt4nRFgrp0WgTbiwcZ_ZmTzsnV1OnBS5RQJGBTCeAXKLlad1tWqnObJPbsljhMPT3XDxntiqcB1TDAsxKjTKNkQIQu-nVX-uvrWvmRyh1PxUGkrluo7OSNu8ijCocKgRGfshkeHZm29i2XEHK7KW2hWV6bfFAgaUk8NiGeXYXAxuhK94NydlaUwdB7etp_FaVZVcWXexAaV8uRfxSmyNpAadYaOt2XSRiN7SukYA04OYiM28k7lzguP-Jfcsngc7VPweWnEw0JgPuAiO1KEx6dDKSnIthCuyvoTsaEUlvNxJz5XzEjJLk3RrkdP-GseZOV13blNtNb5iNqUa-qjhsUEi44ScdMF3L2xADSqyUN1EacMk; userIdentifier=1236623825; ADRUM=s=1615780372726&r=https://accounts.intuit.com/index.html?-1697223410; AMCV_969430F0543F253D0A4C98C6@AdobeOrg=-637568504|MCIDTS|18701|MCMID|42527477667680677663131521192981840264|MCAAMLH-1616385173|7|MCAAMB-1616385173|RKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y|MCOPTOUT-1615787573s|NONE|MCAID|NONE|vVersion|5.1.1; mintPN=1; _exp_mintPN=1; MINTJSESSIONID=A3BB3865255652B06090CD50E13CCD14-n1; mintUserName=””; ROUTEID=.10TZYFBOP401; pseudonymID=16b8d2fee92904fcf80741c23cb286db8; utag_main=v_id:0177840193f4001adfa366f08b5d03073001806b00bd0$_sn:27$_se:4$_ss:0$_st:1615782177916$vapi_domain:intuit.com$ses_id:1615780368516;exp-session$_pn:3;exp-session; CONSENTMGR=dns:false|consent:true|ts:1615780377917; _transactionIframeLocation=undefined’ -H ‘Connection: close’ –data ‘cashTxnType=on&mtCheckNo=&tag1386793=0&tag965123=0&tag1379779=0&task=txnadd&txnId=%3A0&mtType=cash&mtAccount=3960762&symbol=¬e=&isInvestment=false&catId=1&category=Entertainment&merchant=NORTH%20PARK%20PRODUCE&date=7/22/2010&amount=-1.04&mtIsExpense=true&mtCashSplitPref=1&mtCashSplit=on&token=68251220IDIjX7kNA5iHEwK7hhJ2zFxHb07BurjA0frtq2g’
CURL Response: 255
I’d really love and appreciate some help with this if at all possible. I posted a comment a week or two ago and it doesn’t look like it even got approved to show publicly. I ran into the same CURL Response: 255 everyone else did – so on advice from above I have installed a virtual machine with Ubuntu and I’m attempting it in Linux. Now I get CURL Response: 32512. The first thing it says when I attempt to run import.py is “sh: 1: curl: not found”
Any ideas? Thanks so much!
you will need libcurl for a curl not found issue
the ‘not recognized as internal or external command’ issue seems to be because windows does not like ‘ (single quote) characters. No idea why.
When substituted for \” (backslash double-quote): we are happier.
After that, windows does not complains about not finding a path to curl. Sigh.
I guess the best option is to skip windows and just use linux.
Just wanted to say thanks for the post. I’m a developer by trade, and wanted to let you know I was able to get it working with minimal fuss. Saved a whole lot of data entry for me.
I was able to work around the 255 curl response error by enclosing all the curl strings in double-quotes instead of single quotes. However, now I only ever get the response:
1
Session has expired.I tried updating the cookie and token fields several times, based on what I see in devTools in Chrome, but I can’t get past this error. Any help is much appreciated!
Thanks so much, Nathaniel! This was just what I needed to get a couple hundred old US Bank transactions into Mint.
I actually never got the curl to work (curl response 0), but with a few tweaks to import.py, I got it using requests instead of curl. Here’s the basics of my POST request:
———
# Build POST Request
url = ‘https://mint.intuit.com/updateTransaction.xevent’
headers = {
‘method’: ‘POST’,
‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36’,
‘Accept’ : ‘*/*’,
‘origin’: ‘https://mint.intuit.com’,
‘accept-language’: ‘en-US,en;q=0.9’,
‘content-type’: ‘application/x-www-form-urlencoded; charset=UTF-8’,
‘x-requested-with’: ‘XMLHttpRequest’,
‘referer’: referrer,
‘cookie’: cookie
}
# Format the form data
payload = {
‘cashTxnType’: ‘on’,
‘task’: ‘txnadd’,
‘mtCheckNo’: ”,
‘task’: ‘txnadd’,
‘txnId’: ‘:0’,
‘mtType’: ‘cash’,
‘mtAccount’: account,
‘symbol’: ”,
‘note’: note,
‘tag2938236’: ‘2’, # this marks transaction with my own ‘CSV import’ tag
‘isInvestment’: ‘false’,
‘catId’: catID,
‘category’: category,
‘merchant’: merchant,
‘date’: dateoutput,
‘amount’: amount,
‘mtIsExpense’: expense,
‘mtCashSplitPref’: 2,
‘token’: token
}
# Submit POST Request
send_request = requests.post(url, headers=headers, data=payload)
I got the same error just now. Log out and log back into mint to refresh your token & cookie and then paste the new strings. Should be good to go.
I can’t get this to work for the life of me. I keep getting this error when running the py import.py function. “SyntaxError: invalid decimal literal” I’ve copied and pasted the COOKIE just as instructed to the import.py file, and it seems longer than 2000 characters, so maybe I’m doing something wrong. Any help would be greatly appreciated.
Can some one do a youtube for me? I’m so lost!
ME TOO!
Given a few people have asked for help that I believe are probably more advanced than I am, I might be hopeless.
I do not know Python (or programming), but did download and install it for this solution. I’m immediately lost in the GitHub Readme. I’d be very grateful if anyone would walk me through making this work like they would a small child before programming skills.
I have a couple thousand transactions that I need to add…this would be HUGE!
Is there a way to import notes and tags too?
yes and no, not built in but it is possible to extend the code to send this information as well. Anything that is in the form can be added to the script