View as Markdown
Xero Accounting icon

Xero Accounting ACTION

Create Sales Invoice

Creates a new sales invoice. See the documentation
  • Action
  • Writes data
  • Destructive
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Xero Accounting account once, then configure and run Create Sales Invoice from your backend or agent.

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-xero-create-sales-invoice",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    xero_accounting_api: { authProvisionId: "apn_xxxxxxx" },
    tenantId: "Tenant ID",
    contactId: "Contact ID",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Create Sales Invoice inputs
Property Type Description
tenantId Tenant ID string
Select an organization tenant to use, or provide a tenant ID
Required Dynamic
contactId Contact ID string
ID of the contact associated to the invoice.
Optional Dynamic
contactName Contact Name string
Name of the contact associated to the invoice. If there is no contact matching this name, a new contact is created.
Optional
lineItems Line Items string[]

The LineItems collection can contain any number of individual LineItem sub-elements. At least one is required to create a complete Invoice. Refer to Tax Type, Refer to Line Items

Example: [{"Description":"Football", "Quantity":"20", "UnitAmount":"50000", "TaxType":"OUTPUT" }]

Required
date Date string
Date invoice was issued - YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation.
Optional
dueDate Due Date string
Date invoice is due - YYYY-MM-DD.
Optional
lineAmountType Line Amount Type string
Line amounts are exclusive of tax by default if you don't specify this element. See Line Amount Types
Optional
invoiceNumber Invoice Number string
Unique alpha numeric code identifying invoice (* when missing will auto-generate from your Organisation Invoice Settings*) (max length = 255)
Optional
reference Reference string
Additional reference number (max length = 255)
Optional
brandingThemeId Branding Theme ID string
Optional
url URL string
URL link to a source document - shown as "Go to [appName]" in the Xero app
Optional
currencyCode Currency Code string
The currency that invoice has been raised in (see Currencies)
Optional
currencyRate Currency Rate string
The currency rate for a multicurrency invoice. If no rate is specified, the XE.com day rate is used. (max length = [18].[6])
Optional
status Status string
Optional
sentToContact Sent To Contact string
Boolean to set whether the invoice in the Xero app should be marked as "sent". This can be set only on invoices that have been approved
Optional
expectedPaymentData Expected Payment Date string
Shown on the sales invoices when this has been set
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
xero_accounting_api-xero-create-sales-invoice
Version
0.3.6
App
Xero Accounting
Authentication
OAuth
Read-only
No
Destructive
Yes
Open world
Yes