Update: MasterCard has successfully resolved the issue with their commercial card systems. We're awaiting file deliveries now. For more information, please visit our status page.

Going to SuiteWorld in Las Vegas April 1-4? So are we! While you're there, you can stop by the Expensify booth in the Expo hall to chat about how the current features work, any questions you may have, or discuss what's next for this integration. We look forward to seeing you there!

Cannot export report

Hi there, I cannot seem to export a report using python3. I believe I have followed all the correct steps.

  • Note that and are fill ins.
  • I have tried calling the template as another .ftl file and storing the template as a string in the same script (below).
  • I am using the python requests module (is this possible?)
  • Do I need python to perform the curl on a command line?
  • I have used curl on the command line with the same template and it works fine
  • How do you insert the template call using python requests module
  • I have tried stringifying 'requestJobDescription={...}' --data-urlencode '[email protected]_template.ftl' as is shown in your API doc
  • I have tried using requests.post (which is the only one that should work) and requests.get (just for kicks)
    ** I get HTTP 404 whenever I run with post
    ** I get HTTP 400 whenever I run with get (b/c you can't use get)

Below is my simplified code (.py files cannot be attached). Any help getting this to work would be great.

import logging
import json
import requests
from urllib.parse import urlencode

EXPENSIFY_API_ENDPOINT = "https://integrations.expensify.com/Integration-Server/ExpensifyIntegration"

type = "file"

credentials = {
"partnerUserID": "",
"partnerUserSecret": ""

onReceive = {
"immediateResponse": ["returnRandomFileName"]

inputSettings = {
"type": "combinedReportData",
"filters": {
"reportIDList": "38179851"

outputSettings = {
"fileExtension": "csv"

template = """
<#if addHeader == true>
Employee,ID,Date,Merchant and Comment,Category,Department,Location,Currency,Amount<#lt>
<#assign reportNumber = 1>
<#assign expenseNumber = 1>
<#list reports as report>
<#list report.transactionList as expense>
<#-- Report level -->

    <#-- Expense level -->
    ${expense.merchant} - ${expense.comment},<#t>

    <#assign expenseNumber = expenseNumber + 1>
<#assign reportNumber = reportNumber + 1>


def create_request():
params = {
"requestJobDescription": json.dumps({
"type": type,
"credentials": credentials,
"onReceive": onReceive,
"inputSettings": inputSettings,
"outputSettings": outputSettings
"template": urlencode({"template": template})
# Have also tried -- "template": template

return params

def send_request(params):
response = requests.post(EXPENSIFY_API_ENDPOINT, data=params)
return response

def main():
params = create_request()
resp = send_request(params=params)



  • FrancoisFrancois Posts: 8 Expensify Success Coach

    Hi slai,

    The variable EXPENSIFY_API_ENDPOINT in your code is incorrect, the value should be https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations (you're missing the s at the end).

    Can you try with the updated endpoint URL please?
    If you're still having issues, you can try hosting your code snippet on gist.github.com or pastebin.com, which will make it easier to keep the correct format.


Sign In or Register to comment.