skillfed

pyxero

Python API for accessing the REST API of the Xero accounting tool.

pyxero v0.9.5 318.0K downloads/30d#7,657 on PyPI282
Permissive license BSD-3-Clause Active released

What it is and what it does

PyXero is a Python wrapper around Xero's REST API that handles authentication and request mechanics. It supports both OAuth2 (for apps that can keep secrets) and PKCE (for mobile, desktop, or single-page apps), managing token expiry and refresh automatically. The library abstracts Xero's accounting resources into Python objects you can query.

You register your app with Xero, obtain credentials, and use PyXero to authenticate users and make API calls on their behalf. The library handles scope management, multi-tenant support for users with access to multiple Xero organizations, and token lifecycle. It's built on requests, requests-oauthlib, python-dateutil, PyJWT, and cryptography.

Use it for:

  • Integrate Xero accounting data into your application without storing user passwords.
  • Build automated workflows that read and write accounting data back to Xero.
  • Create desktop or mobile tools that access Xero without embedding a client secret.
  • Sync customer and transaction data from Xero into your own database.
  • Connect Xero accounting to a larger business intelligence or reporting pipeline.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyXero is a Python client library for the Xero accounting REST API, supporting OAuth2 and PKCE authentication flows.

Yes. PyXero is actively maintained, has no known vulnerabilities, supports current Python versions 3.9–3.14, and uses a permissive BSD-3-Clause license. Install friction is low. It is the standard choice for Python developers integrating with Xero's API.

Install

pyxero on PyPI

pip

pip install pyxero

uv

uv add pyxero

poetry

poetry add pyxero

Installing pyxero

Before you install

Low install friction with a pure Python wheel and five well-established runtime dependencies. The package is actively maintained with recent commits and supports modern Python versions 3.9 through 3.14.

License in practice

BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions, making it safe for most projects.

Quickstart

pip install pyxero

from pyxero.auth import OAuth2Credentials

credentials = OAuth2Credentials(client_id, client_secret, callback_uri=callback_uri)
authorisation_url = credentials.generate_url()
credentials.verify(request_uri)
contacts = credentials.get_tenants()

Requires a registered Xero app with Client ID and Client Secret; OAuth2 tokens expire after 30 minutes and must be refreshed for extended use.

Verify before relying

  • Whether the package handles all current Xero API endpoints or if some are missing or outdated.
  • Performance characteristics when querying large datasets or making many concurrent requests.
  • Completeness of error handling and recovery for network failures or API rate limits.
  • Full scope of accounting resources accessible through the library beyond what the excerpt demonstrates.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 5 — requests, requests-oauthlib, python-dateutil, PyJWT, cryptography
Maintenance actively maintained — 436 days since the last release
Last repo commit
First released
Downloads 317,999/month — #7,657 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyxero-0.9.5-py3-none-any.whl

Keywords: xero, api

Development Status :: 4 - BetaEnvironment :: Web EnvironmentIntended Audience :: Financial and Insurance IndustryOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Office/Business :: Financial :: Accounting

Tags

xero api client pythonxero accounting integrationoauth2 xero authenticationxero python wrapperaccounting api clientxero rest apixero oauth2 client
accounting-apioauth2-clientxero-integration

More Accounting packages