Are you receiving SNAP/EBT benefits? The Expensify.org/SNAP-VAX campaign is live and accepting new members. Learn more about receiving $50 for submitting a SNAP receipt and $50 for getting your COVID-19 vaccine here and join today!

Is there an API to download the receipt?

agur
agur Expensify Customer Posts: 1

i see there's an API to download the reports of my expenses. although i need to download the receipt it self. can't find any API for that.

Answers

  • Ted Harris
    Ted Harris Expensify Success Coach - Admin Posts: 352 Expensify Team

    Hi there @agur - there's no specific API to download just the receipts, but if you're a dab-hand with Postman or cURL, I think it's probably enough to use the Expensify API to export a list of the direct receipt URL's and then build something yourself to capture them.

    We don't think there should be necessity for this, as these images will always be stored in Expensify as long as you're using us and you can always provide a link back to them (that's what the URL's are for right!).

  • esgolding
    esgolding Expensify Customer Posts: 1 Expensify Newcomer

    Let's face it, there are a thousand valid reasons for downloading your receipts. Things happen; maybe you have to hand the receipts off to a third-party auditor if yours is a publicly-traded company; my company just has a policy that just requires me to have all the receipts stored on our company servers, period.

    Here is a Windows Powershell script that will automate the download for your receipts. Your company's policies may (and probably should!) prohibit running scripts that you "got off the internet" because they could do bad things like format your hard drive or install ransomware instead of downloading receipts... So, if you are not conversant in Powershell and browser cookies, you probably shouldn't use this script, as you need to be able to know what the script is doing before you run it -- without taking my word for it.😁 If you aren't conversant in Powershell, please consult your IT department before trying this.

    That said, here are instructions:

    1. Start by downloading the script, and renaming to have a .PS1 extension instead of .TXT.
    2. Export a list of all the reports with receipt data you want, using the "All data - expense level export" format. Save that file to your computer. Make sure the file is in a .CSV format (excel format won't work; file->save as to convert it to CSV if you need to).
    3. Dig into your web browser's cookies and grab the "authToken" cookie for "www.expensify.com". Take the value of that cookie (a LOOOONG hexadecimal string), and paste it into this script in place of the big long string of X's at the top of the script. Also in the script, set the path for your .csv file, and a path where you want all the receipts to be downloaded to.
    4. Save and run this code in powershell.

    Voila, your receipts will start appearing on your drive; it'll take a second or two per receipt on average. The script will tell you when it is complete.


  • 86turismo
    86turismo Expensify Customer Posts: 1
    edited April 6

    @esgolding

    Your solution worked great for me. I had over 1600 receipts to download and organize. Your PowerShell script downloaded each receipt in approximately 2 seconds. I hope others stumble onto your solution and it works for them as well.

    Thank you so much for sharing your PowerShell script!!! I don't know what I would have done without it. Perhaps Expensify will promote your solution to their solution list, so others can benefit from it.

    Thanks again for sharing with the community!! 🤗