# List Invoices — Xero Accounting

> Lists information from invoices in the given tenant id as per filter parameters.

- Key: `xero_accounting_api-list-invoices`
- Type: Action (Read-only)
- Version: 0.3.2
- App: Xero Accounting (`xero_accounting_api`) — https://pipedream.com/apps/xero-accounting-api.md
- This page (HTML): https://pipedream.com/apps/xero-accounting-api/actions/list-invoices
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/xero_accounting_api/actions/list-invoices/list-invoices.mjs

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `tenantId` | `string` | Yes | Select an organization tenant to use, or provide a tenant ID Options are loaded from the connected account. |
| `modifiedAfter` | `string` | No | The ModifiedAfter filter is actually an HTTP header: 'If-Modified-Since'. A UTC timestamp (yyyy-mm-ddThh:mm:ss). Only invoices created or modified since this timestamp will be returned e.g. 2009-11-12T00:00:00 |
| `ids` | `string` | No | Filter by a comma-separated list of InvoicesIDs. See details. |
| `invoiceNumbers` | `string` | No | Filter by a comma-separated list of InvoiceNumbers. See details. |
| `contactIds` | `string[]` | No | Filter by an array of ContactIDs. See details. Options are loaded from the connected account. |
| `statuses` | `string` | No | Filter by a comma-separated list of Statuses. See details. |
| `where` | `string` | No | Filter using the where parameter. We recommend you limit filtering to the optimised elements only. |
| `createdByMyApp` | `boolean` | No | When set to true you'll only retrieve Invoices created by your app. |
| `order` | `string` | No | Order by any element returned ( see Order By ). |
| `page` | `string` | No | Up to 100 invoices will be returned per call, with line items shown for each, when the page parameter is used e.g. page=1 |

## 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": "xero_accounting_api",
      },
    },
  },
)

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: "xero_accounting_api-list-invoices",
  arguments: {
    tenantId: "Tenant ID",
    modifiedAfter: "Modified After",
  },
})
```

**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: "xero_accounting_api-list-invoices",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    xero_accounting_api: { authProvisionId: "apn_xxxxxxx" },
    tenantId: "Tenant ID",
    modifiedAfter: "Modified After",
  },
})

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": "xero_accounting_api-list-invoices",
    "configured_props": {
      "xero_accounting_api": { "authProvisionId": "apn_xxxxxxx" },
      "tenantId": "Tenant ID",
      "modifiedAfter": "Modified After"
    }
  }'
```

---

- App: https://pipedream.com/apps/xero-accounting-api.md · All apps: https://pipedream.com/apps
