Xero Accounting ACTION
Create Purchase Bill
Creates a new purchase bill.
- Action
- Writes data
- OAuth
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's Xero Accounting account once, then configure and run Create Purchase Bill 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-purchase-bill",
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)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-xero-create-purchase-bill",
"configured_props": {
"xero_accounting_api": { "authProvisionId": "apn_xxxxxxx" },
"tenantId": "Tenant ID",
"contactId": "Contact ID"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{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-xero-create-purchase-bill",
arguments: {
tenantId: "Tenant ID",
contactId: "Contact ID",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| 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 | any | See LineItems. The LineItems collection can contain any number of individual LineItem sub-elements. At least * one * is required to create a complete Invoice. 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 |
purchaseBillNumber Purchase Bill Number | string | Non-unique alpha numeric code identifying purchase bill (printable ASCII characters only). This value will also display as Reference in the UI. Optional |
reference Reference | string | Additional reference number (max length = 255) Optional |
brandingThemeId Branding Theme ID | string | See BrandingThemes 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 |
plannedPaymentDate Planned Payment Date | string | Shown on purchase bills (Accounts Payable) 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-purchase-bill
- Version
- 0.1.4
- App
- Xero Accounting
- Authentication
- OAuth
- Read-only
- No
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗