Accountant Portal

Upload an approved, de-identified practice packet for a customer

Changed on

Stores one practice packet (format practice-packet/v1, #1805): aggregate rows only, approved by a named person. Every object is strict, so a field the format does not name is rejected (422). The packet must be internally consistent: missing counts never read as zero (every month has its practice totals, every channel its spend row, every therapist its service and retention rows, and acquisition rows add up to the practice's new clients), therapist-specific spend stays within the channel's source spend, each retention row decomposes into retained, new, reactivated and transferred-in clients, the history starts no later than the report window, acquisition and service sources cover from the history start and every source covers what it feeds through the cutoff, a complete retention lookback is covered from 89 days before the opening snapshot, clients served are at least the clients new or active in the history, a cohort with no clients has no collections, and the approval follows every extraction. The packet's companyId must be the customer and its approval must not be in the future (422). Packets are immutable: sending the same bytes again returns the stored packet with created: false (200); a new packet returns 201. The current packet is the newest cutoff, then the newest approval, then the newest upload, so an older cutoff never replaces a newer one and a correction is a later approval of the same cutoff. Human sessions only: API keys are refused (403). Not gated by the customer's additionalMetrics list.

post/accountant/companies/{customerId}/practice-packets

Request

  • Base URL
    https://api.medianfi.com/api/v1
  • Auth
    HTTP bearer

Path parameters

customerId, string uuid required

Request body

PracticePacketV1 required

Practice packet format v1 (#1805). Aggregates only: money is integer cents in currency, counts are nonnegative integers, dates are YYYY-MM-DD and months YYYY-MM. Labels are reviewed display labels and carry the email and phone tripwires; no other free text is accepted. Every month has its practice totals, every channel its spend row and every therapist its service and retention rows; acquisition rows may be sparse (an absent therapist and channel pair is zero) because each month's rows must add up to the month's practice new clients.

formatVersion, 'practice-packet/v1' required
companyId, string uuid required
currency, string required

A supported two-decimal ISO 4217 code

timezone, string required

An IANA Area/Location time zone

reportWindow, object required

Inclusive whole months; end is the cutoff.

history, object required

The service-value window runs from start to the cutoff and must not start after the report window; complete claims full practice history, so no client may be active at an opening snapshot before start.

definitions, object required
sources, object[] required
approval, object required
reconciliation, object required
therapists, object[] required
channels, object[] required

At least one channel; a channel with no spend still sends its explicit zero spend row.

acquisition, object[] required

Actual new clients by month, first therapist and channel (unattributed when no channel is documented).

practiceAcquisition, object[] required
spend, object[] required

Approved channel spend per month (explicit 0 for none); direct is therapist-specific spend. The rest is split by acquired-client share.

serviceValue, object[] required
practiceServiceValue, object required
acquiredCohorts, object[] required
retention, object[] required
practiceRetention, object[] required
collectionsByMonth, object[]

#4967, optional: cash collections by payment month and serving therapist, processor overlap already removed (reconciliation.railOverlapRemovedCents); a refund counts in the month it is paid. Only in months every collections source (dateBasis payment_date) covers in full, from history.start through the cutoff; one row per therapist and month, an absent row is zero. Give it with practiceCollectionsByMonth.

practiceCollectionsByMonth, object[]

#4967, optional: the practice's row for every month the collections sources cover, equal to that month's therapist rows plus its payments tied to no clinician (median-ops #599). An absent unattributed amount is 0.

leadFunnel, PracticeLeadFunnel

#4964, optional (Lead's option A, bounded): lead-to-eight-sessions counts by lead month, as scripts/practice-lead-funnel-fragment.ts prints them from the refreshing person's de-identified export; aggregates only, no client-level row. cutoff is the packet's cutoff and coverage.sessionsThrough equals it. cohorts holds exactly the whole months that both the leads and the sessions coverage hold, through the cutoff, zeros included (at most 24). In each cohort the practice row is the therapist rows' sum, leads plus unassignedLeads; broughtClients covers the therapist rows' brought clients; sessions.attendedPaid covers the practice's firstCompletedPaid. In each therapist row (a roster key, once per month): firstBooked ≤ leads, firstCompletedPaid ≤ firstBooked, transferredIn ≤ firstCompletedPaid, milestoneEligible + milestonePending = firstCompletedPaid, reachedEight ≤ milestoneEligible. firstBooked, transferredIn, broughtClients, sessions.consults and sessions.booked are null when the export doesn't carry them (not covered, never 0; median-ops #599, #601); in a cohort such a field is null in the practice row and every therapist row, or in none, and the checks that use it are skipped. Every other count is a whole number.

Response

The same packet was already stored; nothing changed

PracticePacketReceiptResponse required
success, true required
data, object required

Changes

    • info

      the request property leadFunnel/cohorts/items/practice/transferredIn became nullable

    • info

      the request property leadFunnel/cohorts/items/therapists/items/allOf[#/components/schemas/LeadFunnelStage]/transferredIn became nullable

    • info

      added the new optional request property practiceCollectionsByMonth/items/unattributedGrossCollectionsCents

    7 more changes in this revision