Creating a Xero Custom Connection (client credentials)
This guide is part of the Publicus connection catalog. Once you have the credentials, connect the service and Publicus stores them for you.
Distilled from Xero’s own documentation: Custom Connections, Client Credentials, Scopes, and OAuth 2.0 API limits. Retrieved 2026-07-03.
A Custom Connection is a premium machine-to-machine integration that uses the OAuth 2.0 client-credentials grant to access a single Xero organisation’s tenanted APIs with no interactive user login at request time. Use it for one-org back-office integrations; if you need to connect multiple organisations use the authorization code or PKCE flow instead. Custom Connections are available only for organisations in Australia, New Zealand, the UK and the US, require a paid subscription (free against the Xero Demo Company for development), and cannot reach Practice Manager, Xero HQ, or non-tenanted endpoints.
- Sign in to My Apps, click New app, and select Custom connection as the integration type. Name the integration.
- Select the API scopes the integration needs (granular scopes are available to all Custom Connections since 29 April 2026), and nominate the authorising user — the person who owns/administers the target organisation.
- The nominated user receives an email; when they click Connect they reach a consent screen showing the requested scopes and choose the organisation to connect. The organisation must hold a Custom Connection subscription with sufficient quota (the Xero Demo Company is exempt for development). You are emailed when authorisation completes.
- Back in My Apps, open the app details page, copy the Client id, and generate the Client secret (store it securely; it is shown once).
- Request a token:
POST https://identity.xero.com/connect/tokenwithContent-Type: application/x-www-form-urlencoded, theAuthorization: Basic base64(client_id:client_secret)header, and a body ofgrant_type=client_credentialsand a space-separatedscopelist. - The token response returns
access_token,expires_in(seconds),token_type: Bearer, andscope. There is noid_tokenand norefresh_token. - Call the API with
Authorization: Bearer {access_token}againsthttps://api.xero.com/api.xro/2.0/...(e.g.GET /api.xro/2.0/Invoices). Because the token is bound to the single authorised organisation, the documented call sends noxero-tenant-idheader.
Operational notes:
- No refresh token. The client-credentials grant issues no refresh token. When the access token expires (Xero access tokens are 30 minutes), simply request a new one with the same client id/secret and scopes.
- Scopes are fixed at creation. The set of scopes a Custom Connection can request is chosen when you create it in My Apps; the token request must stay within that set. New Custom Connections created after 29 April 2026 no longer receive the
accounting.journals.readscope. - Same client, two grants. A single client id/secret can also serve the plain client-credentials grant for non-tenanted app-data endpoints — but that is a different, non-tenanted use; Custom Connections themselves cannot access non-tenanted endpoints.
- Rate limits. The standard OAuth 2.0 API limits apply: per tenant 60 calls/minute, 5 concurrent, and daily caps; watch
X-DayLimit-Remaining/X-MinLimit-Remaining/X-AppMinLimit-Remainingand honourRetry-Afteron a 429.
Connect it to Publicus
Section titled “Connect it to Publicus”Open Connections under Credentials, choose Xero, and pick Xero Custom Connections (client credentials). Publicus asks for exactly the fields listed above and keeps them in your workspace’s secret storage.
See also: Xero in the catalog.
This guide is maintained by Publicus and published under CC BY 4.0.