pyxero
Python API for accessing the REST API of the Xero accounting tool.
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 pyxerouv
uv add pyxeropoetry
poetry add pyxeroInstalling 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
Tags
More Accounting packages
Generates country- and subdivision-specific…
permissive · top 1,000 on PyPI
numpy-financialProvides elementary financial functions (IRR,…
permissive · top 5,000 on PyPI
fiscalyearProvides fiscal year, quarter, month, and day…
permissive · top 15,000 on PyPI
factur-xGenerates, validates, and extracts Factur-X,…
permissive · top 15,000 on PyPI
taxjarPython client library for the TaxJar Sales Tax…
permissive · top 15,000 on PyPI
ofxtoolsParses, generates, and converts Open Financial…
copyleft · top 15,000 on PyPI
xero-pythonProvides Python bindings to Xero's accounting,…
permissive · top 15,000 on PyPI
looker-sdkProvides a Python client library for…
permissive · top 5,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
edx-rest-api-clientProvides OAuth2 and JWT utilities for…
permissive · top 15,000 on PyPI
requests-oauthlibAdds OAuth 1 and OAuth 2 authentication support…
permissive · top 1,000 on PyPI
ovhLightweight Python wrapper for OVHcloud APIs…
permissive · top 15,000 on PyPI
requests-oauth2clientAn OAuth 2.x client for Python that obtains,…
permissive · top 5,000 on PyPI
workosA Python client library for the WorkOS API that…
permissive · top 5,000 on PyPI
intuit-oauthProvides OAuth2 and OpenID Connect…
permissive · top 5,000 on PyPI
python-quickbooksA Python library for querying, creating,…
permissive · top 5,000 on PyPI