# TMF678 customer bills

> Use an account-scoped credential to retrieve a partner’s sealed invoices and credits.


A service provider that buys wholesale access can import the same invoice number, service dates and totals its operator sees in the Desk. billd serves the list and retrieve operations of TMF678 CustomerBill v5.0.0. The Desk’s **TMF-Rechnungsdaten (JSON)** download uses the same representation.

## Give a partner access

Use the billing-account UUID returned by signup. Add a dedicated named principal to billd’s `TELCO_API_KEYS_FILE` and restart billd. Each line has a principal name, role including account UUID, and secret. Replace both placeholders before starting the service.

```text
wholesale-north bill-reader:<billing-account-uuid> <partner-secret>
```

Issue one credential per account. Overlapping secrets for a principal must specify the same account. Supply the credential to the partner over a secure channel. The partner calls billd directly through an authenticated HTTPS deployment. The Desk edge uses its operator credential.

## List and retrieve

```sh
BASE="$BILLD/tmf-api/customerBillManagement/v5/customerBill"
curl -fsS -D headers.txt -H "Authorization: Bearer $PARTNER_KEY" "$BASE?limit=25&offset=0"
curl -fsS -H "Authorization: Bearer $PARTNER_KEY" "$BASE/$BILL_UUID"
```

Lists are ordered by invoice number. Pages default to 50 and accept 1–100 items. Read `X-Result-Count` and advance the offset by that count on HTTP 206. HTTP 200 marks the last page. An optional `billingAccount.id` filter narrows results within the caller’s authorized accounts. A foreign bill and an unknown UUID both return 404. Estate-wide operator, integration and read keys can read every account's bills.

| Wire field | Meaning |
|---|---|
| `id`, `href`, `billNo`, `billingAccount.id` | Stable bill UUID, resource path, printed invoice number and owning account UUID |
| `category` | `invoice`, `final` or `credit-note` |
| `billDate` | Seal date at midnight in Europe/Berlin |
| `billingPeriod` | First and last service days recorded in the sealed document, expressed from local midnight through the end of the last day. Absent when the seal has no service dates. |
| `taxExcludedAmount`, `taxIncludedAmount` | Signed EUR totals before and after VAT, encoded as JSON numbers. Use a decimal parser for monetary reconciliation. |

For the Bitstrom example, completion on 22 March produces a March invoice for €10.00 net and €11.90 gross. The corresponding full credit carries −€11.90 gross. The amounts describe the sealed document. Outstanding balances and payment status require separate ledger evidence.

In Rust, rutmf 0.3 reads both totals into `Money.value` as exact decimals, including credits and values above the floating-point precision limit. For a refused request, `error.status()` gives the HTTP status. Use `error.problem()` to read the RFC 9457 detail and the stable telco code in `problem.extensions["code"]`.

For mobile measurements linked to a bill, issue a separate account-scoped usage credential. [TMF635 product usage](../docs/mobile-usage/#reconcile-partner-usage)

billd serves only these two GET operations; TMF678's PATCH, on-demand billing and notifications are not offered. Partners can use rutmf’s `CustomerBillClient` with the published v5 route. [rutmf TMF678 client and operation table](https://docs.rs/rutmf/0.3.0/rutmf/api/tmf678/index.html)
