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

# DrChrono Find Charge

> Native DrChrono EOB-to-charge matching tool exposed through the Agents Platform.

This document covers `drchrono_find_charge`, the native DrChrono EOB-to-charge matching tool exposed through the Agents Platform.

## Authentication

DrChrono tools use the DrChrono OAuth connector. The platform injects:

* `access_token`

The token is minted and refreshed by the integration service.

Tools do not accept raw DrChrono API keys, Nanonets API keys, webhook URLs, or caller-supplied token-fetch endpoints in their input schema.

## `drchrono_find_charge`

Matches an EOB line item to a DrChrono billing line item by patient name, date of service, and procedure code. This is a read-only lookup tool. It does not post payments and does not mutate Nanonets document fields.

### Inputs

Required:

* `patient_name`: Patient name from the EOB line item, such as `Jane Smith`, `Smith, Jane`, or `SMITH JANE`.
* `date_of_service`: Date of service. Prefer `YYYY-MM-DD`; `MM/DD/YYYY` is also accepted.
* `procedure_code`: Procedure/CPT code to match. Modifiers are allowed; matching uses the base CPT, so `99213 25` matches `99213`.

Optional:

* `insurance_name`: Insurance name from the EOB. Used only for deterministic matching against DrChrono appointment insurance.
* `check_number`: Check or trace number from the EOB. Used to detect if the payment was already posted.
* `max_patients`: Defaults to `10`. Maximum patient candidates to inspect.
* `max_line_items`: Defaults to `50`. Maximum line items to inspect per patient.
* `max_transactions`: Defaults to `50`. Maximum transactions to inspect for the matched line item.

### Matching Behavior

The tool:

* generates common patient-name candidates, including EOB-style last-first names,
* searches DrChrono patients by first and last name,
* fetches line items for the patient and service date,
* matches by exact service date and base CPT code,
* enriches the match with doctor, appointment insurance, and transaction data,
* normalizes `check_number` and transaction `trace_number` for duplicate-check detection,
* returns deterministic insurance candidates and match confidence without calling an LLM.

### Output

On success, structured content includes:

* `found: true`
* `patient`: matched DrChrono patient summary
* `match`: EHR charge, balance, provider, carrier, duplicate-check, and status fields
* `payment_input`: forward-compatible data for a future payment-posting tool

Example shape:

```json theme={null}
{
  "found": true,
  "patient": {
    "id": "123",
    "first_name": "Jane",
    "last_name": "Smith"
  },
  "match": {
    "ehr_charge_id": "456",
    "ehr_patient_id": "123",
    "ehr_visit_id": "789",
    "date_of_service": "2026-05-01",
    "ehr_cpt_code": "99213",
    "ehr_charge_amount": "100.00",
    "ehr_insurance_balance": "70.00",
    "ehr_patient_balance": "30.00",
    "ehr_carrier": "Acme Health",
    "already_posted": false,
    "insurance_match_confidence": "exact"
  },
  "payment_input": {
    "patient_id": "123",
    "line_item_id": "456",
    "appointment_id": "789",
    "carrier_id": "PAYER1",
    "carrier_name": "Acme Health",
    "ehr_insurance_balance": "70.00",
    "ehr_patient_balance": "30.00",
    "already_posted": false
  }
}
```

Common failure reasons:

* `drchrono_not_connected`: DrChrono is not connected. The agent should ask the user to either connect DrChrono and try again, or stop the task.
* `patient_not_found`: no DrChrono patient matched the supplied name candidates.
* `charge_not_found`: patients were found, but no line item matched the date of service and procedure code.
* `ambiguous_insurance`: a charge was found, but the supplied insurance name could not be deterministically matched to multiple DrChrono insurance candidates.

## Agent Instruction Guidance

Recommended EOB workflow:

```text theme={null}
1. For each EOB line item, call DrChrono: Find charge with:
   - patient_name from the EOB line item
   - date_of_service from the EOB line item
   - procedure_code from the EOB line item
   - insurance_name if available
   - check_number if available

2. If reason is drchrono_not_connected, use Ask User with only these options:
   - Connect DrChrono and try again
   - Stop task

3. If already_posted is true, do not route the line item to payment posting without human review.

4. If the result reason is patient_not_found, charge_not_found, or ambiguous_insurance, ask for review rather than guessing.
```

Payment posting is intentionally separate. A future DrChrono payment-posting tool should consume `payment_input` after review.
