How to retrieve just expenses?

I see in the Documentation that there is "create" documented for expenses, but not "retrieve"/"get". Is there a way to do this?
I thought perhaps I could do this by doing the Export + Download of all the Reports, but now I see there is also no "retrieve"/"get" documentation for all report IDs, either.
Any way to get just expenses, regardless of whether they're in a report, based off some date/category/tag filters?
Best Answer
-
Hi @Sheena Trepanier , thank you for the in-depth response.
I think you're right on the money, on top of the comment I made in https://community.expensify.com/discussion/comment/12221#Comment_12221 , this is a implicit conceptual jump. Expenses only can be exported through the reports.
Then on top of the process I outlined here https://community.expensify.com/discussion/comment/12180 (using the same template), I can add the following to my inputSettings to filter for reports of any reportState, and I'm able to export all (reported) expenses, because I set my limit to the last 99999 reports that were created since 1971-01-01.
"inputSettings": { "type": "combinedReportData", "reportState": "OPEN,SUBMITTED,APPROVED,REIMBURSED,ARCHIVED", "limit": 99999, "filters": { "startDate": "1971-01-01" } }
The template then loops through each report's transaction list and prints all my (reported) expenses.
Thanks for @BlouBlou for getting me on the right track with https://community.expensify.com/discussion/2183/how-to-get-data
And the API guide has a filter reference under Report Exporter https://integrations.expensify.com/Integration-Server/doc/#report-exporter as the 2nd example.
Answers
-
Sheena Trepanier Expensify Team, Approved! Accountant, Expensify Student Ambassador Posts: 1,362 Expensify Team
@fpettinella, good question. Expenses in an account are not considered part of the company policy, or exportable by anyone other than the account owner, until the expense is placed on a report tied to the company policy.
Because of this, the API works to export expenses and reports based on the report ID the expense is on. I've got a few more team members who work with our API more often that haven't gotten back to me yet but if I learn anything else that would be helpful I'll let you know.
Just a heads up, export based on submitter, policy, or a range of filters is available to a spreadsheet format, but again this excludes unreported expenses that exist in another's account.
-
Sheena Trepanier Expensify Team, Approved! Accountant, Expensify Student Ambassador Posts: 1,362 Expensify Team
Thinking on it some more @fpettinella, the API documentation looks like it should be possible.
It makes sense to me, knowing how Expensify permissions work, that the account your using to export via the API would need to be a policy admin of each policy you were trying to export information from. This would give you the permissions necessary to export via spreadsheet format as well so it should be the same for the API.
Then, when we look at the the
Report Exported
section of the API documentation, it’s indicated that you can export expense or report data. That, in combination with the knowledge that you can code your own Freemarker export template, makes me think that you can use the API to export expenses without needing to use the report ID.I'll still work on confirming that for you though and get back to you as soon as I can.
-
Sheena Trepanier Expensify Team, Approved! Accountant, Expensify Student Ambassador Posts: 1,362 Expensify Team
Great to hear @fpettinella, thanks @BlouBlou for helping out as well 👏