Skip to content

Xero: Retrieves the contact Id and name of each contact group

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

← Accounting operations · Get started

Operation xero.getcontactgroups

Provider route: GET /api.xro/2.0/ContactGroups. 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"]["getContactGroups"]>[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.getContactGroups(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.get_contact_groups(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
queryobjectOptionalAdditional keys: not allowed
query.wherestringOptional
query.orderstringOptional
headersobjectRequired within parentAdditional keys: not allowed
headers.xero-tenant-idstringRequired within parent

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

FieldTypePresenceDescription and constraints
$ModelRootExpand Creates a contact group — response body

Referenced models: Creates a contact group — response body

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

Creates a contact group — response body
FieldTypePresenceDescription and constraints
$objectRoot
ContactGroupsarrayOptional
ContactGroups[]ModelEach itemExpand Creates a contact group — response body — Contact Groups item

Referenced models: Creates a contact group — response body — Contact Groups item

Creates a contact group — response body — Contact Groups item
FieldTypePresenceDescription and constraints
$objectRoot
ContactGroupIDstringOptionalThe Xero identifier for an contact group – specified as a string following the endpoint name. e.g. /297c2dc5-cc47-4afd-8ec8-74990b8761e9
Format: uuid
ContactsarrayOptionalThe ContactID and Name of Contacts in a contact group. Returned on GETs when the ContactGroupID is supplied in the URL.
Contacts[]ModelEach itemExpand Creates contacts to a specific contact group — response body — Contacts item
NamestringOptionalThe Name of the contact group. Required when creating a new contact group
StatusstringOptionalThe Status of a contact group. To delete a contact group update the status to DELETED. Only contact groups with a status of ACTIVE are returned on GETs.
Known values: ACTIVE, DELETED

Referenced models: Creates contacts to a specific contact group — response body — Contacts item

Creates contacts to a specific contact group — response body — Contacts item
FieldTypePresenceDescription and constraints
$objectRoot
AccountNumberstringOptionalA user defined account number. This can be updated via the API and the Xero UI (max length = 50)
Maximum length: 50
AccountsPayableTaxTypestringOptionalThe tax type from TaxRates
AccountsReceivableTaxTypestringOptionalThe tax type from TaxRates
AddressesarrayOptionalStore certain address types for a contact – see address types
Addresses[]ModelEach itemExpand Creates contacts to a specific contact group — response body — Contacts item Addresses item
AttachmentsarrayOptionalDisplays array of attachments from the API
Attachments[]ModelEach itemExpand create Contact Attachment By File Name — response body — Attachments item
BalancesModelOptionalExpand Creates contacts to a specific contact group — response body — Contacts item Balances
BankAccountDetailsstringOptionalBank account number of contact
BatchPaymentsModelOptionalExpand Creates contacts to a specific contact group — response body — Contacts item Batch Payments
BrandingThemeModelOptionalExpand Retrieves all the branding themes — response body — Branding Themes item
CompanyNumberstringOptionalCompany registration number (max length = 50)
Maximum length: 50
ContactGroupsarrayOptionalDisplays which contact groups a contact is included in
ContactGroups[]ModelEach itemExpand Creates a contact group — response body — Contact Groups item
ContactIDstringOptionalXero identifier
Format: uuid
ContactNumberstringOptionalThis can be updated via the API only i.e. This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50). If the Contact Number is used, this is displayed as Contact Code in the Contacts UI in Xero.
Maximum length: 50
ContactPersonsarrayOptionalSee contact persons
ContactPersons[]ModelEach itemExpand Creates contacts to a specific contact group — response body — Contacts item Contact Persons item
ContactStatusstringOptionalCurrent status of a contact – see contact status types
Known values: ACTIVE, ARCHIVED, GDPRREQUEST
DefaultCurrencyModelOptionalExpand Deletes an Allocation from a Prepayment — response body — Invoice Currency Code
DiscountJSONOptional
Discount (anyOf 1)numberAlternativeThe default discount rate for the contact (read only)
Format: double
Read only: true
Discount (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
EmailAddressstringOptionalEmail address of contact person (umlauts not supported) (max length = 255)
Maximum length: 255
FirstNamestringOptionalFirst name of contact person (max length = 255)
Maximum length: 255
HasAttachmentsbooleanOptionalA boolean to indicate if a contact has an attachment
Default: false
HasValidationErrorsbooleanOptionalA boolean to indicate if a contact has an validation errors
Default: false
IsCustomerbooleanOptionaltrue or false – Boolean that describes if a contact has any AR invoices entered against them. Cannot be set via PUT or POST – it is automatically set when an accounts receivable invoice is generated against this contact.
IsSupplierbooleanOptionaltrue or false – Boolean that describes if a contact that has any AP invoices entered against them. Cannot be set via PUT or POST – it is automatically set when an accounts payable invoice is generated against this contact.
LastNamestringOptionalLast name of contact person (max length = 255)
Maximum length: 255
MergedToContactIDstringOptionalID for the destination of a merged contact. Only returned when using paging or when fetching a contact by ContactId or ContactNumber.
Format: uuid
NamestringOptionalFull name of contact/organisation (max length = 255)
Maximum length: 255
PaymentTermsModelOptionalExpand Creates contacts to a specific contact group — response body — Contacts item Payment Terms
PhonesarrayOptionalStore certain phone types for a contact – see phone types
Phones[]ModelEach itemExpand Creates contacts to a specific contact group — response body — Contacts item Phones item
PurchasesDefaultAccountCodestringOptionalThe default purchases account code for contacts
PurchasesDefaultLineAmountTypestringOptionalThe default purchases line amount type for a contact Only available when summaryOnly parameter or paging is used, or when fetch by ContactId or ContactNumber.
Known values: INCLUSIVE, EXCLUSIVE, NONE
PurchasesTrackingCategoriesarrayOptionalThe default purchases tracking categories for contacts
PurchasesTrackingCategories[]ModelEach itemExpand Creates contacts to a specific contact group — response body — Contacts item Sales Tracking Categories item
SalesDefaultAccountCodestringOptionalThe default sales account code for contacts
SalesDefaultLineAmountTypestringOptionalThe default sales line amount type for a contact. Only available when summaryOnly parameter or paging is used, or when fetch by ContactId or ContactNumber.
Known values: INCLUSIVE, EXCLUSIVE, NONE
SalesTrackingCategoriesarrayOptionalThe default sales tracking categories for contacts
SalesTrackingCategories[]ModelEach itemExpand Creates contacts to a specific contact group — response body — Contacts item Sales Tracking Categories item
StatusAttributeStringstringOptionalStatus of object
TaxNumberstringOptionalTax number of contact – this is also known as the ABN (Australia), GST Number (New Zealand), VAT Number (UK) or Tax ID Number (US and global) in the Xero UI depending on which regionalized version of Xero you are using (max length = 50)
Maximum length: 50
TaxNumberTypestringOptionalIdentifier of the regional type of tax number, such as US, UK, or other regional tax identifiers
Known values: SSN, EIN, ITIN, ATIN
TrackingCategoryNamestringOptionalThe name of the Tracking Category assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories
TrackingCategoryOptionstringOptionalThe name of the Tracking Option assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories
UpdatedDateUTCstringOptionalUTC timestamp of last update to contact
Read only: true
ValidationErrorsarrayOptionalDisplays validation errors returned from the API
ValidationErrors[]ModelEach itemExpand Retrieves journals — response body — Warnings item
WebsitestringOptionalWebsite address for contact (read only)
Read only: true
XeroNetworkKeystringOptionalStore XeroNetworkKey for contacts.

Referenced models: Creates contacts to a specific contact group — response body — Contacts item Batch Payments, Creates contacts to a specific contact group — response body — Contacts item Contact Persons item, Deletes an Allocation from a Prepayment — response body — Invoice Currency Code, Creates contacts to a specific contact group — response body — Contacts item Addresses item, create Contact Attachment By File Name — response body — Attachments item, Creates contacts to a specific contact group — response body — Contacts item Balances, Retrieves all the branding themes — response body — Branding Themes item, Creates a contact group — response body — Contact Groups item, Creates contacts to a specific contact group — response body — Contacts item Payment Terms, Creates contacts to a specific contact group — response body — Contacts item Phones item, Creates contacts to a specific contact group — response body — Contacts item Sales Tracking Categories item, Retrieves journals — response body — Warnings item

SDK function policy ID: xero.getcontactgroups. Catalog operation: getContactGroups. 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.