# Create Invoice — Chaser

> Creates a new invoice in Chaser. See the documentation

- Key: `chaser-create-invoice`
- Type: Action (Write)
- Version: 0.0.2
- App: Chaser (`chaser`) — https://pipedream.com/apps/chaser.md
- This page (HTML): https://pipedream.com/apps/chaser/actions/create-invoice
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/chaser/actions/create-invoice/create-invoice.mjs

## Description

Creates a new invoice in Chaser. [See the documentation](https://openapi.chaserhq.com/docs/static/index.html)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `invoiceId` | `string` | Yes | Invoice ID |
| `invoiceNumber` | `string` | Yes | Invoice Number |
| `customerExternalId` | `string` | Yes | Select a customer, or provide a customer external ID. Options are loaded from the connected account. |
| `status` | `string` | Yes | Invoice Status |
| `currencyCode` | `string` | Yes | A 3-letter currency code such as USD, EUR or GBP |
| `amountDue` | `string` | Yes | Amount Due (number) |
| `amountPaid` | `string` | Yes | Amount Paid (number) |
| `total` | `string` | Yes | Total (number) |
| `date` | `string` | Yes | Invoice date (date-time string such as 2024-04-23T11:00:00Z) |
| `dueDate` | `string` | Yes | Invoice due date (date-time string such as 2024-04-23T11:00:00Z) |
| `fullyPaidDate` | `string` | No | Invoice fully paid date (date-time string such as 2024-04-23T11:00:00Z) |

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

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: "chaser-create-invoice",
  arguments: {
    invoiceId: "Invoice ID",
    invoiceNumber: "Invoice Number",
  },
})
```

**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: "chaser-create-invoice",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    chaser: { authProvisionId: "apn_xxxxxxx" },
    invoiceId: "Invoice ID",
    invoiceNumber: "Invoice Number",
  },
})

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": "chaser-create-invoice",
    "configured_props": {
      "chaser": { "authProvisionId": "apn_xxxxxxx" },
      "invoiceId": "Invoice ID",
      "invoiceNumber": "Invoice Number"
    }
  }'
```

---

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