{
    "openapi": "3.1.0",
    "info": {
        "title": "NPIBase API",
        "version": "0.2.0",
        "description": "Every National Provider Identifier (NPI) in CMS's NPPES registry, with taxonomies, licenses, identifiers, addresses, other names, and endpoints. NPIBase loads CMS's weekly update files and monthly deactivation reports as CMS publishes them; `GET /dataset` says which files the data reflects.\n\nAn NPI does not prove that a provider is licensed or credentialed.\n\n**OIG exclusions.** Pass `include_exclusions=true` to add each provider's HHS-OIG exclusion status, for 1 credit per provider returned. Exclusion data comes from HHS-OIG's List of Excluded Individuals/Entities (LEIE) downloadable file, which OIG publishes monthly; `source_through` and `GET /dataset` say which month is loaded. NPIBase matches LEIE records to providers only by the NPI OIG recorded, and most LEIE records carry no NPI, so `excluded: false` means no LEIE record in effect lists this NPI. It does not mean the provider is not excluded. OIG requires confirming a potential match by SSN or EIN at https://exclusions.oig.hhs.gov before acting on it. This is not a substitute for checking OIG, SAM.gov, or state Medicaid exclusion lists.\n\n**Authentication.** Send an API key (`npib_…`) or a service account's access token (`npib_at_…`) as a bearer token: `Authorization: Bearer npib_…`. Service accounts get access tokens from `POST /oauth/token`.\n\n**Errors.** Every error except the token endpoint's is JSON with a stable `code` and a readable `message`; `422` adds `errors` with messages by parameter. The token endpoint answers with OAuth 2.0 errors (RFC 6749).\n\n**Rate limits.** Each organization has one requests-per-minute limit shared by all of its credentials. Responses carry `X-RateLimit-Limit` and `X-RateLimit-Remaining`; requests over the limit get `429` with `Retry-After` in seconds.\n\n**Credits.** Provider requests cost credits (see each operation); `include_exclusions` adds 1 credit per provider returned. Once an organization has used its monthly credits, provider requests get `402` until the 1st (UTC); the request that crosses the limit still completes. Failed requests, `/usage`, `/dataset`, `/taxonomies`, and `/npis` are free.\n\n**NPIs.** An NPI is 10 digits, the last a Luhn check digit computed over the first nine with the `80840` prefix. Provider lookups reject a malformed NPI or one whose check digit doesn't match with `422` before charging credits, so a typo fails instead of coming back as not found. `GET /npis/{npi}` checks an NPI for free without looking it up.\n\n**AI assistants.** `POST /mcp` is a Model Context Protocol server (Streamable HTTP) with tools for NPI lookups, batches, search, taxonomy codes, and data freshness; the provider tools take the OIG exclusion and Medicare add-ons too. It takes the same bearer tokens, shares the rate limit, and spends the same credits as the matching endpoints; setup is in the AI assistants (MCP) section.\n\n**Versioning.** Every path is under `/v1`, and `info.version` is the API contract's version: its minor rises when endpoints, parameters, response fields, or error codes are added, and its patch when only descriptions change. Clients should ignore fields they don't know. Until 1.0.0, which marks the public launch, the v1 contract may still change in other ways, and the release notes say so. From 1.0.0 on, v1 only grows, and removing or changing anything would come as `/v2`."
    },
    "servers": [
        {
            "url": "https://api.npibase.com/v1"
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "tags": [
        {
            "name": "Providers",
            "description": "NPI lookups and provider search. Metered in credits."
        },
        {
            "name": "Reference data",
            "description": "Taxonomy codes, NPI validation, and data freshness. Free."
        },
        {
            "name": "Account",
            "description": "The calling organization's usage. Free."
        },
        {
            "name": "OAuth",
            "description": "Access tokens for service accounts."
        }
    ],
    "paths": {
        "/providers/{npi}": {
            "get": {
                "tags": ["Providers"],
                "operationId": "getProvider",
                "summary": "Look up one NPI",
                "description": "The full record for one NPI, including a deactivated one. Costs 1 credit, or 2 with `include_exclusions=true`. With `include_medicare=true`, 1 more credit for the `medicare` block.\n\nAn NPI that isn't 10 digits or whose check digit doesn't match fails with `422` and costs nothing.",
                "parameters": [
                    {
                        "name": "npi",
                        "in": "path",
                        "required": true,
                        "description": "A 10-digit NPI with a valid check digit.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "1174366850"
                    },
                    {
                        "name": "include_exclusions",
                        "in": "query",
                        "description": "`true` to add `oig_exclusion`, for 1 more credit.",
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    },
                    {
                        "name": "include_medicare",
                        "in": "query",
                        "description": "`true` to add the `medicare` block, for 1 more credit per provider returned.",
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The provider.",
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Provider"
                                        }
                                    },
                                    "required": ["data"]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "402": {
                        "$ref": "#/components/responses/CreditsExhausted"
                    },
                    "404": {
                        "description": "NPIBase has no record of the NPI.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "code": "not_found",
                                    "message": "NPIBase has no provider with NPI `1999999992`."
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "The NPI isn't 10 digits, or its check digit doesn't match.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "code": "invalid_parameters",
                                    "message": "`1174366851` is not a valid NPI: its last digit is a check digit, which should be 0.",
                                    "errors": {
                                        "npi": [
                                            "`1174366851` is not a valid NPI: its last digit is a check digit, which should be 0."
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/providers": {
            "get": {
                "tags": ["Providers"],
                "operationId": "listProviders",
                "summary": "Look up many NPIs, or search providers",
                "description": "With `npi`, looks up to 100 NPIs in one request (`POST /providers/batch` takes up to 1,000): results keep the request's order, deactivated NPIs are included, and NPIs NPIBase has no record of are listed under `missing`. Costs ½ credit per distinct NPI, rounded up. If any NPI isn't 10 digits or has a check digit that doesn't match, the request fails with `422`, names each one under `errors.npi`, and costs nothing.\n\nWithout `npi`, searches: pass at least one of `name`, `state`, `postal_code`, `near_postal_code`, `taxonomy`, or `excluded=true`. Filters combine with AND, and the location filters (`state`, `city`, `postal_code`, `near_postal_code`) must all match the same practice location. Deactivated NPIs are left out unless `include_deactivated=true`.\n\n**Radius search.** `near_postal_code` with `radius` finds providers with a practice location within `radius` miles of a ZIP code, nearest first, and gives each result's `distance_miles` and `nearest_postal_code`. Distances are measured between ZIP code centers (the Census Bureau's ZIP Code Tabulation Areas), not street addresses, so practice locations in the searched ZIP code are 0 miles away, and locations in ZIP codes without a tabulation area, such as PO box-only ZIP codes, aren't found. A radius search costs the same as any search. A search pages through at most 10,000 results. Costs 1 credit plus 1 per started block of 25 in `per_page`.\n\nWith `include_exclusions=true` or `excluded`, each provider returned costs 1 more credit.\n\n**Medicare add-on.** With `include_medicare=true`, each provider gets a `medicare` block, for 1 more credit per provider returned. Usage records it as a separate `medicare` operation, which adds credits but not requests. Medicare filters and the `pac_id` and `enrollment_id` lookups turn it on.\n\nInvalid values fail with `422` instead of being ignored, so a typo never widens a search.",
                "parameters": [
                    {
                        "name": "npi",
                        "in": "query",
                        "description": "Up to 100 comma-separated 10-digit NPIs with valid check digits. Looks them up instead of searching.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "1174366850,1497589469"
                    },
                    {
                        "name": "name",
                        "in": "query",
                        "description": "Words that must all appear, in any order, in the provider's name or in one of its other names (doing-business-as, former, professional, and other names). At least one word needs three or more letters. Results are ranked by trigram similarity to the best-matching name.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "john smith"
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "description": "Two-letter state of a primary or secondary practice location. Mailing addresses don't count.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "TX"
                    },
                    {
                        "name": "city",
                        "in": "query",
                        "description": "City of a practice location, case-insensitive. Needs `state`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "postal_code",
                        "in": "query",
                        "description": "ZIP code of a practice location: 5 digits, or 9 for an exact match.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "near_postal_code",
                        "in": "query",
                        "description": "A 5-digit ZIP code (or 9 digits, of which the first 5 count) to search around. Finds practice locations within `radius` miles of it and sorts results by distance, nearest first. Fails with `422` for a ZIP code NPIBase has no location for.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "75201"
                    },
                    {
                        "name": "radius",
                        "in": "query",
                        "description": "Miles around `near_postal_code`, above 0 and at most 100; decimals are allowed. Needs `near_postal_code`.",
                        "schema": {
                            "type": "number",
                            "exclusiveMinimum": 0,
                            "maximum": 100,
                            "default": 10
                        },
                        "example": 25
                    },
                    {
                        "name": "taxonomy",
                        "in": "query",
                        "description": "A taxonomy code in any of the provider's slots.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "207Q00000X"
                    },
                    {
                        "name": "entity_type",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": ["individual", "organization"]
                        }
                    },
                    {
                        "name": "include_deactivated",
                        "in": "query",
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    },
                    {
                        "name": "excluded",
                        "in": "query",
                        "description": "Searches only. `true` for only NPIs with an OIG exclusion in effect, which also works as a search on its own; `false` for only NPIs without one. Follows `include_deactivated` like every filter, and turns on `include_exclusions`.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "include_exclusions",
                        "in": "query",
                        "description": "`true` to add `oig_exclusion` to each provider, for 1 more credit per provider returned.",
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    },
                    {
                        "name": "pac_id",
                        "in": "query",
                        "description": "Up to 100 comma-separated Medicare PAC IDs. Looks up every NPI enrolled under them instead of searching; IDs matching no provider are listed under `missing`. Can't be combined with `npi` or `enrollment_id`. Costs ½ credit per distinct ID, rounded up, plus the Medicare add-on.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "2224312345"
                    },
                    {
                        "name": "enrollment_id",
                        "in": "query",
                        "description": "Up to 100 comma-separated Medicare enrollment IDs, such as `I20031103000005`. Works like `pac_id`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "medicare_enrolled",
                        "in": "query",
                        "description": "`true` for only NPIs enrolled in Medicare (see `medicare.enrolled`), `false` for the others. Needs another search filter. Turns on the Medicare add-on.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "medicare_opted_out",
                        "in": "query",
                        "description": "`true` for only NPIs opted out of Medicare today, `false` for the others. Needs another search filter. Turns on the Medicare add-on.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "orders_refers",
                        "in": "query",
                        "description": "Only NPIs Medicare lets order or refer this service. Needs another search filter. Turns on the Medicare add-on.",
                        "schema": {
                            "type": "string",
                            "enum": ["part_b", "dme", "hha", "pmd", "hospice"]
                        }
                    },
                    {
                        "name": "include_medicare",
                        "in": "query",
                        "description": "`true` to add the `medicare` block, for 1 more credit per provider returned.",
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The providers found. A lookup has `missing`; a search has `meta`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Provider"
                                            }
                                        },
                                        "missing": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            },
                                            "description": "Requested NPIs NPIBase has no record of, or PAC IDs and enrollment IDs that match no provider it has. Lookups only."
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "has_more": {
                                                    "type": "boolean",
                                                    "description": "Whether another page exists."
                                                }
                                            },
                                            "required": ["page", "per_page", "has_more"],
                                            "description": "Paging. Searches only."
                                        }
                                    },
                                    "required": ["data"]
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "402": {
                        "$ref": "#/components/responses/CreditsExhausted"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidParameters"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/providers/batch": {
            "post": {
                "operationId": "batchProviders",
                "tags": ["Providers"],
                "summary": "Look up a batch of up to 1,000 NPIs",
                "description": "Looks up 1 to 1,000 NPIs sent in a JSON body, for batches too long for `GET /providers?npi=`, which takes 100. It works like that lookup: results keep the request's order, repeated NPIs count once, deactivated NPIs are included, and NPIs NPIBase has no record of are listed under `missing`. Costs ½ credit per distinct NPI, rounded up, found or not. If any NPI isn't 10 digits or has a check digit that doesn't match, the request fails with `422`, names each one under `errors.npis`, and costs nothing.\n\nWith `include_exclusions` or `include_medicare`, each provider returned costs 1 more credit per add-on.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "npis": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "minItems": 1,
                                        "maxItems": 1000,
                                        "description": "10-digit NPIs, at most 1,000 distinct ones."
                                    },
                                    "include_exclusions": {
                                        "type": "boolean",
                                        "default": false,
                                        "description": "`true` to add `oig_exclusion` to each provider, for 1 more credit per provider returned."
                                    },
                                    "include_medicare": {
                                        "type": "boolean",
                                        "default": false,
                                        "description": "`true` to add the `medicare` block, for 1 more credit per provider returned."
                                    }
                                },
                                "required": ["npis"]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The providers found, in the request's order, and the NPIs NPIBase has no record of.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Provider"
                                            }
                                        },
                                        "missing": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            },
                                            "description": "Requested NPIs NPIBase has no record of."
                                        }
                                    },
                                    "required": ["data", "missing"]
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "402": {
                        "$ref": "#/components/responses/CreditsExhausted"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidParameters"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/providers/changes": {
            "get": {
                "tags": ["Providers"],
                "operationId": "listProviderChanges",
                "summary": "List the NPIs that changed since a time",
                "description": "Lists every NPI whose stored record changed from `since` until `meta.until`, oldest change first, so a credentialing team can re-check only those NPIs (for example with a batch lookup). A change is anything NPIBase loaded from CMS: the provider's details, any taxonomy, license, identifier, address, other name, or endpoint, or a deactivation or reactivation. NPIBase keeps no history, so a listing says that an NPI changed, not what it was before.\n\nEach NPI appears once, at its latest change. `change` is `deactivated` for an NPI now deactivated, `new` for one NPIBase first stored after `since`, `reactivated` for one whose reactivation date is newer than the files NPIBase had loaded at `since`, and `updated` otherwise. Deactivated NPIs are included, unlike in searches, because a deactivation is the change a credentialing team most needs to see.\n\n`since` can't be earlier than when NPIBase finished its initial load of the full NPPES file (December 2, 2026), since every NPI was stored then; an earlier one fails with `422` naming the earliest allowed time.\n\n**Paging.** Pass `since` for the first page, then `meta.next_cursor` as `cursor` for each next page until it is `null`. A listing's window is fixed on its first page, so its pages don't shift as new data loads. To poll, pass the last listing's `meta.until` as the next `since`: no change falls between them, even one from an import that was still running. Costs 1 credit plus 1 per started block of 250 in `per_page`.",
                "parameters": [
                    {
                        "name": "since",
                        "in": "query",
                        "description": "Start of the listing: an RFC 3339 timestamp with an offset, or a date, meaning midnight UTC. Needed unless `cursor` is passed, which replaces it.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "2026-12-07T00:00:00Z"
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "`meta.next_cursor` from the previous page.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000,
                            "default": 250
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "One page of changed NPIs.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ProviderChange"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "since": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "until": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "description": "The listing covers changes before this time. Pass it as the next listing's `since`."
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "has_more": {
                                                    "type": "boolean",
                                                    "description": "Whether another page exists."
                                                },
                                                "next_cursor": {
                                                    "type": ["string", "null"],
                                                    "description": "Pass as `cursor` for the next page; `null` on the last."
                                                }
                                            },
                                            "required": ["since", "until", "per_page", "has_more", "next_cursor"]
                                        }
                                    },
                                    "required": ["data", "meta"]
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "402": {
                        "$ref": "#/components/responses/CreditsExhausted"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidParameters"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/taxonomies": {
            "get": {
                "tags": ["Reference data"],
                "operationId": "listTaxonomies",
                "summary": "List taxonomy codes",
                "description": "Every code in the NUCC Health Care Provider Taxonomy code set NPIBase has loaded, including retired codes older NPPES records still use, ordered by code. Each has `nucc` names only for organizations NPIBase has enabled them for. Free.",
                "responses": {
                    "200": {
                        "description": "The codes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Taxonomy"
                                            }
                                        }
                                    },
                                    "required": ["data"]
                                },
                                "example": {
                                    "data": [
                                        {
                                            "code": "207Q00000X",
                                            "nucc": {
                                                "grouping": "Allopathic & Osteopathic Physicians",
                                                "classification": "Family Medicine",
                                                "specialization": null,
                                                "display_name": "Family Medicine Physician",
                                                "section": "Individual"
                                            }
                                        }
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/taxonomies/{code}": {
            "get": {
                "tags": ["Reference data"],
                "operationId": "getTaxonomy",
                "summary": "Look up one taxonomy code",
                "description": "One code, case-insensitive. Organizations with NUCC names also get NUCC's definition. Free.",
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "207Q00000X"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The code.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Taxonomy"
                                        }
                                    },
                                    "required": ["data"]
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "404": {
                        "description": "The code set has no such code.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "code": "not_found",
                                    "message": "The NUCC code set has no taxonomy code `XXXXXXXXXX`."
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/npis/{npi}": {
            "get": {
                "tags": ["Reference data"],
                "operationId": "validateNpi",
                "summary": "Validate an NPI",
                "description": "Whether a value is a well-formed NPI: 10 digits whose last is the Luhn check digit of the first nine with the `80840` prefix. Any value gets `200`; `valid` and `reason` give the answer. It reads no provider data, so a valid NPI may never have been issued; look it up with `GET /providers/{npi}` to find out. Free.",
                "parameters": [
                    {
                        "name": "npi",
                        "in": "path",
                        "required": true,
                        "description": "The value to check.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "1174366850"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Whether the NPI is valid.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/NpiValidation"
                                        }
                                    },
                                    "required": ["data"]
                                },
                                "example": {
                                    "data": {
                                        "npi": "1174366851",
                                        "valid": false,
                                        "reason": "`1174366851` is not a valid NPI: its last digit is a check digit, which should be 0."
                                    }
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/dataset": {
            "get": {
                "tags": ["Reference data"],
                "operationId": "getDataset",
                "summary": "Data freshness",
                "description": "Which CMS and NUCC files the data reflects, and when NPIBase imported them. Provider records are current through `providers.period_end`. Each part is null until such a file has been imported. Free.",
                "responses": {
                    "200": {
                        "description": "The files.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Dataset"
                                        }
                                    },
                                    "required": ["data"]
                                },
                                "example": {
                                    "data": {
                                        "providers": {
                                            "kind": "weekly",
                                            "file_name": "NPPES_Data_Dissemination_112326_112926_Weekly_V2.zip",
                                            "period_start": "2026-11-23",
                                            "period_end": "2026-11-29",
                                            "imported_at": "2026-12-01T10:02:11Z"
                                        },
                                        "deactivations": {
                                            "kind": "deactivation",
                                            "file_name": "NPPES_Deactivated_NPI_Report_110926_V2.zip",
                                            "period_start": null,
                                            "period_end": "2026-11-09",
                                            "imported_at": "2026-12-01T10:02:40Z"
                                        },
                                        "taxonomies": {
                                            "kind": "nucc",
                                            "file_name": "nucc_taxonomy_261.csv",
                                            "period_start": null,
                                            "period_end": null,
                                            "imported_at": "2026-12-01T10:00:05Z"
                                        }
                                    }
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/usage": {
            "get": {
                "tags": ["Account"],
                "operationId": "getUsage",
                "summary": "This month's usage",
                "description": "The organization's requests and credits from the 1st of this month (UTC) through today, across all of its credentials, in total and by operation. Works after the monthly credits run out. Free.",
                "responses": {
                    "200": {
                        "description": "The usage.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "period_start": {
                                                    "type": "string",
                                                    "format": "date"
                                                },
                                                "period_end": {
                                                    "type": "string",
                                                    "format": "date"
                                                },
                                                "requests": {
                                                    "type": "integer"
                                                },
                                                "credits": {
                                                    "type": "integer"
                                                },
                                                "operations": {
                                                    "type": "object",
                                                    "description": "By operation: `lookup`, `batch`, `search`, `changes`, `exclusions`, the `include_exclusions` add-on, and `medicare`, the `include_medicare` add-on. Add-on requests also count under their operation, so the total `requests` leaves them out.",
                                                    "additionalProperties": {
                                                        "type": "object",
                                                        "properties": {
                                                            "requests": {
                                                                "type": "integer"
                                                            },
                                                            "credits": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "required": ["data"]
                                }
                            }
                        },
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/oauth/token": {
            "post": {
                "tags": ["OAuth"],
                "operationId": "createAccessToken",
                "summary": "Get an access token",
                "description": "The OAuth 2.0 client credentials grant (RFC 6749, section 4.4). Send a service account's client ID and secret with HTTP Basic, or as `client_id` and `client_secret` in the form body, not both. The access token lasts `expires_in` seconds; ask for a new one when it expires.\n\nErrors use OAuth's shape, `{\"error\", \"error_description\"}`. Each IP address may call this endpoint 30 times a minute; more get `429` with `Retry-After` and the error `temporarily_unavailable`, since RFC 6749 defines no rate-limit error.",
                "security": [
                    {
                        "clientBasic": []
                    },
                    {}
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "grant_type": {
                                        "type": "string",
                                        "enum": ["client_credentials"]
                                    },
                                    "client_id": {
                                        "type": "string",
                                        "description": "`npib_sa_…`, when not using HTTP Basic."
                                    },
                                    "client_secret": {
                                        "type": "string",
                                        "description": "`npib_secret_…`, when not using HTTP Basic."
                                    }
                                },
                                "required": ["grant_type"]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "An access token.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "access_token": {
                                            "type": "string"
                                        },
                                        "token_type": {
                                            "type": "string",
                                            "enum": ["Bearer"]
                                        },
                                        "expires_in": {
                                            "type": "integer"
                                        }
                                    },
                                    "required": ["access_token", "token_type", "expires_in"]
                                },
                                "example": {
                                    "access_token": "npib_at_…",
                                    "token_type": "Bearer",
                                    "expires_in": 3600
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request` or `unsupported_grant_type`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OAuthError"
                                },
                                "example": {
                                    "error": "unsupported_grant_type",
                                    "error_description": "Only the client_credentials grant is supported."
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "`invalid_client`: unknown, wrong, or revoked credentials.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OAuthError"
                                },
                                "example": {
                                    "error": "invalid_client",
                                    "error_description": "Client authentication failed."
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Over 30 requests a minute from this IP address.",
                        "headers": {
                            "Retry-After": {
                                "$ref": "#/components/headers/Retry-After"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OAuthError"
                                },
                                "example": {
                                    "error": "temporarily_unavailable",
                                    "error_description": "Too many token requests from this address. Retry in 42 seconds."
                                }
                            }
                        }
                    }
                }
            }
        },
        "/providers/{npi}/medicare-reassignments": {
            "get": {
                "tags": ["Providers"],
                "operationId": "listMedicareReassignments",
                "summary": "List an NPI's Medicare reassignments",
                "description": "A practitioner usually reassigns their Medicare benefits to the group practices they work for, which then bill Medicare for their services. This lists every reassignment of the NPI's Medicare enrollments in either direction: the groups a practitioner bills through, and the practitioners who bill through a group. Pages through at most 10,000. Costs like a search (1 credit plus 1 per started block of 25 in `per_page`), plus the Medicare add-on's 1 credit per reassignment returned.",
                "parameters": [
                    {
                        "name": "npi",
                        "in": "path",
                        "required": true,
                        "description": "A 10-digit NPI with a valid check digit.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "1174366850"
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The reassignments, ordered by enrollment ID.",
                        "headers": {
                            "X-RateLimit-Limit": {
                                "$ref": "#/components/headers/X-RateLimit-Limit"
                            },
                            "X-RateLimit-Remaining": {
                                "$ref": "#/components/headers/X-RateLimit-Remaining"
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "description": "`from` lets `to` bill Medicare for `from`'s services.",
                                                "properties": {
                                                    "from": {
                                                        "$ref": "#/components/schemas/MedicareParty"
                                                    },
                                                    "to": {
                                                        "$ref": "#/components/schemas/MedicareParty"
                                                    }
                                                },
                                                "required": ["from", "to"]
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "has_more": {
                                                    "type": "boolean",
                                                    "description": "Whether another page exists."
                                                }
                                            },
                                            "required": ["page", "per_page", "has_more"],
                                            "description": "Paging."
                                        }
                                    },
                                    "required": ["data", "meta"]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "402": {
                        "$ref": "#/components/responses/CreditsExhausted"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidParameters"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    },
                    "404": {
                        "description": "NPIBase has no record of the NPI.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                },
                                "example": {
                                    "code": "not_found",
                                    "message": "NPIBase has no provider with NPI `1999999992`."
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "An API key (`npib_…`) or an access token (`npib_at_…`)."
            },
            "clientBasic": {
                "type": "http",
                "scheme": "basic",
                "description": "A service account's client ID and secret."
            }
        },
        "headers": {
            "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                    "type": "integer"
                }
            },
            "X-RateLimit-Limit": {
                "description": "The organization's requests per minute.",
                "schema": {
                    "type": "integer"
                }
            },
            "X-RateLimit-Remaining": {
                "description": "Requests left this minute.",
                "schema": {
                    "type": "integer"
                }
            }
        },
        "responses": {
            "Unauthenticated": {
                "description": "No valid API key or access token.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "unauthenticated",
                            "message": "Send a valid API key or access token as a bearer token: `Authorization: Bearer …`."
                        }
                    }
                }
            },
            "CreditsExhausted": {
                "description": "The organization has used its credits for the month.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "credits_exhausted",
                            "message": "This organization has used its 1000 credits for the month. Upgrade its plan, or wait until the 1st (UTC)."
                        }
                    }
                }
            },
            "InvalidParameters": {
                "description": "A parameter is invalid; `errors` names each.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "invalid_parameters",
                            "message": "Use a two-letter state, such as `TX`.",
                            "errors": {
                                "state": ["Use a two-letter state, such as `TX`."]
                            }
                        }
                    }
                }
            },
            "RateLimited": {
                "description": "Over the organization's requests-per-minute limit.",
                "headers": {
                    "Retry-After": {
                        "$ref": "#/components/headers/Retry-After"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "rate_limited",
                            "message": "Too many requests. Retry in 12 seconds."
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "Stable and machine-readable: `unauthenticated` (401), `credits_exhausted` (402), `not_found` (404), `method_not_allowed` (405), `invalid_parameters` (422), `rate_limited` (429), `server_error` (500), or another status's name in snake case. New codes may be added."
                    },
                    "message": {
                        "type": "string",
                        "description": "For people; the wording may change."
                    },
                    "errors": {
                        "type": "object",
                        "description": "`422` only: messages by parameter.",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                },
                "required": ["code", "message"]
            },
            "NpiValidation": {
                "type": "object",
                "properties": {
                    "npi": {
                        "type": "string",
                        "description": "The value checked, as sent."
                    },
                    "valid": {
                        "type": "boolean",
                        "description": "Whether it is 10 digits with a matching check digit. Says nothing about whether the NPI was issued."
                    },
                    "reason": {
                        "type": "string",
                        "description": "Only when `valid` is false: why, for people; the wording may change."
                    }
                },
                "required": ["npi", "valid"]
            },
            "OAuthError": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string",
                        "enum": [
                            "invalid_request",
                            "invalid_client",
                            "unsupported_grant_type",
                            "temporarily_unavailable",
                            "server_error"
                        ]
                    },
                    "error_description": {
                        "type": "string"
                    }
                },
                "required": ["error", "error_description"]
            },
            "Provider": {
                "type": "object",
                "properties": {
                    "npi": {
                        "type": "string",
                        "description": "The 10-digit NPI.",
                        "pattern": "^[0-9]{10}$"
                    },
                    "status": {
                        "type": "string",
                        "description": "`deactivated` when the NPI's latest deactivation has no later reactivation.",
                        "enum": ["active", "deactivated"]
                    },
                    "entity_type": {
                        "type": ["string", "null"],
                        "description": "Type 1 (`individual`) or Type 2 (`organization`). Null for an NPI known only from a deactivation report.",
                        "enum": ["individual", "organization", null]
                    },
                    "replacement_npi": {
                        "type": ["string", "null"]
                    },
                    "ein": {
                        "type": ["string", "null"],
                        "description": "Organizations only."
                    },
                    "organization_name": {
                        "type": ["string", "null"]
                    },
                    "last_name": {
                        "type": ["string", "null"]
                    },
                    "first_name": {
                        "type": ["string", "null"]
                    },
                    "middle_name": {
                        "type": ["string", "null"]
                    },
                    "name_prefix": {
                        "type": ["string", "null"]
                    },
                    "name_suffix": {
                        "type": ["string", "null"]
                    },
                    "credential": {
                        "type": ["string", "null"]
                    },
                    "sex": {
                        "type": ["string", "null"],
                        "enum": ["male", "female", "undisclosed", null]
                    },
                    "is_sole_proprietor": {
                        "type": ["boolean", "null"]
                    },
                    "is_organization_subpart": {
                        "type": ["boolean", "null"]
                    },
                    "parent_organization_name": {
                        "type": ["string", "null"]
                    },
                    "parent_organization_tin": {
                        "type": ["string", "null"]
                    },
                    "enumeration_date": {
                        "type": ["string", "null"],
                        "format": "date"
                    },
                    "last_update_date": {
                        "type": ["string", "null"],
                        "description": "When the provider last changed the record in NPPES.",
                        "format": "date"
                    },
                    "certification_date": {
                        "type": ["string", "null"],
                        "format": "date"
                    },
                    "deactivation_date": {
                        "type": ["string", "null"],
                        "format": "date"
                    },
                    "reactivation_date": {
                        "type": ["string", "null"],
                        "format": "date"
                    },
                    "created_at": {
                        "type": "string",
                        "description": "When NPIBase first stored the NPI.",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "description": "When an import last changed the NPI in NPIBase.",
                        "format": "date-time"
                    },
                    "authorized_official": {
                        "description": "Organizations only.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/AuthorizedOfficial"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "addresses": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Address"
                        }
                    },
                    "taxonomies": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TaxonomySlot"
                        }
                    },
                    "identifiers": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Identifier"
                        }
                    },
                    "other_names": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/OtherName"
                        }
                    },
                    "endpoints": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Endpoint"
                        }
                    },
                    "distance_miles": {
                        "type": "number",
                        "description": "Radius searches only: miles, to one decimal place, from `near_postal_code` to the provider's nearest practice location that matches the search, measured between ZIP code centers.",
                        "example": 3.4
                    },
                    "nearest_postal_code": {
                        "type": "string",
                        "description": "Radius searches only: the 5-digit ZIP code of that nearest practice location, which tells which of the provider's `addresses` it is.",
                        "example": "75204"
                    },
                    "oig_exclusion": {
                        "$ref": "#/components/schemas/ExclusionStatus",
                        "description": "Present only with `include_exclusions=true`."
                    },
                    "medicare": {
                        "$ref": "#/components/schemas/Medicare"
                    }
                },
                "required": ["npi", "status", "addresses", "taxonomies", "identifiers", "other_names", "endpoints"]
            },
            "AuthorizedOfficial": {
                "type": "object",
                "properties": {
                    "last_name": {
                        "type": "string"
                    },
                    "first_name": {
                        "type": "string"
                    },
                    "middle_name": {
                        "type": ["string", "null"]
                    },
                    "name_prefix": {
                        "type": ["string", "null"]
                    },
                    "name_suffix": {
                        "type": ["string", "null"]
                    },
                    "credential": {
                        "type": ["string", "null"]
                    },
                    "title": {
                        "type": ["string", "null"]
                    },
                    "telephone": {
                        "type": ["string", "null"]
                    }
                }
            },
            "Address": {
                "type": "object",
                "properties": {
                    "kind": {
                        "type": "string",
                        "enum": ["mailing", "primary_practice", "secondary_practice"]
                    },
                    "address_1": {
                        "type": ["string", "null"]
                    },
                    "address_2": {
                        "type": ["string", "null"]
                    },
                    "city": {
                        "type": ["string", "null"]
                    },
                    "state": {
                        "type": ["string", "null"]
                    },
                    "postal_code": {
                        "type": ["string", "null"]
                    },
                    "country_code": {
                        "type": ["string", "null"]
                    },
                    "telephone": {
                        "type": ["string", "null"]
                    },
                    "telephone_extension": {
                        "type": ["string", "null"]
                    },
                    "fax": {
                        "type": ["string", "null"]
                    }
                },
                "required": ["kind"]
            },
            "TaxonomySlot": {
                "type": "object",
                "properties": {
                    "position": {
                        "type": "integer",
                        "description": "The NPPES slot, 1 to 15."
                    },
                    "taxonomy_code": {
                        "type": "string"
                    },
                    "is_primary": {
                        "type": "boolean"
                    },
                    "license_number": {
                        "type": ["string", "null"]
                    },
                    "license_state": {
                        "type": ["string", "null"]
                    },
                    "group_taxonomy_code": {
                        "type": ["string", "null"]
                    },
                    "nucc": {
                        "type": "object",
                        "properties": {
                            "grouping": {
                                "type": "string"
                            },
                            "classification": {
                                "type": "string"
                            },
                            "specialization": {
                                "type": ["string", "null"]
                            },
                            "display_name": {
                                "type": "string"
                            }
                        },
                        "required": ["grouping", "classification", "specialization", "display_name"],
                        "description": "NUCC's names for the code. NUCC licenses them, so they appear only for organizations NPIBase has enabled them for."
                    }
                },
                "required": ["position", "taxonomy_code", "is_primary"]
            },
            "Identifier": {
                "type": "object",
                "properties": {
                    "position": {
                        "type": "integer"
                    },
                    "identifier": {
                        "type": "string"
                    },
                    "kind": {
                        "type": "string",
                        "enum": ["other", "medicaid"]
                    },
                    "state": {
                        "type": ["string", "null"]
                    },
                    "issuer": {
                        "type": ["string", "null"]
                    }
                },
                "required": ["position", "identifier", "kind"]
            },
            "OtherName": {
                "type": "object",
                "properties": {
                    "kind": {
                        "type": "string",
                        "enum": [
                            "former_name",
                            "professional_name",
                            "doing_business_as",
                            "former_legal_business_name",
                            "other_name"
                        ]
                    },
                    "organization_name": {
                        "type": ["string", "null"]
                    },
                    "last_name": {
                        "type": ["string", "null"]
                    },
                    "first_name": {
                        "type": ["string", "null"]
                    },
                    "middle_name": {
                        "type": ["string", "null"]
                    },
                    "name_prefix": {
                        "type": ["string", "null"]
                    },
                    "name_suffix": {
                        "type": ["string", "null"]
                    },
                    "credential": {
                        "type": ["string", "null"]
                    },
                    "created_date": {
                        "type": ["string", "null"],
                        "format": "date"
                    }
                },
                "required": ["kind"]
            },
            "Endpoint": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string"
                    },
                    "is_affiliation": {
                        "type": "boolean"
                    },
                    "endpoint_type": {
                        "type": ["string", "null"]
                    },
                    "endpoint_type_description": {
                        "type": ["string", "null"]
                    },
                    "endpoint_description": {
                        "type": ["string", "null"]
                    },
                    "affiliation_legal_business_name": {
                        "type": ["string", "null"]
                    },
                    "use_code": {
                        "type": ["string", "null"]
                    },
                    "use_description": {
                        "type": ["string", "null"]
                    },
                    "other_use_description": {
                        "type": ["string", "null"]
                    },
                    "content_type": {
                        "type": ["string", "null"]
                    },
                    "content_description": {
                        "type": ["string", "null"]
                    },
                    "other_content_description": {
                        "type": ["string", "null"]
                    },
                    "affiliation_address_1": {
                        "type": ["string", "null"]
                    },
                    "affiliation_address_2": {
                        "type": ["string", "null"]
                    },
                    "affiliation_city": {
                        "type": ["string", "null"]
                    },
                    "affiliation_state": {
                        "type": ["string", "null"]
                    },
                    "affiliation_country_code": {
                        "type": ["string", "null"]
                    },
                    "affiliation_postal_code": {
                        "type": ["string", "null"]
                    }
                },
                "required": ["endpoint", "is_affiliation"]
            },
            "ProviderChange": {
                "type": "object",
                "properties": {
                    "npi": {
                        "type": "string"
                    },
                    "change": {
                        "type": "string",
                        "enum": ["new", "updated", "deactivated", "reactivated"]
                    },
                    "status": {
                        "type": "string",
                        "enum": ["active", "deactivated"]
                    },
                    "changed_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When NPIBase loaded the NPI's latest change."
                    },
                    "deactivation_date": {
                        "type": ["string", "null"],
                        "format": "date",
                        "description": "From CMS. Kept after a reactivation."
                    },
                    "reactivation_date": {
                        "type": ["string", "null"],
                        "format": "date",
                        "description": "From CMS."
                    }
                },
                "required": ["npi", "change", "status", "changed_at", "deactivation_date", "reactivation_date"]
            },
            "Taxonomy": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "nucc": {
                        "type": "object",
                        "properties": {
                            "grouping": {
                                "type": "string"
                            },
                            "classification": {
                                "type": "string"
                            },
                            "specialization": {
                                "type": ["string", "null"]
                            },
                            "display_name": {
                                "type": "string"
                            },
                            "section": {
                                "type": "string",
                                "enum": ["Individual", "Non-Individual"]
                            },
                            "definition": {
                                "type": ["string", "null"],
                                "description": "Single-code lookups only."
                            }
                        },
                        "required": ["grouping", "classification", "specialization", "display_name"],
                        "description": "NUCC's names for the code. NUCC licenses them, so they appear only for organizations NPIBase has enabled them for."
                    }
                },
                "required": ["code"]
            },
            "Dataset": {
                "type": "object",
                "properties": {
                    "providers": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The newest full or weekly NPPES file imported."
                    },
                    "deactivations": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The newest monthly NPPES deactivation report imported."
                    },
                    "taxonomies": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The NUCC taxonomy code set imported."
                    },
                    "exclusions": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The newest HHS-OIG LEIE file imported. `period_end` is the last day it covers."
                    },
                    "medicare_enrollments": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The newest Medicare Public Provider Enrollment file imported, pulled from PECOS on its `period_end`."
                    },
                    "ordering_referring": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The newest Medicare Order and Referring file imported."
                    },
                    "opt_outs": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/SourceFile"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The newest Medicare opt-out list imported, covering opt-outs through its `period_end`."
                    }
                },
                "required": [
                    "providers",
                    "deactivations",
                    "taxonomies",
                    "exclusions",
                    "medicare_enrollments",
                    "ordering_referring",
                    "opt_outs"
                ]
            },
            "SourceFile": {
                "type": "object",
                "properties": {
                    "kind": {
                        "type": "string",
                        "enum": [
                            "full",
                            "weekly",
                            "deactivation",
                            "nucc",
                            "leie",
                            "medicare_enrollment",
                            "order_referring",
                            "opt_out"
                        ]
                    },
                    "file_name": {
                        "type": "string"
                    },
                    "period_start": {
                        "type": ["string", "null"],
                        "description": "The first day the file covers.",
                        "format": "date"
                    },
                    "period_end": {
                        "type": ["string", "null"],
                        "description": "The last day the file covers.",
                        "format": "date"
                    },
                    "imported_at": {
                        "type": ["string", "null"],
                        "format": "date-time"
                    }
                },
                "required": ["kind", "file_name", "period_start", "period_end", "imported_at"]
            },
            "ExclusionStatus": {
                "type": "object",
                "description": "What HHS-OIG's LEIE says about the NPI. Exclusion data comes from HHS-OIG's List of Excluded Individuals/Entities (LEIE) downloadable file, which OIG publishes monthly; `source_through` and `GET /dataset` say which month is loaded. NPIBase matches LEIE records to providers only by the NPI OIG recorded, and most LEIE records carry no NPI, so `excluded: false` means no LEIE record in effect lists this NPI. It does not mean the provider is not excluded. OIG requires confirming a potential match by SSN or EIN at https://exclusions.oig.hhs.gov before acting on it. This is not a substitute for checking OIG, SAM.gov, or state Medicaid exclusion lists.",
                "properties": {
                    "excluded": {
                        "type": "boolean",
                        "description": "`true` when an LEIE record listing this NPI is in effect today."
                    },
                    "matched_by": {
                        "type": "string",
                        "enum": ["npi"],
                        "description": "How LEIE records were matched to the provider. Always `npi`."
                    },
                    "source_through": {
                        "type": ["string", "null"],
                        "format": "date",
                        "description": "The last day of the month the loaded LEIE file covers."
                    },
                    "exclusions": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Exclusion"
                        },
                        "description": "The LEIE records listing this NPI, newest first. Empty when none do."
                    }
                },
                "required": ["excluded", "matched_by", "source_through", "exclusions"]
            },
            "Exclusion": {
                "type": "object",
                "description": "One LEIE record, as OIG published it.",
                "properties": {
                    "last_name": {
                        "type": ["string", "null"]
                    },
                    "first_name": {
                        "type": ["string", "null"]
                    },
                    "middle_name": {
                        "type": ["string", "null"]
                    },
                    "business_name": {
                        "type": ["string", "null"],
                        "description": "For entities."
                    },
                    "general": {
                        "type": ["string", "null"],
                        "description": "OIG's general category, such as `IND- LIC HC SERV PRO`."
                    },
                    "specialty": {
                        "type": ["string", "null"]
                    },
                    "state": {
                        "type": ["string", "null"],
                        "description": "The state of OIG's address at the time of exclusion."
                    },
                    "exclusion_type": {
                        "type": "string",
                        "description": "The Social Security Act authority, such as `1128a1` or `1128b4`.",
                        "example": "1128b4"
                    },
                    "type_description": {
                        "type": ["string", "null"],
                        "description": "The authority in words, for known codes."
                    },
                    "exclusion_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "is_effective": {
                        "type": "boolean",
                        "description": "`false` when the exclusion is listed but starts after today."
                    },
                    "waiver_date": {
                        "type": ["string", "null"],
                        "format": "date"
                    },
                    "waiver_state": {
                        "type": ["string", "null"],
                        "description": "A state where OIG waived the exclusion."
                    }
                },
                "required": ["exclusion_type", "exclusion_date", "is_effective"]
            },
            "MedicareParty": {
                "type": "object",
                "description": "One side of a reassignment. Its details are `null` when CMS leaves the enrollment out of the enrollment file.",
                "properties": {
                    "enrollment_id": {
                        "type": "string"
                    },
                    "npi": {
                        "type": ["string", "null"]
                    },
                    "pac_id": {
                        "type": ["string", "null"]
                    },
                    "name": {
                        "type": ["string", "null"],
                        "description": "The organization's name, or the individual's name as CMS writes it."
                    },
                    "state": {
                        "type": ["string", "null"]
                    }
                },
                "required": ["enrollment_id", "npi", "pac_id", "name", "state"]
            },
            "MedicareEnrollment": {
                "type": "object",
                "description": "One Medicare enrollment. A provider enrolls once per state and enrollment type.",
                "properties": {
                    "enrollment_id": {
                        "type": "string",
                        "description": "PECOS's enrollment ID: `I…` for individuals, `O…` for organizations."
                    },
                    "pac_id": {
                        "type": "string",
                        "description": "PECOS Associate Control ID, shared by all of a provider's enrollments."
                    },
                    "provider_type": {
                        "type": "object",
                        "description": "The enrollment type (first two digits) and primary specialty, such as `14-08`.",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "description": {
                                "type": "string"
                            }
                        },
                        "required": ["code", "description"]
                    },
                    "secondary_specialties": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "code": {
                                    "type": "string"
                                },
                                "description": {
                                    "type": "string"
                                }
                            },
                            "required": ["code", "description"]
                        }
                    },
                    "state": {
                        "type": ["string", "null"]
                    },
                    "practice_locations": {
                        "type": "array",
                        "description": "CMS publishes only the city, state, and ZIP code. Practitioners who bill through a group usually have none.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "city": {
                                    "type": "string"
                                },
                                "state": {
                                    "type": "string"
                                },
                                "postal_code": {
                                    "type": "string"
                                }
                            },
                            "required": ["city", "state", "postal_code"]
                        }
                    },
                    "reassigns_to": {
                        "type": "array",
                        "description": "The enrollments, usually group practices', that bill Medicare for this one.",
                        "items": {
                            "$ref": "#/components/schemas/MedicareParty"
                        }
                    },
                    "reassigned_from_count": {
                        "type": "integer",
                        "description": "Organizations only: how many enrollments bill Medicare through this one. List them with `GET /providers/{npi}/medicare-reassignments`."
                    }
                },
                "required": [
                    "enrollment_id",
                    "pac_id",
                    "provider_type",
                    "secondary_specialties",
                    "state",
                    "practice_locations",
                    "reassigns_to"
                ]
            },
            "Medicare": {
                "type": "object",
                "description": "What CMS's public Medicare files say about the NPI. Present only with `include_medicare=true` or a Medicare filter or lookup. Data from CMS (data.cms.gov); NPIBase isn't endorsed by CMS.",
                "properties": {
                    "enrolled": {
                        "type": "boolean",
                        "description": "Whether the NPI is in CMS's quarterly Public Provider Enrollment file, or on its twice-weekly Order and Referring file without a current opt-out (opted-out practitioners may still order and refer). `false` means not found in CMS's public files as of `sources`, not a verdict from PECOS."
                    },
                    "opted_out": {
                        "type": "boolean",
                        "description": "Whether an opt-out affidavit covers today."
                    },
                    "ordering_referring": {
                        "oneOf": [
                            {
                                "type": "object",
                                "description": "The Medicare services the practitioner may order or refer.",
                                "properties": {
                                    "part_b": {
                                        "type": "boolean"
                                    },
                                    "dme": {
                                        "type": "boolean",
                                        "description": "Durable medical equipment."
                                    },
                                    "hha": {
                                        "type": "boolean",
                                        "description": "Home health agency services."
                                    },
                                    "pmd": {
                                        "type": "boolean",
                                        "description": "Power mobility devices."
                                    },
                                    "hospice": {
                                        "type": "boolean"
                                    }
                                },
                                "required": ["part_b", "dme", "hha", "pmd", "hospice"]
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "`null` when the NPI isn't on the Order and Referring file."
                    },
                    "enrollments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/MedicareEnrollment"
                        }
                    },
                    "opt_out": {
                        "oneOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "specialty": {
                                        "type": ["string", "null"]
                                    },
                                    "effective_date": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "end_date": {
                                        "type": ["string", "null"],
                                        "format": "date"
                                    },
                                    "address_line_1": {
                                        "type": ["string", "null"]
                                    },
                                    "address_line_2": {
                                        "type": ["string", "null"]
                                    },
                                    "city": {
                                        "type": ["string", "null"]
                                    },
                                    "state": {
                                        "type": ["string", "null"]
                                    },
                                    "postal_code": {
                                        "type": ["string", "null"]
                                    },
                                    "may_order_and_refer": {
                                        "type": "boolean"
                                    }
                                },
                                "required": ["effective_date", "end_date", "may_order_and_refer"]
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The opt-out that covers today, or `null`."
                    },
                    "sources": {
                        "type": "object",
                        "description": "The date each CMS file was pulled or covers through.",
                        "properties": {
                            "enrollments": {
                                "type": ["string", "null"],
                                "description": "Quarterly.",
                                "format": "date"
                            },
                            "ordering_referring": {
                                "type": ["string", "null"],
                                "description": "Twice a week.",
                                "format": "date"
                            },
                            "opt_outs": {
                                "type": ["string", "null"],
                                "description": "Monthly, about seven weeks behind.",
                                "format": "date"
                            }
                        },
                        "required": ["enrollments", "ordering_referring", "opt_outs"]
                    }
                },
                "required": ["enrolled", "opted_out", "ordering_referring", "enrollments", "opt_out", "sources"]
            }
        }
    }
}
