API referenceProviders
Medicare opt-out status for an NPI
GET /v1/providers/{npi}/opt-out
GET https://api.healthcare.dev/v1/providers/{npi}/opt-outMedicare opt-out affidavits CMS lists with this NPI: specialty, opt-out effective and end dates, whether the provider may still order and refer, and the practice address on the affidavit. opted_out is true when a listed affidavit's period covers today. Opt-outs renew every two years unless cancelled, so the end date can move. Not listed means no opt-out affidavit recorded with this NPI as of data_version. A well-formed NPI always answers 200.
Requires an API key: Authorization: Bearer hdev_live_.... See Authentication.
Path parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
npi | string | yes | 10-digit National Provider Identifier | 1881018208 |
Query parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
view | "compact" | "standard" | "full" | no | How much of each record to return (default full). compact: id, npi, specialty, opt_out_effective_date, opt_out_end_date, eligible_to_order_and_refer, status (fewest tokens, for agents). standard: every field except replaced_by. full: every field. | compact |
fields | string | no | Comma-separated fields to return instead of a view. Valid fields: id, npi, name, specialty, opt_out_effective_date, opt_out_end_date, eligible_to_order_and_refer, address, last_updated, status, effective_start, effective_end, replaced_by. | id,npi,specialty |
Examples
curl
curl "https://api.healthcare.dev/v1/providers/1881018208/opt-out" \
-H "Authorization: Bearer $HDEV_API_KEY"TypeScript
const res = await fetch("https://api.healthcare.dev/v1/providers/1881018208/opt-out", {
headers: { Authorization: `Bearer ${process.env.HDEV_API_KEY}` },
});
const { data, meta } = await res.json();Python
import os
import requests
res = requests.get("https://api.healthcare.dev/v1/providers/1881018208/opt-out", headers={"Authorization": f"Bearer {os.environ['HDEV_API_KEY']}"})
body = res.json()Try it
Response
The NPI's opt-out affidavits
{
"data": {
"npi": "string",
"opted_out": true,
"note": "string",
"affidavits": [
{
"id": "string",
"npi": "string",
"name": {
"display": null,
"first": null,
"last": null
},
"specialty": "string",
"opt_out_effective_date": "2026-10-01",
"opt_out_end_date": "2026-10-01",
"eligible_to_order_and_refer": true,
"address": {
"line1": null,
"line2": null,
"city": null,
"state": null,
"postal_code": null
},
"last_updated": "2026-10-01",
"status": "active",
"effective_start": "2026-10-01",
"effective_end": "2026-10-01",
"replaced_by": [
null
]
}
]
},
"meta": {
"source": "cms-icd10",
"data_version": "2026.1",
"retrieved_at": "2026-10-24T12:00:00Z",
"license": "Public domain (CMS). Reference data, not medical advice."
},
"links": {
"self": "/v1/providers/1881018208/opt-out",
"next": null
}
}Fields
| Field | Type | Always present | Description |
|---|---|---|---|
npi | string | yes | |
opted_out | boolean | yes | Whether CMS's current opt-out file lists an affidavit with this NPI in effect today |
note | string | yes | How the answer was matched, in plain words: show it with the data |
affidavits | MedicareOptOut[] | yes |
Errors
Errors are application/problem+json (RFC 9457). Branch on type, not on title. See Errors.
| Status | type | When |
|---|---|---|
| 400 | invalid-request | A parameter or the body failed validation; errors lists each field. |
| 401 | unauthorized | Missing, malformed or revoked API key. |
| 404 | not-found | No record with that id (retired records are still returned). |
| 429 | rate-limited / quota-exceeded | Too many requests per second (retry after Retry-After), or the monthly quota is used up. |
| 503 | dataset-unavailable / unavailable | The dataset has no published version yet, or the service is degraded. |