Admin read-only attribution anomaly discovery.
Returns two anomaly classes: - `unattributed_invoices`: externally-synced invoices that lack both `subscription_id` and `payment_attempt_id` (reuses `list_admin` with `attribution=Missing`, capped at the first 100 rows). - `payments_without_invoice`: succeeded renewal / one-time payment attempts inside a 90-day window with no invoice linked via `invoice.payment_attempt_id` (anti-join read; no writes). Permission reuses `require_billing_permission(..., "view")` — same model as `GET /invoices`. Realm isolation is enforced both by the repository (`realm_id` filter) and the shared middleware.
Returns two anomaly classes:
unattributed_invoices: externally-synced invoices that lack bothsubscription_idandpayment_attempt_id(reuseslist_adminwithattribution=Missing, capped at the first 100 rows).payments_without_invoice: succeeded renewal / one-time payment attempts inside a 90-day window with no invoice linked viainvoice.payment_attempt_id(anti-join read; no writes).
Permission reuses require_billing_permission(..., "view") — same model as
GET /invoices. Realm isolation is enforced both by the repository
(realm_id filter) and the shared middleware.
bearer_authAuthorizationBearer <token>Attribution anomalies
application/json- response
Response for the admin attribution-anomaly discovery endpoint.
paymentsWithoutInvoice*array<>Succeeded renewal / one-time payment attempts (within the lookback window)
that have no invoice row linked via invoice.payment_attempt_id.
unattributedInvoices*array<>Externally-synced invoices with no local attribution
(provider != 'manual' AND subscription_id IS NULL AND payment_attempt_id IS NULL).
curl -X GET 'https://example.com/api/bill/invoice-attribution/anomalies'{
"paymentsWithoutInvoice": [
{
"amount": 0,
"completedAt": "string",
"currency": "string",
"paymentAttemptId": "5c39612f-9e19-4385-8bd3-bad144d722f6",
"provider": "string",
"subscriptionId": "d079718b-ff63-45dd-947b-4950c023750f",
"targetType": "string"
}
],
"unattributedInvoices": [
{
"accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9",
"amountRefunded": 0,
"billingName": "string",
"createdAt": "string",
"currency": "string",
"dueDate": "2019-08-24",
"externalHostedUrl": "string",
"externalInvoiceId": "string",
"externalPdfUrl": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"invoiceNumber": "string",
"paymentAttemptId": "5c39612f-9e19-4385-8bd3-bad144d722f6",
"paymentProvider": "string",
"provider": "string",
"source": "string",
"status": "string",
"subscriptionId": "d079718b-ff63-45dd-947b-4950c023750f",
"total": 0
}
]
}