HMRC API client
hmrclib
AvailableMaking Tax Digital, Customs and the other HMRC APIs, called from typed Python.
A Python client for the 73 REST APIs that HMRC publishes on its Developer Hub, including Making Tax Digital for VAT and Self Assessment, Customs and Lifetime ISA. The client classes and pydantic v2 models are generated from HMRC’s own OpenAPI specifications, and each endpoint has its own method. It handles OAuth2 for application-restricted and user-restricted APIs, and an optional FastAPI server receives the browser redirect. hmrclib is not affiliated with HMRC.
Who it is for. Python teams building tax, payroll or accounting software that files through Making Tax Digital or calls HMRC’s other APIs.
- Status
- Available
- Part of
- Open source
- Licence
- Open source, MIT
- Product site
- github.com/rodmena-limited/hmrclib
- Tags
- PythonHMRCMaking Tax DigitalOAuth2pydantic
What it does
-
Generated from HMRC’s specifications
The clients and models are generated from the OpenAPI files HMRC publishes, which are kept in the repository.
-
OAuth2 for both kinds of API
Client credentials for application-restricted APIs, and an authorisation code with refresh for user-restricted ones.
-
Strict typing
The package passes mypy in strict mode, and each response is a pydantic v2 model.
Documentation and access details are on the product site, github.com/rodmena-limited/hmrclib. For a pilot, an integration or procurement questions, contact us.