DEV Community

carrierone
carrierone

Posted on

How to Query 9 Million US Healthcare Providers via API (NPI Registry)

Querying 9 Million US Healthcare Providers via API: A Developer's Guide to NPI Registry

When developing a healthcare application that requires integration with provider directories or FHIR services, having access to accurate and up-to-date information on US healthcare providers is essential. One of the key resources for this purpose is the National Provider Identifier (NPI) registry.

The NPI Registry provides an API endpoint accessible at api.verilexdata.com/api/v1/npi/sample. This sample endpoint offers a glimpse into what querying the full dataset might look like, enabling developers to explore how they can integrate provider data into their applications. Below is a short Python code snippet that demonstrates how one could make a request to this API and process the response.

import requests

def fetch_npi_data(npi_number):
    url = "https://api.verilexdata.com/api/v1/npi/sample"

    headers = {
        'Content-Type': 'application/json'
    }

    payload = {
        'npi': npi_number
    }

    response = requests.post(url, json=payload, headers=headers)

    if response.status_code == 200:
        return response.json()
    else:
        raise Exception(f"Failed to fetch data: {response.status_code}")
Enter fullscreen mode Exit fullscreen mode

To query the NPI registry using this endpoint, simply replace `

Top comments (0)