Skip to content

GET /api/agent/contacts/summary ​

Population-level rollup of XeroContact + TrendBaseline. Use FIRST for any 'how many customers do we have?', 'who are my top 10 customers?', 'what's the ABC tier distribution?' question. Counts (byType, abcDistribution) reconcile against the operator's contact ledger regardless of scope. unclassified in the ABC distribution surfaces warming customers so the agent knows the count of we don't know yet rows.

Auth ​

  • Required scope: READ_SUMMARY
  • Header: Authorization: Bearer cr_live_<prefix>_<secret>

Query parameters ​

NameTypeRequiredNotes
topNintegernoCap on topByRevenue / topBySpend length.
includeArchivedbooleannoArchived contacts are EXCLUDED from every count here by default, identically to GET /api/agent/contacts — otherwise byType (the reason to call this endpoint at all) inflates with contacts the operator has already retired. Pass true to count them. Contacts whose contactStatus is null (never synced) are always counted.

Responses ​

200 — Aggregate contacts summary ​

Body: ContactsSummaryResponse

FieldTypeRequiredNotes
asOfDatestring (date)yes
currencystringyes
byTypeobjectyes
abcDistributionobjectyes
topByRevenuearray of SummaryTopContactyesTop customers by TrendBaseline.ltvCumulative (cumulative gross-profit LTV).
topBySpendarray of SummaryTopContactyesTop suppliers by aggregate XERO_BILL gross amounts. The per-supplier spend baseline isn't materialised in TrendBaseline yet (only fills customer LTV); v1 computes this in-memory at request time.
redactedItemCountintegeryesAggregate count of topByRevenue + topBySpend rows whose name was rewritten to Sensitive contact. Always 0 with READ_SENSITIVE.
billingAlertBillingAlertno
xeroAlertXeroAlertno

401 — Unauthorized ​

Body: ErrorResponse

FieldTypeRequiredNotes
errorstringyes

403 — Key lacks the required scope ​

Body: ErrorResponse

FieldTypeRequiredNotes
errorstringyes

429 — Rate-limited (per-minute burst) or query credits exhausted. Credits return individually on a rolling 5h window — retry after Retry-After seconds for one more call. ​

Body:

any

Response headers ​

Every successful response carries X-CashRunway-Subscription, X-CashRunway-Plan, X-CashRunway-Quota-Remaining, and X-CashRunway-Quota-Reset. Trialing subscriptions also include X-CashRunway-Trial-Days-Remaining. See the overview for details.

Released under a proprietary license. · cashrunway.ai