Treatment billing quickstart

Add treatment billing

Submit professional service lines and add Requests for Authorization when your workflow needs them.

1. Get an API key

Create a sandbox organization in the developer console, then copy its key from API keys.

Server environment · .env.local
MINDBILL_API_KEY=your_sandbox_key\nAPP_ORIGIN=http://localhost:3000

For Next.js, create .env.local in the project root, alongside package.json, even if you use src/app. Use the exact name MINDBILL_API_KEY in both your environment and server code. Set APP_ORIGIN to your frontend’s exact origin, including its port. Restart your dev server after setting these values.

Keep the key on your server; do not add a NEXT_PUBLIC_ prefix or put it in Angular environment.ts. Use invented patient data in sandbox; sandbox submissions never reach payers.

Treatment billing must be enabled for your organization through the treatmentBilling capability. Contact partner support to enable it. An organization without access receives treatment_billing_not_enabled.

2. Choose your setup

Use the same libraries and authentication as med-legal billing. Complete the setup once, then return here.

Terminal
npm install @mindbill/react@0.73.0

Add the backend auth route for your signed-in users.

3. Add treatment service lines

Start with the patient, claim, provider, location, and diagnosis fields from the example bill as billInput. Set the billing mode and replace the med-legal lines with professional services.

Choose the mode explicitly: med_legal is the default medical-legal evaluation workflow with shared bill diagnoses. professional is treatment billing, where each procedure line selects its applicable diagnoses using one-based diagnosisPointers. Professional bills allow up to 12 diagnoses and up to four pointers per line. Review those selections instead of automatically copying every diagnosis to every procedure.

Treatment bill fields
const treatmentBill = {
  ...billInput, // Patient, claim, providers, location, and diagnoses.
  billingMode: "professional" as const,
  serviceLines: [{
    code: "99213",
    units: 1,
    charge: 150, // Total line charge, not a unit rate. Synthetic example.
    serviceDate: "2026-08-25",
    diagnosisPointers: [1],
    feeContext: {
      physicianContext: {
        providerKind: "physician" as const,
        placeOfService: "11",
        standaloneService: true,
        globalPeriodApplies: false,
        hpsaBonusEligible: false,
      },
    },
  }],
};

Every professional line needs an explicit total charge, not a unit rate. Schedule coverage depends on the service and date. The example assumes a California claim and one physician office visit with no related same-day services or global surgical package. Replace these facts with the actual encounter. Quote the complete encounter using the California fee calculator before submission. Bill charges use dollars; fee quotes use cents. The server rechecks lines with feeContext and rejects unresolved pricing with bill_fee_requires_review. An explicitly entered manual charge without fee context is not a verified statutory allowance. If a service relates to an RFA item, also include that item’s rfaItemId on its bill line.

4. Submit and track the bill

Pass treatmentBill to the entry form for review and document upload, or submit it from your server. Reuse saved providers, service locations, and W-9 settings; attach optional authorization or network records when appropriate.

TreatmentBill.tsx
"use client";
import { BillSubmissionForm, type BillSubmissionInput } from "@mindbill/react";

export default function TreatmentBill({ treatmentBill, treatmentBilling }: {
  treatmentBill: BillSubmissionInput;
  // Supply the organization capability from your authenticated backend.
  treatmentBilling: boolean;
}) {
  return <BillSubmissionForm
    initialBill={treatmentBill}
    treatmentBilling={treatmentBilling}
    sessionEndpoint="/api/mindbill/session"
    onSubmitted={({ billId }) => {
      window.location.href = "/billing/" + encodeURIComponent(billId);
    }}
  />;
}

For 97110, React 0.69.4 collects the actual therapy service facts before requesting an estimate. Preserve supplied context, include all same-day services, and keep unsupported cases in review. See therapy fields and calculation limits.

Pass the authorized organization capability as treatmentBilling; the prop does not grant server access. React 0.69.2 collects documented personal-performance, medical-direction, and monitored-care facts for anesthesia lines. Keep anesthesia service quantity at one and supply elapsed minutes separately. See anesthesia fields and server review.

Use the returned bill ID with the single-bill component or status API. Treatment bills use the same dashboard and lifecycle actions; show the actions available for each bill.

5. Add a Request for Authorization Optional

Request authorization for planned treatment separately from billing for services. React provides RfaDashboard for tracking, draft creation with supporting PDFs, authorized signing, packet review, explicit fax sending, and a task board for no-response follow-up and incoming utilization review responses, plus RfaDraftForm for a custom layout. Start with the RFA dashboard and complete workflow guide. Angular and other interfaces can use the RFA API.

Authorizations.tsx · React 0.73.0 or later
"use client";
import { RfaDashboard } from "@mindbill/react";

export default function Authorizations() {
  return <RfaDashboard
    sessionEndpoint="/api/mindbill/rfa-session"
    permissions={["create"]}
    environment="sandbox"
  />;
}
// Authenticate the user in your backend session endpoint.
// Grant an organization-wide session with rfas:read and rfas:create,
// restricted to your exact application origin, only to authorized users.

Click “New authorization request,” search for a saved patient claim and rendering physician, then review the treatment details and save. The dashboard loads the saved choices and saves the unsigned draft; no initialDraft or custom save handler is required. Users can return to the patient and physician selection without losing treatment edits.

The picker uses patient claims and rendering providers saved under your partner organization. To let authorized users add a patient and injury directly from this flow, enable canCreateClaim; the picker then offers “New patient and injury.” The default uses existing claims. Add rendering providers in billing settings. This workflow needs treatment access and an organization-wide browser session with rfas:read, rfas:create, and the exact authorized origin. Match the component's create permission to the user's actual access.

For a custom layout, RfaDraftForm remains available. Supply saved, authorized record IDs in initialDraft and implement saveDraft with POST /partner/v2/rfas, using the draft as the JSON body and a stable Idempotency-Key. Server requests need rfas:write; browser requests need rfas:create. Persist the returned data.id for subsequent updates.

Optional custom editor · NewRfa.tsx
"use client";
import { RfaDraftForm, type RfaDraftInput } from "@mindbill/react";

export default function NewRfa({ initialDraft, saveDraft }: {
  initialDraft: RfaDraftInput;
  saveDraft: (draft: RfaDraftInput) => Promise<void>;
}) {
  return <RfaDraftForm initialDraft={initialDraft} onSave={saveDraft} />;
}
Custom editor starting draft · replace IDs from your organization
const initialDraft = {
  claimId: "YOUR_SAVED_CLAIM_ID",
  patientId: "YOUR_MATCHING_PATIENT_ID",
  renderingProviderId: "YOUR_SAVED_RENDERING_PROVIDER_ID",
  employeeName: "Taylor Example",
  providerName: "Avery Example, MD",
  items: [{
    diagnosisCode: "M25.512",
    serviceDescription: "Requested treatment for the left shoulder",
  }],
};

Saving this form does not sign or send the RFA. Keep review, signing, and transmission as separate explicit steps. See the RFA API contract for the full workflow.

Verify the workflow with synthetic data in sandbox before requesting live access.