Skip to main content

united-utilities-py

Async Python client for the United Utilities "Your Water" mobile API, reverse-engineered from the app (build 102). Pairs with a Home Assistant integration (united-utilities-hass).

Unofficial. Uses a private app API that United Utilities can change or withdraw at any time. For personal use with your own account.

Why the mobile API (not the website)

The myaccount.unitedutilities.com website is gated behind Google reCAPTCHA Enterprise and Jscrambler, so a scripted login needs a real browser. The mobile app talks to a separate gateway (prd-mobile-apigateway.unitedutilities.com) with a far simpler scheme: a static app apiKey header plus a customerId + numeric PIN login that returns a session token. No captcha.

Credentials

The mobile API does not use your website email/password. It needs:

  • customerId — a numeric id assigned when you register in the app.
  • pin — the numeric PIN you set in the app.
  • accountNumber — your water account number (for account-scoped calls).

The app doesn't show customerId, but you can look it up from your account number and postcode, the same way the app's "register again" screen does. The account must already be registered in the app:

from united_utilities import lookup_customer_id

customer_id = await lookup_customer_id("4000000000", "M1 1AA")

⚠️ Login and lookup both lock out. A wrong PIN decrements attemptsRemaining; at zero the account locks (HTTP 423, raised as AccountLockedError, which the app says lasts 60 minutes). This client never retries login() or lookup_customer_id(). Do not loop on AuthError.

Install

pip install united-utilities

Usage

import asyncio
from united_utilities import UnitedUtilitiesClient


async def main() -> None:
    async with UnitedUtilitiesClient("24000000", "000000", "4000000000") as uu:
        await uu.login()
        details = await uu.account_details()
        meter = await uu.meter_readings()
        print("balance:", details.account_balance)
        if meter.latest:
            print("last read:", meter.latest.value, "on", meter.latest.date)


asyncio.run(main())

In Home Assistant, pass the shared session:

from homeassistant.helpers.aiohttp_client import async_get_clientsession

client = UnitedUtilitiesClient(customer_id, pin, account_number, session=async_get_clientsession(hass))

Endpoints covered

Method Returns
lookup_customer_id(account_number, postcode) the app customerId (module function, no login needed)
login() / logout() session token lifecycle
account_details() balance, next payment, meter flag, payment plan, bill count
meter_readings() meter details + reading history (.latest)
statement() itemised bills & payments
bill_pdf(document_id) a bill as PDF bytes (document_id from statement())
payment_info() current balance, minimum payment
preferences() notification preferences
notifications() customer notifications

Bill PDFs: tariffs and charges

The API has bill totals and meter readings but not tariffs. The bill PDF does, and parse_bill() reads it (install the extra: pip install "united-utilities[pdf]"):

from united_utilities import parse_bill

latest = next(i for i in await uu.statement() if i.item_type == "BI" and i.document_id)
bill = parse_bill(await uu.bill_pdf(latest.document_id))
if bill.trustworthy:
    print(bill.price_per_m3, bill.standing_charge_per_year)  # e.g. 5.51, 177.59
else:
    print(bill.problems)

A Bill has the billing period, both meter readings and who read them, every charge line (fresh water / wastewater × usage / standing charge, per tariff period when a bill spans 1 April), any discount and the total. Some bills are payment-plan updates with no charges; those have itemised == False.

Parsing matches the bill's wording, so every parse is cross-checked. Line items must add up to the total, each line must equal quantity × rate, fresh water and wastewater must bill the same volume, and the volume must match the readings. Anything that doesn't add up goes in bill.problems, trustworthy is False, and price_per_m3 / standing_charge_per_year return None instead of a possibly wrong figure.

Bills include the account holder's name, address and bank details. Parse them in memory; don't log or store the PDF.

Development

See CONTRIBUTING.md. Response shapes were confirmed against live production responses; tests run on synthetic fixtures (no real account data) with aresponses.

License

MIT

Metadata

Release files for united-utilities 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for united-utilities 0.4.0
File Size Uploaded Provenance Actions
united_utilities-0.4.0.tar.gz 22.1 kB With provenance Details for united_utilities-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for united-utilities 0.4.0
File Interpreter ABI Platform Actions
united_utilities-0.4.0-py3-none-any.whl Python 3 none any Details for united_utilities-0.4.0-py3-none-any.whl

Total release size: 38.7 kB

Release files / united_utilities-0.4.0.tar.gz

Download URL united_utilities-0.4.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f5ed752e1fecab15f2fb70f3fe191b1be1984556ae65b5b3234702c6557a2ff4
BLAKE2b-256 checksum
How to use checksums
33619d7157012db84b418c298c390438ddc11cf02e2940e449ca333fa5b2cf94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / united_utilities-0.4.0-py3-none-any.whl

Download URL united_utilities-0.4.0-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5a866d7220811f29ff1caa34c263257e0e931bd30f167d06c98f3a743563d62
BLAKE2b-256 checksum
How to use checksums
767ff09d237c17fcf7896f2e3830e02a8caf427cb87cfdd7136ee68ae95e08c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for united-utilities 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for united_utilities-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page