# Create Report — Expensify

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

- Key: `expensify-create-report`
- Type: Action (Write)
- Version: 0.0.5
- App: Expensify (`expensify`) — https://pipedream.com/apps/expensify.md
- This page (HTML): https://pipedream.com/apps/expensify/actions/create-report
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/expensify/actions/create-report/create-report.ts

## Description

Creates a new report with transactions in a user's account. [See docs here](https://integrations.expensify.com/Integration-Server/doc/#report-creator)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `employeeEmail` | `string` | Yes | The report will be created in this account. |
| `policyId` | `string` | No | The ID of the policy. Run List Policies first to obtain valid IDs. |
| `reportTitle` | `string` | Yes | The title of the report that will be created. |
| `expenses` | `string[]` | Yes | The report's expense line items, as an array of strings where each array element is a JSON string describing one expense (do NOT pass raw JSON objects — each item must be a JSON-encoded string). Each expense has these required fields: date: the expense date (format yyyy-mm-dd) currency: three-letter currency code (e.g. "USD", "EUR", "CAD") merchant: the merchant name amount: the amount in integer cents (e.g. 2500 = $25.00) Example (array of two JSON strings): [ "{\"date\":\"2024-01-15\",\"currency\":\"USD\",\"merchant\":\"Hotel ABC\",\"amount\":15000}", "{\"date\":\"2024-01-16\",\"currency\":\"USD\",\"merchant\":\"Restaurant XYZ\",\"amount\":5000}" ] |
| `reportFields` | `object` | No | Custom fields for the report as a JSON object. Use this to set values for custom report fields in your Expensify policy. Key format: Field names should have all non-alphanumerical characters replaced with underscores (_) Value format: String values for the corresponding field Example: { "reason_of_trip": "Business meetings with clients", "employees": "3", "department": "Sales", "project_code": "PROJ_2024_001" } |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "expensify",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "expensify-create-report",
  arguments: {
    employeeEmail: "Employee Email",
    policyId: "Policy ID",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "expensify-create-report",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    expensify: { authProvisionId: "apn_xxxxxxx" },
    employeeEmail: "Employee Email",
    policyId: "Policy ID",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "expensify-create-report",
    "configured_props": {
      "expensify": { "authProvisionId": "apn_xxxxxxx" },
      "employeeEmail": "Employee Email",
      "policyId": "Policy ID"
    }
  }'
```

---

- App: https://pipedream.com/apps/expensify.md · All apps: https://pipedream.com/apps
