Skip to content

Xero: Creates allocation for a specific credit note

Xero accounting.createCreditNoteAllocation: arguments, response, policy and SDK examples.

← Accounting operations · Get started

Operation xero.createcreditnoteallocation

Provider route: PUT /api.xro/2.0/CreditNotes/{CreditNoteID}/Allocations. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/xero with npm, or alter-sdk-xero with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { XeroIntegration } from "@alter-ai/xero";
async function execute(input: Parameters<XeroIntegration["accounting"]["createCreditNoteAllocation"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new XeroIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.accounting.createCreditNoteAllocation(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_xero import XeroIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = XeroIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.accounting.create_credit_note_allocation(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.CreditNoteIDstringRequired within parentFormat: uuid
queryobjectOptionalAdditional keys: not allowed
query.summarizeErrorsbooleanOptionalDefault: false
headersobjectRequired within parentAdditional keys: not allowed
headers.xero-tenant-idstringRequired within parent
headers.Idempotency-KeystringOptional
bodyModelRequired within parentExpand Creates allocation for a specific credit note — request body — body

Referenced models: Creates allocation for a specific credit note — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Creates allocation for a specific credit note — response body

Referenced models: Creates allocation for a specific credit note — response body

45 more schemas are linked from the tables above, on the schema pages.

Creates allocation for a specific credit note — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
AllocationsarrayOptional
Allocations[]ModelEach itemExpand Creates allocation for a specific credit note — request body — body Allocations item

Referenced models: Creates allocation for a specific credit note — request body — body Allocations item

Creates allocation for a specific credit note — response body
FieldTypePresenceDescription and constraints
$objectRoot
AllocationsarrayOptional
Allocations[]ModelEach itemExpand Deletes an Allocation from a Prepayment — response body

Referenced models: Deletes an Allocation from a Prepayment — response body

Creates allocation for a specific credit note — request body — body Allocations item
FieldTypePresenceDescription and constraints
$objectRoot
AllocationIDstringOptionalXero generated unique identifier
Format: uuid
AmountnumberRequired within parentthe amount being applied to the invoice
Format: double
CreditNoteModelOptionalExpand Creates a single payment for invoice or credit notes — request body — body Credit Note
DatestringRequired within parentthe date the allocation is applied YYYY-MM-DD.
InvoiceModelRequired within parentExpand Creates a single payment for invoice or credit notes — request body — body Invoice
IsDeletedbooleanOptionalA flag that returns true when the allocation is succesfully deleted
Read only: true
OverpaymentModelOptionalExpand Creates a single payment for invoice or credit notes — request body — body Overpayment
PrepaymentModelOptionalExpand Creates a single payment for invoice or credit notes — request body — body Prepayment
StatusAttributeStringstringOptionalA string to indicate if a invoice status
ValidationErrorsarrayOptionalDisplays array of validation error messages from the API
ValidationErrors[]ModelEach itemExpand Retrieves journals — response body — Warnings item

Referenced models: Creates a single payment for invoice or credit notes — request body — body Credit Note, Creates a single payment for invoice or credit notes — request body — body Invoice, Retrieves journals — response body — Warnings item, Creates a single payment for invoice or credit notes — request body — body Overpayment, Creates a single payment for invoice or credit notes — request body — body Prepayment

Deletes an Allocation from a Prepayment — response body
FieldTypePresenceDescription and constraints
$objectRoot
AllocationIDstringOptionalXero generated unique identifier
Format: uuid
AmountJSONRequired within parent
Amount (anyOf 1)numberAlternativethe amount being applied to the invoice
Format: double
Amount (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
CreditNoteModelOptionalExpand Deletes an Allocation from a Prepayment — response body — Credit Note
DatestringRequired within parentthe date the allocation is applied YYYY-MM-DD.
InvoiceModelRequired within parentExpand Deletes an Allocation from a Prepayment — response body — Invoice
IsDeletedbooleanOptionalA flag that returns true when the allocation is succesfully deleted
Read only: true
OverpaymentModelOptionalExpand Deletes an Allocation from a Prepayment — response body — Overpayment
PrepaymentModelOptionalExpand Deletes an Allocation from a Prepayment — response body — Prepayment
StatusAttributeStringstringOptionalA string to indicate if a invoice status
ValidationErrorsarrayOptionalDisplays array of validation error messages from the API
ValidationErrors[]ModelEach itemExpand Retrieves journals — response body — Warnings item

Referenced models: Deletes an Allocation from a Prepayment — response body — Credit Note, Deletes an Allocation from a Prepayment — response body — Invoice, Deletes an Allocation from a Prepayment — response body — Overpayment, Deletes an Allocation from a Prepayment — response body — Prepayment, Retrieves journals — response body — Warnings item

Retrieves journals — response body — Warnings item
FieldTypePresenceDescription and constraints
$objectRoot
MessagestringOptionalValidation error message
Creates a single payment for invoice or credit notes — request body — body Overpayment
FieldTypePresenceDescription and constraints
$objectRoot
AllocationsarrayOptionalSee Allocations
Allocations[]ModelEach itemExpand Creates allocation for a specific credit note — request body — body Allocations item
AppliedAmountnumberOptionalThe amount of applied to an invoice
Format: double
AttachmentsarrayOptionalSee Attachments
Attachments[]ModelEach itemExpand Creates a single payment for invoice or credit notes — request body — body Invoice Attachments item
ContactModelOptionalExpand Creates contacts to a specific contact group — request body — body Contacts item
CurrencyCodeModelOptionalExpand Create a new currency for a Xero organisation — request body — body Code
CurrencyRatenumberOptionalThe currency rate for a multicurrency overpayment. If no rate is specified, the XE.com day rate is used
Format: double
DatestringOptionalThe date the overpayment is created YYYY-MM-DD
HasAttachmentsbooleanOptionalboolean to indicate if a overpayment has an attachment
Default: false
Read only: true
LineAmountTypesstringOptionalLine amounts are exclusive of tax by default if you don’t specify this element. See Line Amount Types
One of: Exclusive, Inclusive, NoTax
LineItemsarrayOptionalSee Overpayment Line Items
LineItems[]ModelEach itemExpand Creates a single payment for invoice or credit notes — request body — body Invoice Line Items item
OverpaymentIDstringOptionalXero generated unique identifier
Format: uuid
PaymentsarrayOptionalSee Payments
Payments[]ModelEach itemExpand Creates a single payment for invoice or credit notes — request body — body
ReferencestringOptionalAn optional description for Overpayment
RemainingCreditnumberOptionalThe remaining credit balance on the overpayment
Format: double
StatusstringOptionalSee Overpayment Status Codes
One of: AUTHORISED, PAID, VOIDED
SubTotalnumberOptionalThe subtotal of the overpayment excluding taxes
Format: double
TotalnumberOptionalThe total of the overpayment (subtotal + total tax)
Format: double
TotalTaxnumberOptionalThe total tax on the overpayment
Format: double
TypestringOptionalSee Overpayment Types
One of: RECEIVE-OVERPAYMENT, SPEND-OVERPAYMENT, AROVERPAYMENT
UpdatedDateUTCstringOptionalUTC timestamp of last update to the overpayment
Read only: true
UpdatedDateUTCStringstringOptionalUTC ISO-8601 formatted timestamp of last update to the overpayment
Read only: true

Referenced models: Create a new currency for a Xero organisation — request body — body Code, Creates allocation for a specific credit note — request body — body Allocations item, Creates a single payment for invoice or credit notes — request body — body Invoice Attachments item, Creates contacts to a specific contact group — request body — body Contacts item, Creates a single payment for invoice or credit notes — request body — body Invoice Line Items item, Creates a single payment for invoice or credit notes — request body — body

Creates contacts to a specific contact group — request body — body Contacts item Balances Accounts Payable
FieldTypePresenceDescription and constraints
$objectRoot
OutstandingnumberOptionalFormat: double
OverduenumberOptionalFormat: double

SDK function policy ID: xero.createcreditnoteallocation. Catalog operation: createCreditNoteAllocation. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.