# List models Source: https://docs.perfectreferral.com/api-reference/model/list-models https://api.perfectreferral.com/v1/openapi.yml get /models Returns a listing of available model versions per model. # Get practitioner location by id Source: https://docs.perfectreferral.com/api-reference/practitioner-location/get-practitioner-location-by-id https://api.perfectreferral.com/v1/openapi.yml get /practitioner-locations/{id} Returns detailed information about a single practitioner location, including the sources that report that the practitioner practices at this location. Returns detailed information about a single practitioner location, identified by the `id` returned in the `locations` array of the [Get practitioner by NPI number](/api-reference/practitioner/get-practitioner-by-npi-number) endpoint. The response includes: * **Address**: the street address, city, state, and postal code for the location * **Geocoding**: coordinates for the location's address, when available * **Stale affiliation risk**: our estimate of whether the practitioner is actually seeing patients at this location — see the [stale location methodology](/methodology/stale-location) * **Bookability**: our estimate of whether a patient can book an appointment with the practitioner at this location — see the [stale location methodology](/methodology/stale-location) * **Sources**: each dataset that reports that the practitioner practices at this location, with its version and the date of the pipeline run that produced it Geocoding data is provided in part by OpenStreetMap. © OpenStreetMap contributors, available under the [Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/). Additional data is derived from the U.S. Census Bureau TIGER/Line® Shapefiles (public domain), from other public sources, and from commercial sources, such as Geocodio. # Get practitioner by NPI number Source: https://docs.perfectreferral.com/api-reference/practitioner/get-practitioner-by-npi-number https://api.perfectreferral.com/v1/openapi.yml get /practitioners/{npiNumber} Returns information about the practitioner associated with the provided NPI number. Returns information about the practitioner associated with the provided NPI number. The response includes: * **Specialties**: reported by NPPES * **Referral scope matches**: our estimate of whether the provider is an appropriate candidate for a routine referral for a specific performable or procedure — see the [referral scope match methodology](/methodology/referral-scope-match) * **Practice locations**: reported by CMS National Provider Database, Doctors and Clinicians National Downloadable File, NPPES, and public health plan network directories * **Geocoding**: coordinates for the location's address, when available * **Stale affiliation risk**: our estimate of whether the practitioner is actually seeing patients at this location — see the [stale location methodology](/methodology/stale-location) * **Bookability**: our estimate of whether a patient can book an appointment with the practitioner at this location — see the [stale location methodology](/methodology/stale-location) A non-match (`unlikely_match` or `very_unlikely_match`) means a routine referral target does not fit the provider's observed billing. It does not mean the service is outside their scope of practice or that they are unqualified; it reflects what they routinely bill, not what they are licensed or trained to do. This endpoint serves individual practitioners (NPI-1) only. Geocoding data is provided in part by OpenStreetMap. © OpenStreetMap contributors, available under the [Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/). Additional data is derived from the U.S. Census Bureau TIGER/Line® Shapefiles (public domain), from other public sources, and from commercial sources, such as Geocodio. # Find best-fit practitioners nearby Source: https://docs.perfectreferral.com/api-reference/search/find-best-fit-practitioners-nearby https://api.perfectreferral.com/v1/openapi.yml get /search-by-target Returns nearby practitioners, ranked by how good a fit they are for a given referral target. Returns nearby practitioners, ranked by how good a fit they are for a given referral target. Each result pairs a practitioner with one of their practice locations: * **Practitioner**: name, NPI number, and `referralScopeMatch`, our estimate of whether their billing history fits the referral target * **Location**: address and coordinates, `staleAffiliationRisk`, our estimate of whether they are still seeing patients there, and `bookability`, our estimate of whether an appointment can be booked there * **Distance**: straight-line (not driving) miles from the coordinates you searched * **Score**: from 0 to 100, how good a fit this practitioner, at this location, is for the referral you searched; higher is better ## Ranking `score` combines fit (`referralScopeMatch`), distance, and whether an appointment can be booked at the location (`bookability`). Ties are broken consistently, so repeating a search returns the same order. Results are not filtered by fit: poor fits are still returned, ranked below better ones. Filter on `practitioner.referralScopeMatch` if you only want likely matches. Scores are on a fixed scale, so they can be compared across searches that report the same `servedModels`. When `servedModels` has no `practitionerLocationRisk`, scores are computed without a bookability adjustment and locations omit both `staleAffiliationRisk` and `bookability`. Locations without a `bookability` label, such as those of practitioners the model does not cover, receive no adjustment. ## Pagination When more results are available, the response includes `nextCursor`. To get the next page, repeat the request with `cursor` set to that value. Stop when `nextCursor` is absent. A cursor is only valid for the search that produced it: changing any other parameter returns a `400`. A non-match (`unlikely_match` or `very_unlikely_match`) means a routine referral target does not fit the provider's observed billing. It does not mean the service is outside their scope of practice or that they are unqualified; it reflects what they routinely bill, not what they are licensed or trained to do. Geocoding data is provided in part by OpenStreetMap. © OpenStreetMap contributors, available under the [Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/). Additional data is derived from the U.S. Census Bureau TIGER/Line® Shapefiles (public domain), from other public sources, and from commercial sources, such as Geocodio. # List specializations Source: https://docs.perfectreferral.com/api-reference/specialization/list-specializations https://api.perfectreferral.com/v1/openapi.yml get /specializations Returns a list of supported specializations # List targets for a given specialization Source: https://docs.perfectreferral.com/api-reference/specialization/list-targets-for-a-given-specialization https://api.perfectreferral.com/v1/openapi.yml get /specializations/{id}/targets Returns a list of supported targets for a given specialization # Perfect Referral API Source: https://docs.perfectreferral.com/index Provider intelligence built for referrals from real-world evidence. A referral is a medical decision. The Perfect Referral API helps you make the right one. Our models address the practical questions that determine if a referral succeeds, from whether a provider's scope actually matches a referral need to whether they still practice at their listed location today. Every answer is derived from public evidence, such as billing data, with a confidence label attached, transparent methodology, and documented limitations so you always know how much to trust it. If you are not sure where to begin, start with the Quickstart. It walks you from an API key to your first prediction in a few minutes. Get an API key and make your first call. Start here if you want something working fast. Every endpoint, parameter, and response field, with an interactive runner to try requests using your API token. For each model, how we derive labels, how we validate them, and when we don’t have enough confidence to make a call. ## Get help Questions, or something that does not look right? We want to hear it. For general questions, reach us at [support@threshold.health](mailto:support@threshold.health); to flag something that looks wrong, email [corrections@threshold.health](mailto:corrections@threshold.health). See [Methodology & limitations](/methodology) for how each model works and where its limits are. # Address Normalization & Geocoding Source: https://docs.perfectreferral.com/methodology/address-normalization From street abbreviations to formatting errors, addresses are messy. The same address can appear in several forms, splitting the evidence that a practitioner works at that location. To address this, we normalize addresses to help silence some of the noise and improve our estimations. Every address in the API is reformatted to United States Postal Service (USPS) standards before you receive it. The raw text from the underlying source is rewritten into one consistent form, so the same location is spelled the same way no matter which source it came from. The same building otherwise arrives spelled many ways: `123 Park Center Dr., Suite 400`, `123 PARK CTR DRIVE STE 400`, `123 Park Ctr Dr #400`. Normalization collapses these to a single form. ## The standard: USPS Publication 28 Addresses are normalized to **USPS Publication 28, *Postal Addressing Standards*** — the standard the Postal Service uses to define a mailable address. In practice: | Rule | Effect | Example | | :- | :- | :- | | Uppercase & punctuation | Capitalized, punctuation removed | `Park Ctr Dr.` → `PARK CTR DR` | | Street suffixes (App. C1) | Standardized abbreviation | `AVENUE`, `AV`, `AVNUE` → `AVE` | | Unit designators (App. C2) | Standardized abbreviation | `SUITE` → `STE`, `FLOOR` → `FL` | | Directionals | Compass words abbreviated | `NORTH MAIN` → `N MAIN` | | ZIP | Reduced to five digits | `75081-1234` → `75081` | We use the full USPS C1/C2 tables, so any spelling a source uses (`DRV`, `BOULEVARD`, `AVNUE`) lands on the standard form. ## How it works The street line is parsed by [libpostal](https://github.com/openvenues/libpostal), an open-source address parser, into components - house number, street, unit, PO box - which are then rewritten per Pub 28 and reassembled. Only the street line is parsed; **city, state, and ZIP come straight from the source's own fields** and are trusted as written (re-parsing them would mistake a suite for a ZIP, or shorten `LONG ISLAND CITY` to `CITY`). The fields we include in API responses: | Field | Contents | | :- | :- | | `line1` | House number + street, or the PO box (`943 PINE LOG RD`) | | `line2` | Secondary unit, if any (`STE 400`) | | `city`, `state` | As the source states them, upper-cased | | `postalCode` | Five-digit ZIP | ## Geocoding annotations To ensure consistent and accurate location data, our geocoding methodology uses a prioritized, three-tiered hierarchy. We first utilize any coordinates native to the dataset, such as those from the CMS National Provider Directory. If that source is unavailable, we fall back to a self-hosted Nominatim instance, which leverages OpenStreetMap and U.S. Census TIGER/Line data. Finally, for any addresses not resolved by the first two sources, we use Geocodio as a commercial service, which operates its own geocoding engine assembled from a large number of public and government datasets. Positional accuracy is not uniform across the three tiers, and the precision of any given coordinate depends on which tier produced it. Rooftop matches, where the coordinate corresponds to the actual structure, cover roughly 70 percent of a typical evenly distributed U.S. address sample, with about 20 percent resolving to street-range interpolation, which estimates a position along a street segment rather than locating the building. The remainder fall back to coarser results such as city or ZIP centroids. Suite and floor are not resolved: a provider in a multi-tenant medical office building geocodes to the building, not the practice. ## Limitations Normalization is a best-effort process running on messy real-world data: * **We reformat, we don't correct.** A typo in the source is a typo in the output. * **Unusual addresses can be mislabeled.** Grid-style numbers, Puerto Rico forms, or run-together tokens can occasionally cause a token in `line1` to be misplaced. * **`city` is passed through untouched**, not standardized (no `SAINT`/`ST` folding, no abbreviation expansion). * **Not validated against USPS's database.** "USPS-conformant" means conformant to the *text* of Pub 28, not checked against the USPS Address Management System. We cannot confirm an address is deliverable, or that a city and ZIP are consistent. # Motivation & approach Source: https://docs.perfectreferral.com/methodology/index A referral is a medical decision, but the tools meant to support it often fall short. The shallow decision trees and the incomplete, inaccurate directories that should point a patient toward the right provider too often point them toward the wrong one: someone who doesn't perform the procedure, doesn't take the plan, or can't see them for months. In our own work, we've found that roughly 70% of referral obstacles could have been prevented with better information available at the moment the referral was made. That's the root cause we're after. The information that prevents those obstacles is diverse: what a provider actually does, where they actually practice, what patients actually experience, whether they can actually be seen. So we're building it one domain at a time. ## Grounded in practice, not principle Our models exist to improve referrals for patients, and that purpose defines their boundaries. We are not trying to describe what could be true in principle based on a license, training, or registration. We are trying to estimate what is true in practice at the moment a referral is made. That means grounding each model in observed behavior and other real-world evidence, then defining its output around a concrete referral decision. E.g. a retina specialist is an ophthalmologist, and in principle is capable of cataract surgery; in practice, a routine cataract referral does not belong with them. Our methods are built to capture the second judgment, not the first. That framing also means we will sometimes not know the answer. The available evidence may be incomplete or conflicting. Where that uncertainty exists, we say so rather than guess. ## The models Each model page details its methodological approach, validation, and known limitations. Click into any model to learn more. Open beta Routine referral categories matched to what a provider actually does, derived from observed practice patterns. Open beta Whether a practitioner is actually seeing patients at a location, and whether a patient can book an appointment with them there. Closed beta How soon a provider can be seen at a specific location. In development What patients actually report about access and experience. In development Likelihood that a provider will still be in network in the next 90 days. Coming soon We're building toward every piece of information that prevents a referral obstacle. Tell us what would help most. # Referral Scope Match Source: https://docs.perfectreferral.com/methodology/referral-scope-match ## What this model answers When a provider refers a patient, the question is not whether a specialist *could*, in principle, be a match for a referral. It is whether they are an appropriate match in practice. This model reveals whether a specialist's billing data indicates they're a good destination for a given kind of **routine** referral. We work from what specialists bill, not from what their license or self-reported specialty permits. A specialist's billing record is the most direct, large-scale evidence of the work they actually perform, and it's what these predictions are built on. ## How to read a label For each specialty and each *routine* referral target to that specialty (such as "colonoscopy" or "retina"), the model emits one of six labels. | Label | Meaning | | :- | :- | | `very_likely_match` | The billing profile strongly indicates a match for this routine referral target. | | `likely_match` | The billing profile indicates a match for this routine referral target. | | `uncertain` | The provider is evaluable, but the evidence meets neither the match nor the no-match predictive threshold. | | `unlikely_match` | The billing profile indicates this is not a match for this routine referral target. | | `very_unlikely_match` | The billing profile strongly indicates this is not a match for this routine referral target. | | `insufficient_data` | Not enough billing data to evaluate. | The predictive value of a label for a target is calibrated against an even sampling of held-out providers in the target's specialty. A `very_likely_*` label carries at least a 95% predictive value, and a `likely_*`/`unlikely_*` label at least an 80% predictive value. Neither `uncertain` nor `insufficient_data` is a negative signal, and you can treat both as "not confident calls." They are not the same finding, though: `uncertain` means we could see the provider clearly and the evidence was genuinely mixed; `insufficient_data` means we could not see enough of the provider to judge at all — including providers with no observed billing in any channel in the most recent data year. Every provider in a covered specialty receives a label for every predicted target, so a provider we cannot see is reported as such, never silently skipped. Label distribution for ophthalmologists against the "Cataract evaluation and surgery" referral target. Label distribution for ophthalmologists against the "Cataract evaluation and surgery" referral target. ## Where the signal comes from Every prediction this model produces is computed from public data: * **Medicare Physician & Other Practitioners** data ([CMS](https://data.cms.gov/provider-summary-by-type-of-service/medicare-physician-other-practitioners/medicare-physician-other-practitioners-by-provider-and-service)), for per-provider, per-procedure billing. * **Medicaid T-MSIS** ([HHS](https://opendata.hhs.gov/datasets/medicaid-provider-spending/)), as a second, separate payer channel. * **Medicare Part D Prescribers** ([CMS](https://data.cms.gov/provider-summary-by-type-of-service/medicare-part-d-prescribers/medicare-part-d-prescribers-by-provider-and-drug)), for per-provider prescription fills, as a third channel. Because this includes fills under Medicare Advantage drug plans, it also gives a first, partial view of providers whose medical claims are otherwise invisible to us. * **NPPES**, the national provider registry, which defines each specialty cohort. Some notes on the data: * Medicare claims, Medicaid claims, and prescription fills cover structurally different populations, so we keep the channels side by side and never add a count from one to another. An absent channel means "no data here," not "this provider does not see those patients." * We only label people, not group practices. Organization records are excluded because a group's billing is an aggregate of many providers rather than a referable person. * Public billing data suppresses small counts, so a missing code may have been performed and withheld for privacy rather than never performed. We never read a missing code as a negative without first confirming the provider is observed heavily enough for that absence to mean something. * We do not consider the dollar amount of services. Payment amounts encode billing and site-of-service mix, not clinical focus, so we stick to patient and service counts in each provider's own mix of procedures. ## How we turn billing into predictions **Tools.** We use frontier LLMs to handle the clinical ontology, reviewed by our Chief Medical Officer: identifying referral targets, defining subspecialty workflows, and characterizing provider billing profiles. However, LLMs do not calculate magnitudes. Every weight, threshold, and prediction in the model is calculated via deterministic analytics on claims data to maintain repeatability and explainability. **Clinical context.** Our objective is to help match routine referrals to the specialists who are genuinely the right fit. A patient who needs diabetic retinopathy screening, for instance, should reach a general ophthalmologist, not a retina surgeon. This guiding application affects the scope, training, evaluation, and interpretation of this model: 1. **Target definitions.** We identify typical referral reasons per specialty; these include focus areas, common procedures, and a catch-all "generalist" target for every specialty. 2. **Provider matching.** Under the clinical context defined above, we leverage frontier LLMs to reason about which providers are appropriate for each target based on their billing fingerprints. This was sanity-checked by our Chief Medical Officer. 3. **Training and calibration.** We use machine learning to identify billing signatures that deterministically recapitulate the LLM-driven provider matching step. This converts potentially inconsistent LLM judgments into robust and explainable predictions. This step sometimes fails to produce a performant model. Read more about limitations below. Diagram of the referral scope match methodology. Diagram of the referral scope match methodology. ## Why we sometimes only rule targets out Not every referral target can be answered in both directions. For many routine referral targets, billing data can confidently rule a provider out as a poor fit, but cannot reliably rule them in. When that is the case, we make it clear (the `rule_out_only` field in the endpoint response). Whether a target can be ruled in at all is determined empirically, from the data, not decided by hand. To understand why, consider the ongoing management of dementia. A memory-focused practice does leave billing traces, like cognitive assessments and the medications used to slow decline. But none of these belong to dementia care alone: general neurologists, and often primary care physicians, bill the same assessments and prescribe the same drugs. Because the codes recur so broadly, a heavy share of them cannot separate the neurologists who concentrate on memory care from those who touch it occasionally, so the evidence cannot rule in. The reverse is firmer: a neurologist who bills none of this footprint can be confidently set aside, because a genuine memory practice does not leave that whole footprint empty. The signal rules out, but it cannot rule in, and no additional modeling recovers a positive trace that the claims never recorded. Two ROC curves: an affirm-capable target and a rule-out-only target, colored by the label at each operating threshold. Two ROC curves: an affirm-capable target and a rule-out-only target, colored by the label at each operating threshold. ## How we calibrate We set the thresholds so that, on a uniform sample drawn to represent the target specialty population, a `likely_match` call matches the LLM reasoning at least 80% of the time and a `very_likely_match` call at least 95% of the time. The rule-out thresholds are set the same way against the same bar, so an `unlikely_match` or `very_unlikely_match` call carries the matching guarantee on the exclusion side. Each label must clear its bar with a statistical lower bound, not just a point estimate. That bound also prices in the measured run-to-run variability of the LLM reasoning step: borderline judgments can flip on a re-run, and a label's guarantee has to survive that noise. A label that cannot hold its claim is folded into a stricter neighbor or withheld rather than shipped. When a target model does not reach a minimum performance or positive/negative predictive performance, it is omitted and recorded as omitted, with the reason. ## Ongoing validation Predicting scope of practice from billing data isn't new, but using it to judge routine referral fit is. We're still learning where these predictions are strong and where they're weak. We treat validation as ongoing rather than a one-time gate: as our reference data grows and as users surface corrections, we re-examine each target and revise or retire it when the evidence no longer backs the call. Three checks anchor this work. First, before a release, we re-test every shipped label against a fresh sample of providers that played no part in training or calibration. A label that fails this check is weakened or retired; it is never quietly kept. The same mechanism works in the other direction: a target that showed promise but had too few validation providers can earn its label through a dedicated, one-time confirmation sample. Second, we perform clinical-consistency reviews to ask whether a target's predictions cohere with independent clinical expectations: do the specialists we rule in and rule out match how the specialty actually refers? We also inspect the clinical validity of the weights assigned to billing codes during machine learning. Third, when possible, we interrogate the observed-versus-expected (O/E) enrichment of providers' self-attested subspecialties against our predictions when there is a strong match with a specific referral target. Observed-versus-expected enrichment of self-attested Retina specialists across prediction labels for the medical and surgical retinal care referral target. Observed-versus-expected enrichment of self-attested Retina specialists across prediction labels for the medical and surgical retinal care referral target. ## Other limitations **Some referral targets are billing-invisible.** Some care is delivered almost entirely through office visits and routine lab work that carry no distinctive claims signature. Much of benign hematology looks this way: an anemia or iron-deficiency workup is evaluation and lab interpretation, and the providers who do it do not look different in claims from those who do not. We label such targets as omitted and make no predictions for them, rather than guess. **Referral targets may change.** Though we'll do our best to keep the API stable, methodological improvements may mean we change target definitions where appropriate. **Not all specialties are present.** We focus on the most common specialties that patients are referred to in an ambulatory setting: ophthalmology, gastroenterology, cardiology, orthopedics, dermatology, otolaryngology, urology, neurology, and hematology-oncology. Let us know if there's a specialty you're eager to see included in the next release. **Billing data is incomplete and dated.** Predictions are based on billing from 2024, with the two prior years used to judge whether a provider is observed well enough to evaluate at all. The data reflects care provided to traditional Medicare and Medicaid patients, plus prescriptions filled under Medicare drug plans (including Medicare Advantage drug plans); medical claims under Medicare Advantage and commercial insurance are not visible. A provider may provide significantly different care to other populations, may have changed their scope of practice, or may provide services not reflected in billing data (for example, cash pay). Want more recent data, or to augment predictions with your own dataset? Reach out to learn more. **Providers work in teams.** This model currently makes predictions about individual providers. In reality, patients are referred to specialty clinics with many providers. Future models will connect this work to location and affiliation predictions. Did you find an error or limitation? Please let us know by reaching out to [corrections@threshold.health](mailto:corrections@threshold.health). ## What this model is not This model reports a destination-fit signal. It is not a credentialing, licensure, or privileging source, and it does not assert what a provider is qualified or permitted to do. It reflects observed Medicare, Medicaid, and prescription billing, so a provider who practices primarily under commercial insurance, or who is newly in practice, may be observed too thinly to judge. That is precisely what the `insufficient_data` label is for. The referring clinician's judgment remains the decision. Our aim is to make that decision better informed at the moment it is made, not to replace it. # Stale Affiliation Risk & Bookability Source: https://docs.perfectreferral.com/methodology/stale-location ## What this model answers Patients are often referred to providers based on which clinic locations are closest to the patient's home. Provider directories are notoriously stale. Clinicians move, retire, consolidate into new groups, or shift to telehealth, and the directories that list them lag behind by months or years. And even a current listing is not always a place a patient can go: many physicians practice at addresses where no one can book them. This model answers two deliberately narrow questions about each practitioner–address pair: * **Stale affiliation risk** (`staleAffiliationRisk`): **is this practitioner actually seeing patients at this address, right now?** This can include stale addresses, or addresses that were never a place patients could go at all, such as mailing hubs and billing offices. * **Bookability** (`bookability`): **can a patient book an appointment with this practitioner at this address?** A practitioner can be seeing patients at an address that is still not a place to book them: an emergency physician or hospitalist working in a hospital, a surgeon who operates at a hospital but sees consults at a clinic across town, a radiologist reading studies. Bookability does not tell you whether the practitioner is accepting new patients, takes a given plan, or how soon they can be seen. Both answers come from a single model, so they never contradict each other: a location is never rated more bookable than it is active. We generate predictions for physicians (MD and DO) at every address asserted for them by at least one current public source: [Medicare billing files](https://data.cms.gov/provider-data/dataset/mj5m-pzi6#data-table), the aggregated [national provider directory](https://directory.cms.gov/), [NPPES](https://www.cms.gov/medicare/regulations-guidance/administrative-simplification/data-dissemination), and public health plan network directories. Other practitioner types (such as nurse practitioners, physician assistants, and behavioral health clinicians) and physicians in training are not yet covered; their locations are returned without either label. Among physician listings in these sources, **only about 30% are places where the physician is currently seeing patients, and fewer than one in five are places a patient could book them.** ## How to read a label Every covered practitioner–address pair receives one label for each question. Each label stands for a fixed range of probability, and we measure how often each label is right on randomly sampled, independently verified listings. A label is only assigned when the measured rate, including its uncertainty, sits inside the label's range. | `staleAffiliationRisk` | Range | Measured: practitioner seeing patients here | Share of our listings | | :- | :- | :- | :- | | `very_likely_active` | 85–100% | 92% | 4% | | `likely_active` | 65–85% | 76% | 9% | | `uncertain` | 35–65% | 49% | 22% | | `likely_inactive` | 15–35% | 21% | 41% | | `very_likely_inactive` | 0–15% | 5% | 24% | | `bookability` | Range | Measured: appointment can be booked here | Share of our listings | | :- | :- | :- | :- | | `very_likely_bookable` | 85–100% | 95% | 3% | | `likely_bookable` | 65–85% | 74% | 5% | | `uncertain` | 35–65% | 46% | 10% | | `likely_not_bookable` | 15–35% | 19% | 17% | | `very_likely_not_bookable` | 0–15% | 4% | 65% | `uncertain` is not a negative signal; it means the evidence supports neither call. These rates are measured across our national set of physician listings. In another directory, such as a health plan's own directory, the mix of listings is different: the order of the labels holds, but the rates shift with that directory's baseline. In one plan directory we tested, listings were active more often than the national rates would suggest. To put exact numbers on your own directory, verify a small random sample of it against the labels. Reach out if you'd like help. ## Where the signal comes from All model inputs are public data. * **Medicare's public clinician files, released monthly.** Each monthly release asserts where clinicians are practicing based on recent billing. More than three years of releases provide a month-by-month presence history for every NPI-address pair, including millions of *observed departures*. These files have several limitations: they only cover clinicians who bill Medicare under their own identity, they lag real events by several months, and roughly one pair in ten that disappears from a release later reappears. * **Medicare utilization summaries.** What a clinician bills (office visits versus hospital visits, procedures performed in facilities, telehealth-only services) says a great deal about whether any of their addresses is a place patients book. * **The national provider registry (NPPES) and related enrollment and licensure data.** Deactivations, license states, practice and mailing addresses, specialty self-descriptions and the shape of the registry record itself: how a building is used across all clinicians registered there, how old the record is, how the clinician attests to it. Registry agreement is weak evidence, but *contradictions* — such as a deactivated identifier, an address that thousands of clinicians use only for mail, a location on the other side of the country — can provide strong evidence. * **Public health plan network directories.** Marketplace plan directories and state Medicaid network filings: which plans list a practitioner at an address, for how long, and whether they flag the listing as telehealth. These are what payers *assert*, so we treat them as signals, never as confirmation. * **Additional public disclosures and geography.** Public payment disclosures with dated addresses, how far an address is from where the clinician bills, and how a building is shared among clinicians. Though these data sources are individually weak, together they reveal how many *independent* sources currently place a practitioner at a location. We are careful about leakage between time stamps and between datasets. Many directories buy from the same upstream vendors, so we make sure we're not double-counting corroboration. ## Model development **1. Billing-history models.** From the monthly billing histories we train two models: one estimating whether a practitioner has *already left* an address, one estimating whether a currently-present pair is *about to go absent*. Their training labels are observed departures from three years of monthly snapshots, so they learn from millions of examples. Both see only public, time-stamped features, and their scores become inputs to the next step. **2. Location outcome model.** A single model, trained on independently verified practitioner–location pairs (see below), estimates what each listing actually is: * a place where patients book appointments with the practitioner; * a procedure site, such as an operating room or surgery center, where the practitioner performs procedures that are booked elsewhere; * a place where the practitioner works but patients cannot book them, such as an emergency department or inpatient unit; * a place the practitioner has left, or never practiced; * an address that is not a care site at all, such as a billing office or mailing address. Stale affiliation risk is the probability of the first three outcomes combined; bookability is the probability of the first. **3. Labels and measurement.** Each probability is converted to one of the five labels using the fixed ranges above. We then measure every label's actual rate on randomly sampled verified listings that were not used to make that prediction, and confirm the rates on a fresh random sample before each release. Two kinds of listing are labeled by rule rather than by the model: * **Inpatient specialties.** Physicians whose specialty is practiced inside hospitals — hospitalists, emergency physicians, anesthesiologists, critical care physicians, and radiologists and pathologists without an office practice — are labeled `very_likely_not_bookable`. When we checked, about 1% of these listings were bookable. * **Deactivated identifiers.** Practitioners whose NPI has been deactivated (confirmed against the live registry) are labeled `very_likely_inactive` and `very_likely_not_bookable`. On verified random listings, the model separates active from inactive listings with an AUC of 0.84, and bookable from not bookable with an AUC of 0.89. On the same listings, our previous stale-location model scored 0.70. ## How we generate labels to verify and calibrate the model We use agents to research thousands of randomly sampled practitioner–address pairs. These agents search the places where care is actually delivered and announced: the practice's and health system's own websites and staff rosters, hospital rosters, state license records, news and announcements. Directory aggregators and reseller sites often copy the same stale registry data, so they never count as strong evidence on their own. Prompts are blinded to the model score and ask agents to report all evidence for and against the listing, then decide what the address is for this practitioner (one of the outcomes above) and whether an appointment can be booked there. A second, blind read of the same listing agrees more than 95% of the time. About three in four randomly sampled listings can be decided with confidence; listings that can't be decided are left out rather than guessed. This approach is not scalable to millions of practitioner–location pairs, which is why we train a model on it. Examples of agentic outputs: **1. A clear departure**: sleep medicine physician, Texas. ```text wrap theme={null} Outcome: no longer practices here · seeing patients here: no · bookable here: no · confidence: high Evidence chain: federal registry API (record active; a different address in another city) → the physician's own practice website (medical director of the tested practice until 2023; now practicing mainly by telemedicine from another city) → the tested practice's own website (a leftover follow-up form under the physician's name) → aggregator and reseller listings (still placing the physician at the tested address; stale, not used to decide). Reviewer's notes (excerpt): "[The physician's] own site states [they were the tested practice's] medical director 2020-2023 and left … [The practice's] site still links a '[physician's name] follow-up form' as a leftover, and MapQuest/reseller listings still put [them] at [the tested address]; both are stale." ``` **2. Right practice, wrong clinician**: neurologist, Kentucky. ```text wrap theme={null} Outcome: never practiced here (wrong identifier) · seeing patients here: no · bookable here: no · confidence: high Evidence chain: federal registry (this identifier's own record: both addresses in a different state) → a physician-claimed professional network profile (same different state) → an independent roster of the clinicians actually practicing at the tested address (a real neurology practice — he is not among them). Reviewer's reasoning (excerpt): "A real neurology/rehab practice operates at the tested address, but every independent source ties this specific identifier to a practice group two states away. A same-named neurologist elsewhere in the tested state appears to be an unrelated provider, not this identifier." — the same-name trap, resolved rather than fallen into. ``` **3. Seeing patients, but not bookable**: urologic surgeon, Missouri. ```text wrap theme={null} Outcome: procedure site · seeing patients here: yes · bookable here: no · confidence: high Evidence chain: federal registry API (an outpatient address on the same academic campus) → the physician group's own profile (appointments at three outpatient clinic buildings; inpatient care at the tested hospital) → the health system's own profile (same hospital affiliations) → the university's announcement naming the physician chief of urologic surgery. Reviewer's notes (excerpt): "[The tested address] is [the hospital] itself, where this urologic surgeon operates (robotic prostatectomy/nephrectomy) and has inpatient privileges; [their] bookable consult clinics are in other buildings." ``` **4. Bookable, but not taking new patients**: family physician, Wisconsin. ```text wrap theme={null} Outcome: bookable office · seeing patients here: yes · bookable here: yes · confidence: high Evidence chain: federal registry API (the tested address; circular, not counted) → the health system's own provider profile (names the clinic at the tested address; "Schedule an Appointment"; not currently accepting new patients) → an independent physician directory (same office). Reviewer's notes (excerpt): "Own [health system] profile lists [the tested] clinic as [their] location with appointment scheduling; not accepting new patients (does not change [bookability])." ``` ## Missing addresses We currently host predictions for \~1-2 unique addresses per NPI, but there are many addresses in other directories (such as a health plan's own directory) that we do not provide predictions for. We can generate predictions for addresses outside the scope of what is pre-computed. Reach out to learn more. ## Ongoing updates Directories decay continuously: practitioners leave, retire, and change how they practice every month. As our input sources publish new releases, we regenerate our predictions and re-measure every label against a fresh random sample of verified listings before publishing. Each response reports the model version that produced its labels in `servedModels`. ## Other limitations * **A group's address is not always a clinician's address.** Public sources often list a group's headquarters, billing office, or flagship clinic for every clinician in the group. Telling the satellite office where a clinician actually sees patients apart from the group's other sites is the largest remaining source of error. * **Absence of billing is not absence.** Clinicians in team-based or facility-billed settings, those who have opted out of Medicare, and direct primary care or membership practices that don't bill insurance are partly invisible to billing data. We tend to under-call active listings for opted-out and direct primary care physicians. * **Single-source listings are hard to predict.** Listings asserted only by NPPES, or only by a state Medicaid network, have no billing history to learn from. Listings that appear only in a state Medicaid network receive the label measured for that group as a whole rather than an individual prediction. * **Inpatient specialties are labeled by rule.** A hospitalist or emergency physician who also keeps a small outpatient clinic will still be labeled `very_likely_not_bookable` there. * **Multi-site practice.** A clinician who works one afternoon a week at a satellite office may show no public footprint there. Some of our suspect pairs are real-but-rare practice locations, and even human verification sometimes cannot distinguish "never there" from "rarely there." * **Telehealth blurs "location."** Clinicians attached to virtual-first practices are often listed at physical addresses they have never visited. We flag structurally non-clinical addresses, but a telehealth clinician listed at a real clinic they never enter is difficult to confirm. * **The public record lags.** Our primary sources update monthly to annually. A clinician who moved last month will usually not be caught yet; a pair we corroborate today may have quietly broken. * **Identity confusion.** Two clinicians with the same name are a recurring source of both directory errors and verification errors. Same-name confusion is one of the most common mechanisms behind confirmed-wrong location affiliations, and we treat name-only matches as weak evidence everywhere in the pipeline. * **Address matching is imperfect.** We [normalize addresses](/methodology/address-normalization) to the building level and pool much of our evidence per building. Campuses, suites, and creative address formatting mean a small share of pairs are compared against the wrong building. We made this choice because we believe a wrong suite is less likely to be problematic, and it makes it possible to aggregate more evidence per address. ## What these predictions are not These predictions are not a credentialing or licensure check, not a network-participation check, and not a prediction of who will leave next year. Bookability is not a statement that the practitioner is accepting new patients or about how soon they can be seen. These predictions do not decide whether a listing should be removed, but rather highlight which listings deserve human attention before they are used to support a patient. A `very_likely_inactive` label is a precisely measured prediction, not a verdict; a `very_likely_active` or `very_likely_bookable` label is strong agreement, not a guarantee. A human is needed for the final judgment call. # Quickstart Source: https://docs.perfectreferral.com/quickstart Create an account, get an API token, and make your first request From API token to your first request in three steps. From API token to your first request in three steps. This guide takes you from zero to your first successful API call. By the end, you'll have an API token and a working request that looks up a practitioner by their NPI number. **New to working with APIs?** An API is just a way for your software to ask ours a question and get a structured answer back. You will need an API token to identify yourself, send a request, and read the response. This guide assumes no prior experience and shows every step. ## Create an account Sign up at [developer.perfectreferral.com](https://developer.perfectreferral.com). You'll use this developer portal to manage your account and API tokens. ## Create an API token Once signed in, go to the **API tokens** section of the developer portal. Click **Create API token**, give it a descriptive name (for example, `local-testing` or `production`), and confirm. Your token is shown **only once**. Copy it and store it somewhere secure, such as a password manager. Treat your API token like a password. Don't commit it to source control, paste it into client-side code, or share it. If a token is exposed, revoke it in the developer portal and create a new one. ## Make your first request Every request is authenticated with your API token sent as a **Bearer token** in the `Authorization` header, and is made against the base URL: ``` https://api.perfectreferral.com/v1 ``` The example below looks up an individual practitioner by their [NPI number](https://npiregistry.cms.hhs.gov/) using the `GET /practitioners/{npiNumber}` endpoint. Replace `YOUR_API_TOKEN` with the token you just created and `1234567890` with the NPI you want to look up. ```bash curl theme={null} curl https://api.perfectreferral.com/v1/practitioners/1234567890 \ -H "Authorization: Bearer YOUR_API_TOKEN" ``` ```python Python theme={null} import requests API_TOKEN = "YOUR_API_TOKEN" npi_number = "1234567890" response = requests.get( f"https://api.perfectreferral.com/v1/practitioners/{npi_number}", headers={"Authorization": f"Bearer {API_TOKEN}"}, ) response.raise_for_status() print(response.json()) ``` ```javascript JavaScript theme={null} const API_TOKEN = "YOUR_API_TOKEN"; const npiNumber = "1234567890"; const response = await fetch( `https://api.perfectreferral.com/v1/practitioners/${npiNumber}`, { headers: { Authorization: `Bearer ${API_TOKEN}` } }, ); if (!response.ok) { throw new Error(`Request failed: ${response.status}`); } console.log(await response.json()); ``` The Python example uses the [`requests`](https://pypi.org/project/requests/) library; install it with `pip install requests`. The JavaScript example uses the built-in `fetch`, available in Node.js 18+ and all modern browsers (though for security, only call the API from a server, never from browser code where your token would be exposed). ## Understand the response A successful request returns `200 OK` with core practitioner data and the available model outputs. Each model has its own response field and label: ```json theme={null} { "name": "Dr. Naomi Park", "nppesSpecialties": ["Ophthalmology"], "referralScopeMatches": [ { "specialty": "Ophthalmology", "target": "Cataract evaluation and surgery", "label": "very_likely_match" } ], "locations": [ { "line1": "123 Main Street", "city": "San Diego", "state": "CA", "postalCode": "92103", "staleAffiliationRisk": { "label": "very_likely_active" } } ] } ``` `referralScopeMatches` describes how well the practitioner fits a referral target, while `staleAffiliationRisk` describes whether a practitioner-location affiliation is active today. The [Methodology & limitations](/methodology) pages explain each model and its labels. ## Next steps Explore the full list of endpoints, parameters, and response schemas. Need help? Reach out to us at [support@threshold.health](mailto:support@threshold.health).