Xero: adds a fixed asset
Xero assets.createAsset: arguments, response, policy and SDK examples.
← Assets operations · Get started
Operation xero.assets_createasset
Provider route: POST /assets.xro/1.0/Assets. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”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["assets"]["createAsset"]>[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.assets.createAsset(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom 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.assets.create_asset(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
headers | object | Required within parent | Additional keys: not allowed |
headers.xero-tenant-id | string | Required within parent | |
headers.Idempotency-Key | string | Optional | |
body | Model | Required within parent | Expand adds a fixed asset — request body — body |
Referenced models: adds a fixed asset — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand adds a fixed asset — response body |
Referenced models: adds a fixed asset — response body
Schemas
Section titled “Schemas”1 more schema is linked from the tables above, on the schema pages.
adds a fixed asset — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
accountingBookValue | number | Optional | The accounting value of the asset Format: double |
assetId | string | Optional | The Xero-generated Id for the asset Format: uuid |
assetName | string | Required within parent | The name of the asset |
assetNumber | string | Optional | Must be unique. |
assetStatus | string | Optional | See Asset Status Codes. One of: Draft, Registered, Disposed |
assetTypeId | string | Optional | The Xero-generated Id for the asset type Format: uuid |
bookDepreciationDetail | Model | Optional | Expand adds a fixed asset — request body — body book Depreciation Detail |
bookDepreciationSetting | Model | Optional | Expand adds a fixed asset — request body — body book Depreciation Setting |
canRollback | boolean | Optional | Boolean to indicate whether depreciation can be rolled back for this asset individually. This is true if it doesn't have 'legacy' journal entries and if there is no lock period that would prevent this asset from rolling back. |
disposalDate | string | Optional | The date the asset was disposed Format: date |
disposalPrice | number | Optional | The price the asset was disposed at Format: double |
isDeleteEnabledForDate | boolean | Optional | Boolean to indicate whether delete is enabled |
purchaseDate | string | Optional | The date the asset was purchased YYYY-MM-DD Format: date |
purchasePrice | number | Optional | The purchase price of the asset Format: double |
serialNumber | string | Optional | The asset's serial number |
warrantyExpiryDate | string | Optional | The date the asset’s warranty expires (if needed) YYYY-MM-DD |
Referenced models: adds a fixed asset — request body — body book Depreciation Detail, adds a fixed asset — request body — body book Depreciation Setting
adds a fixed asset — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
accountingBookValue | JSON | Optional | |
accountingBookValue (anyOf 1) | number | Alternative | The accounting value of the asset Format: double |
accountingBookValue (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
assetId | string | Optional | The Xero-generated Id for the asset Format: uuid |
assetName | string | Required within parent | The name of the asset |
assetNumber | string | Optional | Must be unique. |
assetStatus | string | Optional | See Asset Status Codes. Known values: Draft, Registered, Disposed |
assetTypeId | string | Optional | The Xero-generated Id for the asset type Format: uuid |
bookDepreciationDetail | Model | Optional | Expand adds a fixed asset — response body — book Depreciation Detail |
bookDepreciationSetting | Model | Optional | Expand adds a fixed asset — response body — book Depreciation Setting |
canRollback | boolean | Optional | Boolean to indicate whether depreciation can be rolled back for this asset individually. This is true if it doesn't have 'legacy' journal entries and if there is no lock period that would prevent this asset from rolling back. |
disposalDate | string | Optional | The date the asset was disposed Format: date |
disposalPrice | JSON | Optional | |
disposalPrice (anyOf 1) | number | Alternative | The price the asset was disposed at Format: double |
disposalPrice (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
isDeleteEnabledForDate | boolean | Optional | Boolean to indicate whether delete is enabled |
purchaseDate | string | Optional | The date the asset was purchased YYYY-MM-DD Format: date |
purchasePrice | JSON | Optional | |
purchasePrice (anyOf 1) | number | Alternative | The purchase price of the asset Format: double |
purchasePrice (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
serialNumber | string | Optional | The asset's serial number |
warrantyExpiryDate | string | Optional | The date the asset’s warranty expires (if needed) YYYY-MM-DD |
Referenced models: adds a fixed asset — response body — book Depreciation Detail, adds a fixed asset — response body — book Depreciation Setting
adds a fixed asset — request body — body book Depreciation Detail
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
businessUseCapitalGain | number | Optional | (New Zealand Orgs Only) The portion of capital gain realised from the disposal of a fixed asset that is attributable to its business use. Format: decimal |
businessUseCurrentGainLoss | number | Optional | (New Zealand Orgs Only) Represents the gain or loss from the disposal of the business use portion of a fixed asset. This value records the financial result (profit or loss) related specifically to the asset’s business use. Format: decimal |
costLimit | number | Optional | The value of the asset you want to depreciate, if this is less than the cost of the asset. Format: double |
currentAccumDepreciationAmount | number | Optional | All depreciation occurring in the current financial year. Format: double |
currentCapitalGain | number | Optional | When an asset is disposed, this will be the sell price minus the purchase price if a profit was made. Format: double |
currentGainLoss | number | Optional | When an asset is disposed, this will be the lowest one of sell price or purchase price, minus the current book value. Format: double |
depreciationStartDate | string | Optional | YYYY-MM-DD Format: date |
initialDeductionPercentage | number | Optional | (New Zealand Orgs Only) The Investment Boost deduction percentage. Format: decimal |
priorAccumDepreciationAmount | number | Optional | All depreciation prior to the current financial year. Format: double |
privateUseCapitalGain | number | Optional | (New Zealand Orgs Only) The portion of capital gain realised from the disposal of a fixed asset that is attributable to its private (non-business) use. Format: decimal |
privateUseCurrentGainLoss | number | Optional | (New Zealand Orgs Only) Represents the gain or loss from the disposal of the private use portion of a fixed asset. This value records the financial result (profit or loss) related specifically to the asset’s private use. Format: decimal |
residualValue | number | Optional | The value of the asset remaining when you've fully depreciated it. Format: double |
adds a fixed asset — request body — body book Depreciation Setting
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
averagingMethod | string | Optional | The method of averaging applied to this asset. See Averaging Methods One of: FullMonth, ActualDays |
bookEffectiveDateOfChangeId | string | Optional | Unique Xero identifier for the effective date change Format: uuid |
depreciableObjectId | string | Optional | Unique Xero identifier for the depreciable object Format: uuid |
depreciableObjectType | string | Optional | The type of asset object |
depreciationCalculationMethod | string | Optional | See Depreciation Calculation Methods One of: Rate, Life, None |
depreciationMethod | string | Optional | The method of depreciation applied to this asset. See Depreciation Methods One of: NoDepreciation, StraightLine, DiminishingValue100, DiminishingValue150, DiminishingValue200, FullDepreciation |
depreciationRate | number | Optional | The rate of depreciation (e.g. 0.05) Format: double |
effectiveLifeYears | integer | Optional | Effective life of the asset in years (e.g. 5) |
adds a fixed asset — response body — book Depreciation Setting
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
averagingMethod | string | Optional | The method of averaging applied to this asset. See Averaging Methods Known values: FullMonth, ActualDays |
bookEffectiveDateOfChangeId | string | Optional | Unique Xero identifier for the effective date change Format: uuid |
depreciableObjectId | string | Optional | Unique Xero identifier for the depreciable object Format: uuid |
depreciableObjectType | string | Optional | The type of asset object |
depreciationCalculationMethod | string | Optional | See Depreciation Calculation Methods Known values: Rate, Life, None |
depreciationMethod | string | Optional | The method of depreciation applied to this asset. See Depreciation Methods Known values: NoDepreciation, StraightLine, DiminishingValue100, DiminishingValue150, DiminishingValue200, FullDepreciation |
depreciationRate | JSON | Optional | |
depreciationRate (anyOf 1) | number | Alternative | The rate of depreciation (e.g. 0.05) Format: double |
depreciationRate (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
effectiveLifeYears | JSON | Optional | |
effectiveLifeYears (anyOf 1) | integer | Alternative | Effective life of the asset in years (e.g. 5) |
effectiveLifeYears (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.assets_createasset. Catalog operation: assets.createAsset. 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.