> ## Documentation Index
> Fetch the complete documentation index at: https://docs.forepost.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Accounts

> Per-customer rollup for B2B teams — who's at risk, who matters most, weighted by ARR.

Forepost's core read is team-aggregate: eight signals across the whole queue. **Accounts** is the B2B layer on top, so a CX lead can ask "which named customers should I worry about today?" without leaving the brief.

## What it is

A workspace-scoped roster of your customers (B2B accounts), each carrying:

* **Name** and optional **domain** (`acme.com`)
* **ARR tier** — `enterprise`, `mid`, `smb`, `free`, or `unknown`
* **ARR value** — optional explicit number
* **Health** — `healthy`, `watch`, `at_risk`, or `unknown`
* **Notes** — leader-editable, one paragraph

When a helpdesk is connected, Forepost can ingest accounts from Intercom companies, Front contacts, Zendesk organizations, or Plain customer groups. Until then, you can add accounts by hand.

## The at-risk strip

The top of the Accounts view shows a ranked list of accounts that are currently `at_risk` or `watch`, weighted by ARR tier so an enterprise account on `watch` ranks above a free account at `at_risk`. The ranking formula:

```
risk_score = (arr_tier_weight × 10) + health_weight
```

The strip caps at 10 entries — it's a glance, not a queue. Click any row to open the account detail (full metrics history).

## Per-account metrics

Each account carries its own weekly rollup of CSAT, ticket volume, first response time, and (when available) sentiment. The data is keyed by ISO week (`2026-W19`) so trend lines stay comparable across timezones.

The worker writes one snapshot per `(account, iso_week)` on every helpdesk metric refresh; the table tops out at twelve weeks per account in the UI but the underlying history is unbounded.

## API

```bash theme={null}
GET    /accounts                # list, sorted by health then ARR tier then name
GET    /accounts/at-risk        # top 10 weighted by ARR + health
POST   /accounts                # create — body { name, domain?, arrTier?, arrValue?, health?, notes? }
GET    /accounts/:id            # detail + last 12 weeks of metrics
PATCH  /accounts/:id            # edit name / tier / health / value / notes
DELETE /accounts/:id            # soft-archive
```

Owners and admins can edit. Members see the read-only view.

## How accounts feed the brief

When at least one account is flagged `at_risk` or `watch`, the brief's context block includes a short summary:

```
TOP AT-RISK ACCOUNTS (B2B):
• Acme Corp (Enterprise, $120k ARR) — CSAT 64%, last reply 5 days ago
• Globex (Mid, $40k ARR) — three escalations this week, billing tier
• Initech (SMB) — sustained sentiment dip across 3 weeks
```

The brief is told to mention specific names rather than aggregate phrases ("a couple of customers are unhappy") when the data is account-grounded.

## What accounts aren't

* **Not a CRM.** No pipeline, no contacts, no deal stages. Forepost's job is to surface support-side health for the names you already track elsewhere.
* **Not a customer-data store.** Forepost doesn't persist conversation bodies, contact PII, or anything beyond what you've explicitly entered or what the helpdesk integration synced.
* **Not B2C.** If your book is thousands of consumer users, leave Accounts empty. The team-level signals are the right read for B2C; accounts are designed for the long-tail-plus-named-enterprise pattern most B2B SaaS support teams run.

## Privacy

Accounts live in your workspace's D1 scope. They're never shared across workspaces. When a helpdesk integration syncs accounts, only the metadata above is stored — never the conversation bodies. Encryption-at-rest applies to the stored token; the account rows themselves are plaintext.
