How to Get Xero API Access (and Why There Is No Simple API Key)
How Xero API access actually works, which app type you need, what the Xero API can connect, and when a Xero integration needs a developer.
How Xero API access actually works, which app type you need, what the Xero API can connect, and when a Xero integration needs a developer.
Who this is for
Business owners and finance managers who want Xero connected to another system and have been searching for a Xero API key.
Question this answers
How do I get Xero API access, and what can I actually connect Xero to?
What you will leave with
Most people arrive at this looking for a single key to copy out of Xero settings, the way several other platforms work. Xero does not do that. It uses OAuth 2.0, which means you register an application with Xero and receive a client id and client secret, then exchange those for an access token that your integration uses on each request.
That sounds like extra work, and it is, but the reason is worth understanding. A single permanent key that can read and write your entire ledger is a large risk if it leaks. OAuth tokens are scoped to specific permissions and expire on their own.
If you have been told to "just get the Xero API key", the honest answer is that the thing you actually need is a Xero app with a Custom Connection. The rest of this guide covers what that means.
Xero offers different app types, and picking the wrong one wastes a lot of time. In plain terms:
If your goal is "get our job management system talking to our Xero", you want a Custom Connection. If your goal is "let our customers connect their Xero to our product", you want a Standard app.
Check the current process before you plan around it. Xero changes its developer tooling and plan requirements from time to time. The shape above has been stable for a while, but confirm the detail on Xero's developer documentation rather than treating this page as the source of truth.
The Accounting API covers the parts of Xero most integrations need:
Separate APIs cover Payroll, Files, Projects and Assets. They are not part of the Accounting API, which surprises people who assume one connection covers everything. If your project involves timesheets or pay runs, you are dealing with the Payroll API and its own permissions.
Two things catch out most first integrations.
Access tokens are short lived. A Xero access token expires in about half an hour. Your integration has to use the refresh token to obtain a new one automatically, and it has to store the updated refresh token each time, because it changes. Integrations that skip this work perfectly in testing and then stop overnight.
Rate limits are per organisation. Xero applies both a per minute and a daily cap on API calls for each connected organisation. A first sync that loops through several years of invoices one at a time will hit the limit and start receiving errors. Bulk operations need batching, paging and a backoff strategy from the start.
Not every Xero connection needs a build. An honest split:
Deciding which system wins when the same contact changes in both is the hard part, not the API call.
Getting these wrong shows up in the accounts, not in an error log.
Volume, rate limits and matching against existing records all bite at once.
Award rates, overtime and allowances need to be exact, not close enough.
That is a Standard app with a certification path, a different project entirely.
The API itself is well documented and pleasant to work with. The cost sits in the mapping decisions, the edge cases and the monitoring, which is true of every accounting integration and is why they are worth doing properly the first time. Our Xero integration services cover the two-way sync, payroll and migration work listed above.
Xero does not issue a single application programming interface (API) key because it uses OAuth 2.0. You register an app with Xero, receive a client id and client secret, then exchange those for an access token sent with each request. A permanent key that could read and write a whole ledger would be a large risk if it leaked, while OAuth tokens are scoped and expire.
Use a Xero Custom Connection when connecting a single Xero organisation, usually your own, such as linking your job management system to your Xero. It is a machine to machine connection with no login screen, and it needs a paid Xero subscription. A Standard app is only needed when building software that other businesses will connect their own Xero to.
Setting up Xero application programming interface (API) access takes five steps. Sign in to the Xero developer portal with the account that can reach your Xero organisation, create a new app and choose its type, then record the client id and client secret, which is shown only once. Next, authorise the connection, grant only the scopes the integration needs, and exchange the credentials for an access token.
A Xero integration that stops overnight has usually failed to refresh its access token. Xero access tokens expire in about half an hour, so the integration must use the refresh token to get a new one automatically, and store the updated refresh token each time because it changes. Integrations that skip this work perfectly in testing and then stop.
Xero caps application programming interface (API) calls per minute and per day for each connected organisation. A first sync that loops through several years of invoices one at a time will hit the limit and start getting errors, so bulk work needs batching, paging and a backoff strategy. An unhandled rate limit response can leave a sync silently dropping records.
Ask the author
Ask it here and it comes straight to Kasun, who wrote this. No sales call, no obligation, and a real answer even if the answer is that you do not need us.
Kasun Wijayamanna
Founder, replies within one business day
Tell us what you are comparing, replacing, or trying to improve. We will come back with a practical recommendation and realistic scope.
Built here. Your data stays here.
Thanks for reaching out. We will get back to you within one business day.
See what else we do