Skip to content
Docs

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.

  1. Sign in to My Apps, click New app, and select Custom connection as the integration type. Name the integration.
  2. 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.
  3. 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.
  4. 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).
  5. Request a token: POST https://identity.xero.com/connect/token with Content-Type: application/x-www-form-urlencoded, the Authorization: Basic base64(client_id:client_secret) header, and a body of grant_type=client_credentials and a space-separated scope list.
  6. The token response returns access_token, expires_in (seconds), token_type: Bearer, and scope. There is no id_token and no refresh_token.
  7. Call the API with Authorization: Bearer {access_token} against https://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 no xero-tenant-id header.

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.read scope.
  • 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-Remaining and honour Retry-After on a 429.

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.