Expensify / Code samples

Basics

Curl request examples

Given the job description used for the policy creator:

curl -X POST https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations \
    -d 'requestJobDescription={
        "type": "create",
        "credentials": {
            "partnerUserID": "...",
            "partnerUserSecret": "..."
        },
        "inputSettings": {
            "type": "policy",
            "policyName": "My New Policy"
        }
    }'

File attachments

When using the report exporter, it is advised to store your template in a separate file, and use curl’s parameter@filename feature to pass it to the request, as show below:

<#if addHeader == true>
    Report ID, Report name<#lt>
</#if>
<#list reports as report>
    ${report.reportID},${report.reportName}<#lt>
</#list>
curl -X POST https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations \
    -d 'requestJobDescription={
        "type":"file",
        "credentials":{
            "partnerUserID":"...",
            "partnerUserSecret":"...",
        },
        "onReceive":{
            "immediateResponse":["returnRandomFileName"]
        },
        "inputSettings":{
            "type":"combinedReportData",
            "filters":{
                "reportIDList":"123456789,234567890"
            }
        },
        "outputSettings":{
            "fileExtension":"csv"
        }
    }' \
    --data-urlencode template@template.txt

Troubleshooting

Add an Expect header to your request, with an empty value:

curl -X POST https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations \
    -H 'Expect: ' \
    -d 'requestJobDescription={...}'