← Expensify

Export Report with Expensify API

Pipedream makes it easy to connect APIs for Expensify and 2,800+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
Export Report with the Expensify API
No credit card required
Intro to Pipedream
Watch us build a workflow
Watch us build a workflow
8 min
Watch now ➜

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo

Developers Pipedream

Getting Started

Create a workflow to Export Report with the Expensify API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the Export Report action
    1. Connect your Expensify account
    2. Optional- Configure Report IDs
    3. Optional- Configure Start Date
    4. Optional- Configure End Date
    5. Optional- Configure Approved After
    6. Select a File Extension
    7. Optional- Configure Marked as Exported Label (Filter)
    8. Optional- Select one or more Report States
    9. Optional- Configure Employee Email
    10. Optional- Select one or more Policy IDs
    11. Optional- Configure File Base Name
    12. Optional- Configure Include Full Page Receipts PDF
    13. Optional- Configure Email Recipients
    14. Optional- Configure Mark as Exported
    15. Optional- Configure Template Path
    16. Optional- Configure Limit
    17. Optional- Configure Test Mode
    18. Configure syncDir
  2. Select a trigger to run your workflow on HTTP requests, schedules or app events
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Integrations

Export Report with Expensify API on New Requests (Payload Only) from HTTP / Webhook API
HTTP / Webhook + Expensify
 
Try it
Export Report with Expensify API on New Submission from Typeform API
Typeform + Expensify
 
Try it
Export Report with Expensify API on New Submission (Instant) from Jotform API
Jotform + Expensify
 
Try it
Export Report with Expensify API on New Scheduled Tasks from Pipedream API
Pipedream + Expensify
 
Try it
Export Report with Expensify API on New Download Counts from npm API
npm + Expensify
 
Try it

Details

This is a pre-built, source-available component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Export Report on Expensify
Description:Export Expensify reports to a file (csv, xls, xlsx, txt, pdf, json, xml). [See the documentation](https://integrations.expensify.com/Integration-Server/doc/#report-exporter)
Version:0.0.1
Key:expensify-export-report

Code

import { defineAction } from "@pipedream/types";
import expensify from "../../app/expensify.app.mjs";
import fs from "fs";
import { axios, ConfigurationError, } from "@pipedream/platform";
import qs from "qs";
export default defineAction({
    key: "expensify-export-report",
    name: "Export Report",
    description: "Export Expensify reports to a file (csv, xls, xlsx, txt, pdf, json, xml). [See the documentation](https://integrations.expensify.com/Integration-Server/doc/#report-exporter)",
    version: "0.0.1",
    type: "action",
    props: {
        expensify,
        reportIds: {
            type: "string[]",
            label: "Report IDs",
            description: "The IDs of the reports to be exported. Required if `startDate` or `approvedAfter` are not specified.",
            optional: true,
        },
        startDate: {
            type: "string",
            label: "Start Date",
            description: "The start date of the report. Format: YYYY-MM-DD. Required if `reportIds` or `approvedAfter ` are not specified.",
            optional: true,
        },
        endDate: {
            type: "string",
            label: "End Date",
            description: "The end date of the report. Format: YYYY-MM-DD. Conditionally required, if either `startDate` or `approvedAfter` is more than one year ago.",
            optional: true,
        },
        approvedAfter: {
            type: "string",
            label: "Approved After",
            description: "Filters out all reports approved before the given date, whichever occurred last (inclusive). Required if `reportIds` or `startDate` are not specified",
            optional: true,
        },
        fileExtension: {
            type: "string",
            label: "File Extension",
            description: "Specifies the format of the generated report",
            options: [
                "csv",
                "xls",
                "xlsx",
                "txt",
                "pdf",
                "json",
                "xml",
            ],
        },
        markedAsExported: {
            type: "string",
            label: "Marked as Exported Label (Filter)",
            description: "Filters out reports that have already been exported with that label",
            optional: true,
        },
        reportStates: {
            type: "string[]",
            label: "Report States",
            description: "Only the reports matching the specified status(es) will be exported",
            options: [
                "OPEN",
                "SUBMITTED",
                "APPROVED",
                "REIMBURSED",
                "ARCHIVED",
            ],
            optional: true,
        },
        employeeEmail: {
            type: "string",
            label: "Employee Email",
            description: "Export reports for the specified employee email",
            optional: true,
        },
        policyIds: {
            propDefinition: [
                expensify,
                "policyExportIds",
            ],
        },
        fileBaseName: {
            type: "string",
            label: "File Base Name",
            description: "The base name of the file to be exported",
            optional: true,
        },
        includeFullPageReceiptsPdf: {
            type: "boolean",
            label: "Include Full Page Receipts PDF",
            description: "Specifies whether generated PDFs should include full page receipts. This parameter is used only if fileExtension contains pdf.",
            optional: true,
        },
        emailRecipients: {
            type: "string[]",
            label: "Email Recipients",
            description: "People to email at the end of the export",
            optional: true,
        },
        markAsExported: {
            type: "string",
            label: "Mark as Exported",
            description: "Mark the reports as exported with the given label",
            optional: true,
        },
        templatePath: {
            type: "string",
            label: "Template Path",
            description: "The path in the /tmp directory to the template to use for the export. Required if `fileExtension` is `csv`, `txt`, `json`, or `xml`.",
            optional: true,
        },
        limit: {
            type: "string",
            label: "Limit",
            description: "Maximum number of reports to export",
            optional: true,
        },
        test: {
            type: "boolean",
            label: "Test Mode",
            description: "If set to true, actions defined in `onFinish` (i.e. email, markAsExported) will not be executed",
            optional: true,
        },
        syncDir: {
            type: "dir",
            accessMode: "write",
            sync: true,
        },
    },
    async run({ $ }) {
        if (!this.reportIds && !this.startDate && !this.approvedAfter) {
            throw new ConfigurationError("At least one of `reportIds`, `startDate`, or `approvedAfter` must be specified");
        }
        if ([
            "csv",
            "txt",
            "json",
            "xml",
        ].includes(this.fileExtension) && !this.templatePath) {
            throw new ConfigurationError(`Template path is required for file extension: ${this.fileExtension}`);
        }
        const onFinish = [];
        if (this.emailRecipients) {
            onFinish.push({
                actionName: "email",
                recipients: this.emailRecipients.join(","),
            });
        }
        if (this.markAsExported) {
            onFinish.push({
                actionName: "markAsExported",
                label: this.markAsExported,
            });
        }
        const data = {
            type: "file",
            credentials: {
                partnerUserID: this.expensify._partnerUserId(),
                partnerUserSecret: this.expensify._partnerUserSecret(),
            },
            onReceive: {
                immediateResponse: [
                    "returnRandomFileName",
                ],
            },
            inputSettings: {
                type: "combinedReportData",
                filters: {
                    reportIDList: this.reportIds
                        ? this.reportIds.join(",")
                        : undefined,
                    startDate: this.startDate,
                    endDate: this.endDate,
                    approvedAfter: this.approvedAfter,
                    markedAsExported: this.markedAsExported,
                    policyIDList: this.policyIds
                        ? this.policyIds.join(",")
                        : undefined,
                },
                reportState: this.reportStates
                    ? this.reportStates.join(",")
                    : undefined,
                employeeEmail: this.employeeEmail,
                limit: this.limit,
            },
            outputSettings: {
                fileExtension: this.fileExtension,
                fileBasename: this.fileBaseName,
                includeFullPageReceiptsPdf: this.includeFullPageReceiptsPdf,
            },
            onFinish,
            test: this.test,
        };
        let fileName;
        const args = {
            method: "post",
            url: `${this.expensify._apiUrl()}`,
        };
        if (!this.templatePath) {
            fileName = await axios($, {
                ...args,
                data: qs.stringify({
                    requestJobDescription: JSON.stringify(data),
                    template: "default",
                }),
            });
        }
        else {
            fileName = await axios($, {
                ...args,
                data: qs.stringify({
                    requestJobDescription: JSON.stringify(data),
                    template: fs.readFileSync(this.templatePath.includes("tmp/")
                        ? this.templatePath
                        : `/tmp/${this.templatePath}`, "utf8"),
                }),
                headers: {
                    "Content-Type": "application/x-www-form-urlencoded",
                },
            });
        }
        const fileBuffer = await this.expensify.downloadFile({
            $,
            fileName,
        });
        const path = `/tmp/${fileName}`;
        await fs.writeFileSync(path, fileBuffer);
        if (fileBuffer) {
            $.export("$summary", `Successfully exported report in ${path}`);
        }
        return path;
    },
});

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
ExpensifyexpensifyappThis component uses the Expensify app.
Report IDsreportIdsstring[]

The IDs of the reports to be exported. Required if startDate or approvedAfter are not specified.

Start DatestartDatestring

The start date of the report. Format: YYYY-MM-DD. Required if reportIds or approvedAfter are not specified.

End DateendDatestring

The end date of the report. Format: YYYY-MM-DD. Conditionally required, if either startDate or approvedAfter is more than one year ago.

Approved AfterapprovedAfterstring

Filters out all reports approved before the given date, whichever occurred last (inclusive). Required if reportIds or startDate are not specified

File ExtensionfileExtensionstringSelect a value from the drop down menu:csvxlsxlsxtxtpdfjsonxml
Marked as Exported Label (Filter)markedAsExportedstring

Filters out reports that have already been exported with that label

Report StatesreportStatesstring[]Select a value from the drop down menu:OPENSUBMITTEDAPPROVEDREIMBURSEDARCHIVED
Employee EmailemployeeEmailstring

Export reports for the specified employee email

Policy IDspolicyIdsstring[]Select a value from the drop down menu.
File Base NamefileBaseNamestring

The base name of the file to be exported

Include Full Page Receipts PDFincludeFullPageReceiptsPdfboolean

Specifies whether generated PDFs should include full page receipts. This parameter is used only if fileExtension contains pdf.

Email RecipientsemailRecipientsstring[]

People to email at the end of the export

Mark as ExportedmarkAsExportedstring

Mark the reports as exported with the given label

Template PathtemplatePathstring

The path in the /tmp directory to the template to use for the export. Required if fileExtension is csv, txt, json, or xml.

Limitlimitstring

Maximum number of reports to export

Test Modetestboolean

If set to true, actions defined in onFinish (i.e. email, markAsExported) will not be executed

N/AsyncDirdirThis component uses dir to share files between component executions.

Authentication

Expensify uses API keys for authentication. When you connect your Expensify account, Pipedream securely stores the keys so you can easily authenticate to Expensify APIs in both code and no-code steps.

About Expensify

From unlimited receipt scanning and mileage tracking to next-day reimbursement, automate your preaccounting system with an easy to use expense tracking app.

More Ways to Use Expensify

Actions

Create Expense with the Expensify API

Creates a new expense. See docs here

 
Try it
Create Report with the Expensify API

Creates a new report with transactions in a user's account. See docs here

 
Try it
Export Report To PDF with the Expensify API

Export a report to PDF. See docs here

 
Try it

Explore Other Apps

1
-
24
of
2,800+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
Schedule
Schedule
Trigger workflows on an interval or cron schedule.
Pipedream Utils
Pipedream Utils
Utility functions to use within your Pipedream workflows
Notion
Notion
Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular models like ChatGPT, DALL-E, and Whisper.
Anthropic (Claude)
Anthropic (Claude)
AI research and products that put safety at the frontier. Introducing Claude, a next-generation AI assistant for your tasks, no matter the scale.
Google Sheets
Google Sheets
Use Google Sheets to create and edit online spreadsheets. Get insights together with secure sharing in real-time and from any device.
Telegram
Telegram
Telegram, is a cloud-based, cross-platform, encrypted instant messaging (IM) service.
Google Drive
Google Drive
Google Drive is a file storage and synchronization service which allows you to create and share your work online, and access your documents from anywhere.
Google Calendar
Google Calendar
With Google Calendar, you can quickly schedule meetings and events and get reminders about upcoming activities, so you always know what’s next.
Shopify
Shopify
Shopify is a complete commerce platform that lets anyone start, manage, and grow a business. You can use Shopify to build an online store, manage sales, market to customers, and accept payments in digital and physical locations.
Supabase
Supabase
Supabase is an open source Firebase alternative.
MySQL
MySQL
MySQL is an open-source relational database management system.
PostgreSQL
PostgreSQL
PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
Premium
AWS
AWS
Amazon Web Services (AWS) offers reliable, scalable, and inexpensive cloud computing services.
Premium
Twilio SendGrid
Twilio SendGrid
Send marketing and transactional email through the Twilio SendGrid platform with the Email API, proprietary mail transfer agent, and infrastructure for scalable delivery.
Amazon SES
Amazon SES
Amazon SES is a cloud-based email service provider that can integrate into any application for high volume email automation
Premium
Klaviyo
Klaviyo
Email Marketing and SMS Marketing Platform
Premium
Zendesk
Zendesk
Zendesk is award-winning customer service software trusted by 200K+ customers. Make customers happy via text, mobile, phone, email, live chat, social media.
Premium
ServiceNow
ServiceNow
The smarter way to workflow
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.
Microsoft Teams
Microsoft Teams
Microsoft Teams has communities, events, chats, channels, meetings, storage, tasks, and calendars in one place.