Build on the customer portal API
Use one account-scoped API to show a bill, submit a line objection, retrieve the answer and acknowledge the document.
Use portald when your website or app needs customer bills, service status and the mailbox. The gateway assembles these views from the account's billing and contract records. Your app controls the experience. The optional web components use the same API. Download the OpenAPI contract · Embed the reference components
An outage case remains available at the same subscription-scoped URL through claim, review and journal posting. Retry a timed-out submission with the same UUID. To recover the original intake, GET /api/v1/portal/subscriptions/{id}/outages/{case}/claims/{request} with the customer credential. The response contains the receipt UUID, channel, business date and timestamp. A foreign or unknown receipt returns 404. Outage claim and receipt
Connect an account
The local Compose endpoint is http://127.0.0.1:9406/api/v1/portal. Fetch GET /api/v1/portal/openapi.yaml from the running service for the exact contract it serves. All references in the download resolve within that file.
Give the same customer a matching customer:<billing-account-uuid> credential in both domain services. Supply that bearer from your trusted application backend. For a browser, use a same-origin session adapter that resolves the signed-in customer on every request. Keep long-lived service credentials on the server. The gateway derives ownership from the credential. The caller supplies no account selector. Production defaults to HTTPS for non-loopback owner origins. Terminate TLS at the customer ingress before forwarding requests to the gateway.
For a local example, run just demo once to seed the estate. The following commands select a demo account with an invoice and enable a scoped bearer on the headless gateway.
export TELCO_SELFCARE_ACCOUNT=$(docker compose exec -T postgres psql -Atq \
-U telco_owner -d telco -c "SELECT billing_account_id FROM billd.bills WHERE kind='invoice' ORDER BY number LIMIT 1")
export TELCO_SELFCARE_TOKEN=$(openssl rand -hex 24)
just portaldUse just selfcare when you also want a browser sign-in and the reference UI. Browser setup
Open a bill and dispute a line
The following commands use Bash, curl and jq. They submit an objection to the selected demo account. Keep the case UUID for retries and for tracking the answer.
origin=http://127.0.0.1:9406
portal="$origin/api/v1/portal"
auth=(-H "Authorization: Bearer $TELCO_SELFCARE_TOKEN")
bill=$(curl -fsS "${auth[@]}" "$portal/billing" | jq -er 'first(.bills[] | select(.kind == "invoice") | .id)')
reading=$(curl -fsS "${auth[@]}" "$portal/bills/$bill?lang=en")
line=$(jq -er '.lines[0].line' <<<"$reading")
jq '.lines[0] | {line, label, amount, why}' <<<"$reading"
case_id=$(uuidgen | tr '[:upper:]' '[:lower:]')
body=$(jq -nc --argjson line "$line" '{line:$line, reason:"Bitte prüfen Sie den Leistungszeitraum."}')
curl -fsS "${auth[@]}" -X PUT -H 'Content-Type: application/json' \
--data "$body" "$portal/bills/$bill/objections/$case_id"An identical retry with the same UUID returns the existing receipt. Reusing it with a different line or reason returns a conflict. Retrieve bills/{id}/original?format=pdf for the original PDF or omit the query for accessible HTML.
Read the answer
The mailbox contains invoices, objections, notices, cancellations and block receipts. The objection keeps its ref when the operator answers. Fetch it again to see the updated status, answer and any linked credit note.
document=$(curl -fsS "${auth[@]}" "$portal/mailbox" |
jq -ec --arg ref "objection:$case_id" '.documents[] | select(.ref == $ref)')
jq '{title, issued, status:.data.status, answer:.data.answer}' <<<"$document"
# After the customer has opened this revision:
read_path=$(jq -er '.read_path' <<<"$document")
curl -fsS "${auth[@]}" -X PUT "$origin$read_path"Use the returned read link for the revision displayed. Acknowledging the original receipt leaves a later answer unread. A block request also gets a new read link when the network confirms it. An acknowledgement of the request leaves the confirmation unread. Dispatch evidence and read status are independent.
Check itemised calls
Fetch GET /bills/{id}/itemisation under the portal prefix for the account’s available call details. Use ?format=pdf for a downloadable statement. A 404 means no statement is available to this customer. A 503 means the evidence cannot be checked right now. Itemisation and retention
Handle partial availability
GET /overview returns billing, service and unavailable. If billing is healthy and service status times out, show the bill, leave the service tile unavailable and offer a retry. GET /mailbox uses the same availability list. An empty document list accompanied by an unavailable section is incomplete. If both sources are unavailable the gateway returns 503. An authentication or account-scope failure suppresses the whole aggregate.
The public cancellation form and masked verification links live on the operator's customer website at /kuendigen and /nachrechnen/{token}. Link customers there when the journey needs a public HTML page. Public customer journeys