diff --git a/docs/account-data/index.html b/docs/account-data/index.html new file mode 100644 index 00000000..b61670bb --- /dev/null +++ b/docs/account-data/index.html @@ -0,0 +1,4405 @@ + + + + + Xero Account Data API (Beta) + + + + + + xero-node AccountData SDK Docs + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+

Xero Account Data API (Beta)

+
+
+
+ +
+
+

AccountData

+
+
+
+

getAccountBalances

+

Get the balance of each general ledger account as at a given date

+
+
+
+

+

Retrieves account balances as at date, optionally including balances for one or +more prior comparison periods, and optionally filtered by account class, type, +account IDs, system account code, or tracking item.

+

Filtering

+
    +
  • Filter by class, type, accountIds, and/or systemAccountCodes. These can be +combined freely — when more than one is supplied, the server returns only accounts +that match all of the supplied filters (an intersection, not a union).
  • +
  • type values are matched case-sensitively, so use uppercase (for example BANK). Inventory +asset accounts are reported as, and can only be filtered by, INVENTORY; filtering by +their underlying account type does not match them.
  • +
  • trackingItemIds and unassignedToTrackingCategoryIds can be used independently of +the filters above to further narrow which accounts are returned.
  • +
+

Comparison periods

+
    +
  • Supplying comparisonPeriodCount together with comparisonPeriodSize returns +additional balances at prior points in time, in addition to the balance at date.
  • +
  • The n-th comparison date is date shifted back n times comparisonPeriodSize. For MONTH, +QUARTER, and YEAR sizes, a date that falls on the last day of its month keeps landing +on the last day of the shifted month (so comparisons across February behave correctly).
  • +
  • comparisonPeriodCount and comparisonPeriodSize must be supplied together.
  • +
+

Bank accounts

+

Bank account data is only available to users with bank account view permission for the +organisation.

+
    +
  • If the request would include bank accounts and the user lacks this permission, it is +rejected with 403 Forbidden. A request is treated as including bank accounts when it +has no account filters, filters by all five class values and nothing else, includes +BANK in type, or lists a bank account in accountIds.
  • +
  • For other requests (for example class=ASSET), bank accounts are silently excluded from +the response for users without this permission, instead of the request being rejected.
  • +
+

Results

+

Only accounts with a non-zero balance at a given date are returned; accounts and comparison +dates with a net-zero balance are omitted, so the response can be empty.

+

Pagination

+

This endpoint does not paginate — all matching account balances are returned in a single +response.

+

+

+
+
/account-balances
+

+

Usage and SDK Samples

+

+ +
+ +
+
await xero.setTokenSet(tokenSet);
+
+const accountingBasis = 'ACCRUAL';
+const date: Date = new Date("2024-12-31");
+const xeroTenantId = '2ae32d9e-4711-4201-9f2a-ac80e5318359';
+const comparisonPeriodCount = 3;
+const comparisonPeriodSize = 'MONTH';
+const accountIds = [];
+const class = [];
+const type = [];
+const systemAccountCodes = [];
+const trackingItemIds = [];
+const unassignedToTrackingCategoryIds = [];
+
+try {
+  const response = await xero.accountingApi.getAccountBalances(accountingBasis, date, xeroTenantId,  comparisonPeriodCount, comparisonPeriodSize, accountIds, class, type, systemAccountCodes, trackingItemIds, unassignedToTrackingCategoryIds);
+  console.log(response.body || response.response.statusCode)
+} catch (err) {
+  const error = JSON.stringify(err.response.body, null, 2)
+  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
+}
+
+
+

Scopes

+ + + + + + + +
accountdata.balances.readRead general ledger account balances
+

Parameters

+
Header parameters
+ + + + + + + + + +
NameDescription
Xero-Tenant-Id* + + +
+
+
+ + UUID + + + (uuid) + + +
+The ID of the Xero organisation to query. +
+
+
+ Required +
+
+
+
+
Query parameters
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
accountingBasis* + + +
+
+
+ + String + + +
+Accounting basis for the balance calculation. +
+
+
+ Required +
+
+
+
date* + + +
+
+
+ + date + + + (date) + + +
+The date to calculate account balances as at, in ISO 8601 format (YYYY-MM-DD). +
+
+
+ Required +
+
+
+
comparisonPeriodCount + + +
+
+
+ + Integer + + + (int32) + + +
+

Number of additional comparison balances to return, each one further back in +time than the last. Must be supplied together with comparisonPeriodSize.

+
    +
  • Minimum: 1
  • +
  • Maximum: 100
  • +
+ +
+
+
+
+
comparisonPeriodSize + + +
+
+
+ + String + + +
+The unit of time each comparison period steps back by. Must be supplied +together with comparisonPeriodCount. +
+
+
+
+
accountIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+

Filter to specific account IDs (GUIDs). Repeat the parameter for multiple +accounts.

+
    +
  • Maximum: 50 account IDs
  • +
  • Validation: Returns 404 if any ID does not exist for the organisation
  • +
+ +
+
+
+
+
class + + +
+
+
+ + array[String] + + +
+Account classes to filter by. Can be combined with other filters. +
+
+
+
+
type + + +
+
+
+ + array[String] + + +
+Account types to filter by (e.g. BANK, CURRENT, etc). Use INVENTORY to +match inventory asset accounts, regardless of their underlying account type. +Can be combined with other filters. +
+
+
+
+
systemAccountCodes + + +
+
+
+ + array[String] + + +
+System account codes to filter by (e.g. RETAINEDEARNINGS, +UNREALISEDGAINS). Can be combined with other filters. +
+
+
+
+
trackingItemIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+Filter to accounts assigned to any of the given tracking item IDs. +
+
+
+
+
unassignedToTrackingCategoryIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+Filter to accounts that are not assigned to any tracking option within the +given tracking category IDs. +
+
+
+
+
+
+
+
+
+
+
+

getAccountMovements

+

Get the net movement of each general ledger account over a date range

+
+
+
+

+

Retrieves account movements between startDate and endDate, optionally +including movements for one or more prior comparison periods of the same length, +and optionally filtered by account class, type, account IDs, system account code, +or tracking item.

+

Filtering

+
    +
  • Filter by class, type, accountIds, and/or systemAccountCodes. These can be +combined freely — when more than one is supplied, the server returns only accounts +that match all of the supplied filters (an intersection, not a union).
  • +
  • type values are matched case-sensitively, so use uppercase (for example BANK). Inventory +asset accounts are reported as, and can only be filtered by, INVENTORY; filtering by +their underlying account type does not match them.
  • +
  • trackingItemIds and unassignedToTrackingCategoryIds can be used independently of +the filters above to further narrow which accounts are returned.
  • +
+

Comparison periods

+
    +
  • Supplying comparisonPeriodCount together with comparisonPeriodSize returns +additional movements for prior date ranges of the same length, in addition to the +movement between startDate and endDate.
  • +
  • Each comparison range is calculated by moving the primary range back by +comparisonPeriodSize, comparisonPeriodCount times. For MONTH, QUARTER, and +YEAR sizes, range boundaries that fall on the last day of a month keep landing on +the last day of the shifted month.
  • +
  • comparisonPeriodCount and comparisonPeriodSize must be supplied together.
  • +
  • The primary range and every comparison range must not overlap each other. A request +whose periods would overlap is rejected with 400 Bad Request. Ranges that share a single boundary day count as +overlapping, which month-end adjustment can cause when shifting by MONTH, QUARTER, or +YEAR.
  • +
+

Bank accounts

+

Bank account data is only available to users with bank account view permission for the +organisation.

+
    +
  • If the request would include bank accounts and the user lacks this permission, it is +rejected with 403 Forbidden. A request is treated as including bank accounts when it +has no account filters, filters by all five class values and nothing else, includes +BANK in type, or lists a bank account in accountIds.
  • +
  • For other requests (for example class=ASSET), bank accounts are silently excluded from +the response for users without this permission, instead of the request being rejected.
  • +
+

Pagination

+

This endpoint does not paginate — the full set of matching account movements is +returned in a single response.

+

Results

+

Only combinations of account and date range with non-zero movement are returned; comparison +ranges are not zero-filled. The response is a flat list with no guaranteed ordering.

+

+

+
+
/account-movements
+

+

Usage and SDK Samples

+

+ +
+ +
+
await xero.setTokenSet(tokenSet);
+
+const accountingBasis = 'ACCRUAL';
+const startDate: Date = new Date("2024-01-01");
+const endDate: Date = new Date("2024-12-31");
+const xeroTenantId = '2ae32d9e-4711-4201-9f2a-ac80e5318359';
+const comparisonPeriodCount = 3;
+const comparisonPeriodSize = 'MONTH';
+const accountIds = [];
+const class = [];
+const type = [];
+const systemAccountCodes = [];
+const trackingItemIds = [];
+const unassignedToTrackingCategoryIds = [];
+
+try {
+  const response = await xero.accountingApi.getAccountMovements(accountingBasis, startDate, endDate, xeroTenantId,  comparisonPeriodCount, comparisonPeriodSize, accountIds, class, type, systemAccountCodes, trackingItemIds, unassignedToTrackingCategoryIds);
+  console.log(response.body || response.response.statusCode)
+} catch (err) {
+  const error = JSON.stringify(err.response.body, null, 2)
+  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
+}
+
+
+

Scopes

+ + + + + + + +
accountdata.movements.readRead general ledger account movements
+

Parameters

+
Header parameters
+ + + + + + + + + +
NameDescription
Xero-Tenant-Id* + + +
+
+
+ + UUID + + + (uuid) + + +
+The ID of the Xero organisation to query. +
+
+
+ Required +
+
+
+
+
Query parameters
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
accountingBasis* + + +
+
+
+ + String + + +
+Accounting basis for the movement calculation. +
+
+
+ Required +
+
+
+
startDate* + + +
+
+
+ + date + + + (date) + + +
+Start date of the movement range, in ISO 8601 format (YYYY-MM-DD). +
+
+
+ Required +
+
+
+
endDate* + + +
+
+
+ + date + + + (date) + + +
+End date of the movement range, in ISO 8601 format (YYYY-MM-DD). +
+
+
+ Required +
+
+
+
comparisonPeriodCount + + +
+
+
+ + Integer + + + (int32) + + +
+

Number of additional comparison movements to return, each covering a range +further back in time than the last. Must be supplied together with +comparisonPeriodSize.

+
    +
  • Minimum: 1
  • +
  • Maximum: 100
  • +
+ +
+
+
+
+
comparisonPeriodSize + + +
+
+
+ + String + + +
+The unit of time each comparison range steps back by. Must be supplied +together with comparisonPeriodCount. +
+
+
+
+
accountIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+

Filter to specific account IDs (GUIDs). Repeat the parameter for multiple +accounts.

+
    +
  • Maximum: 50 account IDs
  • +
  • Validation: Returns 404 if any ID does not exist for the organisation
  • +
+ +
+
+
+
+
class + + +
+
+
+ + array[String] + + +
+Account classes to filter by. Can be combined with other filters. +
+
+
+
+
type + + +
+
+
+ + array[String] + + +
+Account types to filter by (e.g. BANK, CURRENT, etc). Use INVENTORY to +match inventory asset accounts, regardless of their underlying account type. +Can be combined with other filters. +
+
+
+
+
systemAccountCodes + + +
+
+
+ + array[String] + + +
+System account codes to filter by (e.g. RETAINEDEARNINGS, +UNREALISEDGAINS). Can be combined with other filters. +
+
+
+
+
trackingItemIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+Filter to accounts assigned to any of the given tracking item IDs. +
+
+
+
+
unassignedToTrackingCategoryIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+Filter to accounts that are not assigned to any tracking option within the +given tracking category IDs. +
+
+
+
+
+
+
+
+
+
+
+

getAccountTransactions

+

Get general ledger account transactions between two dates, with pagination and filtering

+
+
+
+

+

Retrieves transactions posted between startDate and endDate (inclusive), +optionally filtered by account IDs, class, type, or system account code, with +cursor-based pagination for large result sets.

+

First call: omit token. Supply accountingBasis, startDate, and +endDate (all required), plus any optional filters.

+

Continuation calls: supply only token, taken from the previous response's +pagination.nextToken. Do not send any other query parameters — they are +ignored if present, since the original request is captured by the token.

+

Pagination

+
    +
  • Results are returned in pages of 200 lines.
  • +
  • Use pagination.nextToken from the response as the token query parameter to fetch +the next page. Send only the token query parameter on continuation requests — all +other query parameters are +ignored on a continuation call, since the original request's parameters are already +captured by the token.
  • +
  • The token value is an opaque string. Treat it as an opaque string only — do not +parse, modify, or construct it yourself. Tokens may expire.
  • +
  • When pagination is null, you've reached the last page.
  • +
  • The API captures a consistent snapshot at the time of the first request (via +maxJournalNumber), so transactions added while you are paginating through a +result set won't appear partway through, and won't cause duplicates or gaps.
  • +
+

Filtering

+
    +
  • Filter by accountIds, class, type, and/or systemAccountCodes. These can be +combined freely — when more than one is supplied, the server returns only +transactions for accounts that match all of the supplied filters (an +intersection, not a union).
  • +
  • type values are matched case-sensitively, so use uppercase (for example BANK). Inventory +asset accounts are reported as, and can only be filtered by, INVENTORY; filtering by +their underlying account type does not match them.
  • +
  • Use systemAccountCodes=NONE to match accounts that have no system account code.
  • +
  • Filters are only read from the first request in a pagination sequence — see +Pagination above.
  • +
+

Bank accounts

+

Bank account transactions are only available to users with bank account view permission for +the organisation.

+
    +
  • If the user lacks this permission and the request includes BANK in type, or lists a +bank account in accountIds, it is rejected with 403 Forbidden.
  • +
  • For all other requests, including unfiltered requests, bank account transactions are +silently excluded from the results for users without this permission.
  • +
+

+

+
+
/account-transactions
+

+

Usage and SDK Samples

+

+ +
+ +
+
await xero.setTokenSet(tokenSet);
+
+const xeroTenantId = '2ae32d9e-4711-4201-9f2a-ac80e5318359';
+const accountingBasis = 'ACCRUAL';
+const startDate: Date = new Date("2024-01-01");
+const endDate: Date = new Date("2024-12-31");
+const accountIds = [];
+const class = [];
+const type = [];
+const systemAccountCodes = [];
+const include = [["trackingCategories"]];
+const maxJournalNumber = 999999;
+const token = 'token_example';
+
+try {
+  const response = await xero.accountingApi.getAccountTransactions(xeroTenantId,  accountingBasis, startDate, endDate, accountIds, class, type, systemAccountCodes, include, maxJournalNumber, token);
+  console.log(response.body || response.response.statusCode)
+} catch (err) {
+  const error = JSON.stringify(err.response.body, null, 2)
+  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
+}
+
+
+

Scopes

+ + + + + + + +
accountdata.transactions.readRead general ledger account transactions
+

Parameters

+
Header parameters
+ + + + + + + + + +
NameDescription
Xero-Tenant-Id* + + +
+
+
+ + UUID + + + (uuid) + + +
+The ID of the Xero organisation to query. +
+
+
+ Required +
+
+
+
+
Query parameters
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
accountingBasis + + +
+
+
+ + String + + +
+Accounting basis for the transaction query. Required on the first call; +not used (and ignored) on continuation calls made with token. +
+
+
+
+
startDate + + +
+
+
+ + date + + + (date) + + +
+Start date in ISO 8601 format (YYYY-MM-DD). Required on the first call; not +used (and ignored) on continuation calls made with token. +
+
+
+
+
endDate + + +
+
+
+ + date + + + (date) + + +
+End date in ISO 8601 format (YYYY-MM-DD). Required on the first call; not +used (and ignored) on continuation calls made with token. +
+
+
+
+
accountIds + + +
+
+
+ + array[UUID] + + + (uuid) + + +
+

Filter to specific account IDs (GUIDs). Repeat the parameter for multiple +accounts. Only used on the first call.

+
    +
  • Maximum: 20 account IDs
  • +
  • Validation: Returns 404 if any ID does not exist for the organisation
  • +
+ +
+
+
+
+
class + + +
+
+
+ + array[String] + + +
+Account classes to filter by. Can be combined with other filters. Only used +on the first call. +
+
+
+
+
type + + +
+
+
+ + array[String] + + +
+Account types to filter by (e.g. BANK, CURRENT, etc). Use INVENTORY to +match inventory asset accounts, regardless of their underlying account type. +Can be combined with other filters. Only used on the first call. +
+
+
+
+
systemAccountCodes + + +
+
+
+ + array[String] + + +
+System account codes to filter by (e.g. RETAINEDEARNINGS, +UNREALISEDGAINS). Use NONE to match accounts with no system account code. +Can be combined with other filters. Only used on the first call. +
+
+
+
+
include + + +
+
+
+ + array[String] + + +
+Additional data to include in the response. Only used on the first call. +
+
+
+
+
maxJournalNumber + + +
+
+
+ + Long + + + (int64) + + +
+Maximum journal number to include in results, for point-in-time queries. If +omitted, the server captures the current maximum journal number at the time +of the first request and reuses it for every subsequent page, so the whole +paginated result set is consistent as at the moment you started. Only used on +the first call. +
+
+
+
+
token + + +
+
+
+ + String + + +
+Continuation token from a previous response's pagination.nextToken. When +present, all other query parameters are ignored. Opaque — do not parse, +modify, or construct it. +
+
+
+
+
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + diff --git a/docs/accounting/index.html b/docs/accounting/index.html index fd3ec991..62d22911 100644 --- a/docs/accounting/index.html +++ b/docs/accounting/index.html @@ -6481,6 +6481,7 @@ +
@@ -6522,7 +6523,7 @@