ESMD FHIR Implementation Guide
1.0.0 - esmd

ESMD FHIR Implementation Guide - Local Development build (v1.0.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Bundle Practitioner API

Overview

The esMD FHIR Service Registration workflow enables Health Information Handlers (HIHs) to register medical practitioners (providers) in the esMD System, allowing them to send and receive Electronic Medical Documentation Request (eMDR) letters and other clinical documents electronically.

The Bundle Practitioner API supports the batch bundle registration method where multiple providers are registered using one request.

This document outlines API endpoints, request structure, response format, and error-handling mechanisms required for successful integration.

Bundle Response Correlation Enhancement: To improve request to response traceability, each applicable OperationOutcome in the Bundle response now includes extensions containing the corresponding Practitioner ID and NPI. The Practitioner ID extension contains the value submitted in the Practitioner resource’s id element, and the NPI extension contains the value submitted in the request's NPI extension. These identifiers enable HIHs to correlate responses, including error responses, with the originating Practitioner requests without relying on response order within the Bundle. Existing Bundle Practitioner API processing behavior remains unchanged; this enhancement only adds identifier extensions to support response correlation.

esMD recommends that HIHs provide a unique value for the id element of each Practitioner resource within a Bundle. Although esMD does not validate ID uniqueness within a Bundle, HIHs can use the combination of Practitioner ID and NPI to correlate responses when Practitioner IDs are duplicated, provided that each ID, NPI combination is unique within the Bundle.

Note – NPI Registration in NPPES for the FHIR API: Existing NPPES registrations will remain unchanged. Organizations may continue using "CONNECT" as the endpoint type with the HIH endpoint/OID as the endpoint. However, for new NPI registrations submitted after the July 2025 Go-Live, HIHs onboarding to the esMD FHIR API can specify "FHIR API" as the endpoint type and set the endpoint to: https://cpiapigateway.cms.gov/api/esmdf/v1/fhir/Practitioner/{id}

API Information

  • Operation Name: /api/esmdf/ext/v1/fhir
  • Method: POST
  • Authorization: Requires a Bearer Token obtained via the Auth API.

Endpoints:

  • UAT: https://val.cpiapigateway.cms.gov/api/esmdf/ext/v1/fhir
  • PROD: https://cpiapigateway.cms.gov/api/esmdf/ext/v1/fhir

Request Headers

Header Description Required Data Type Comments
Authorization Authentication token from Auth API Yes String Example: Bearer {token}
Content-Type Content-Type must be application/fhir+json Yes String application/fhir+json
Accept Accept must be application/fhir+json Yes String application/fhir+json

Sample Bundle of Practitioners Request

POST /api/esmdf/ext/v1/fhir/ HTTP/1.1
Host: dev.cpiapigateway.cms.gov
Authorization: Bearer {token}
Content-Type: application/fhir+json
Accept: application/fhir+json

{
  "resourceType": "Bundle",
  "id": "50bd17b7-e838-484c-b0d1-deaf67ed1946",
  "meta": {
    "profile": [
      "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-BundleServiceRegistration"
    ],       "security": [
            {
                "system" : "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
                "code" : "V",
                "display" : "restricted"
            }
            
        ]
  },
  "type": "batch",
  "timestamp": "2024-09-13T12:00:00Z",
  "entry": [
    {
      "fullUrl": "urn:uuid:18808e6c-e232-413d-b526-233361e9f0d1",
      "resource": {
        "resourceType": "Practitioner",
        "id": "P100",
        "meta": {
          "profile": [
            "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Practitioner"
          ],
          "security": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
              "code": "V",
              "display": "restricted"
            }
          ]
        },
        "telecom": [
          {
            "system": "phone",
            "value": "555-123-4567",
            "use": "work"
          }
        ],
        "name": [
          {
            "family": "Bone",
            "given": [
              "Ronald"
            ],
            "prefix": [
              "Dr"
            ]
          }
        ],
        "address": [
          {
            "use": "work",
            "line": [
              "1003 HEALTHCARE DR"
            ],
            "city": "AMHERST",
            "state": "MA",
            "postalCode": "01002"
          }
        ],
        "gender": "male",
        "active": true,
        "extension": [
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-NPI",
            "valueString": "1871540237"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ProviderTaxId",
            "valueString": "HIH1234"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ActionRequestedCode",
            "valueCode": "R"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ServiceCode",
            "valueCode": "EEP"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ServiceStartDate",
            "valueDate": "2026-11-30"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ServiceEndDate",
            "valueDate": "2026-12-30"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Practitioner/P100"
      }
    },
    {
      "fullUrl": "urn:uuid:18808e6b-e232-413d-b526-233361e9f0d1",
      "resource": {
        "resourceType": "Practitioner",
        "id": "P101",
        "meta": {
          "profile": [
            "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Practitioner"
          ],
          "security": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
              "code": "V",
              "display": "restricted"
            }
          ]
        },
        "telecom": [
          {
            "system": "phone",
            "value": "555-123-4567",
            "use": "work"
          }
        ],
        "name": [
          {
            "family": "Bone",
            "given": [
              "Ronald"
            ],
            "prefix": [
              "Dr"
            ]
          }
        ],
        "address": [
          {
            "use": "work",
            "line": [
              "1003 HEALTHCARE DR"
            ],
            "city": "AMHERST",
            "state": "MA",
            "postalCode": "01002"
          }
        ],
        "gender": "male",
        "active": true,
        "extension": [
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-NPI",
            "valueString": "1992858609"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ProviderTaxId",
            "valueString": "HIH1234"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ActionRequestedCode",
            "valueCode": "A"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ServiceCode",
            "valueCode": "EEP"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ServiceStartDate",
            "valueDate": "2026-11-30"
          },
          {
            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-ServiceEndDate",
            "valueDate": "2026-12-30"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Practitioner/P101"
      }
    }
	
  ]
}

Bundle Practitioner API Response Codes

Type Code Status Resolution
Success 200 OK Request processed successfully. No action needed.
Success 201 Created Resource created successfully. No action needed.
Error 400 Bad Request Missing or invalid headers or parameters. Check request headers or parameters and resubmit.
Error 401 Unauthorized Invalid client ID or client secret. Correct the details and resubmit.
Error 403 Forbidden Insufficient permissions or server configuration issues. Contact esMD Support.
Error 404 Not Found Invalid URL. Correct the endpoint URL and resubmit.
Error 412 Precondition Failed Precondition failed. Check the conditions and resubmit.
Error 422 Unprocessable Entity Metadata failure. Update metadata and resubmit.
Error 500 Internal Server Error Unexpected server error. Contact esMD Support.
Error 502 Bad Gateway Contact esMD Support.
Error 503 Service Unavailable Contact esMD Support.

Success Response

{
    "resourceType": "Bundle",
    "id": "949cc68e-a790-4f2b-b0b8-82939ae89075",
    "meta": {
        "profile": [
            "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-BundleServiceRegistrationResponse"
        ],
        "security": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
                "code": "V",
                "display": "very restricted"
            }
        ]
    },
    "identifier": {
        "system": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-TransactionId",
        "value": "PPC0007456166EC"
    },
    "entry": [
        {
            "response": {
                "status": "201 Created",
                "location": "Practitioner/P100/_history/1",
                "etag": "1",
                "lastModified": "2026-11-17T17:40:10.591-05:00",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "extension": [
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-PractitionerId",
                            "valueString": "P100"
                        },
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-NPI",
                            "valueString": "1871540237"
                        }
                    ],
                    "issue": [
                        {
                            "severity": "information",
                            "code": "informational",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
                                        "code": "SUCCESSFUL_UPDATE_AS_CREATE",
                                        "display": "Update as create succeeded."
                                    }
                                ]
                            },
                            "diagnostics": "Successfully created resource \"Practitioner/P100/_history/1\" using update as create (ie. create with client assigned ID). Took 51ms."
                        }
                    ]
                }
            }
        },
        {
            "response": {
                "status": "200 OK",
                "location": "Practitioner/P101/_history/3",
                "etag": "3",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "extension": [
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-PractitionerId",
                            "valueString": "P101"
                        },
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-NPI",
                            "valueString": "1992858609"
                        }
                    ],
                    "issue": [
                        {
                            "severity": "information",
                            "code": "informational",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
                                        "code": "SUCCESSFUL_UPDATE",
                                        "display": "Update succeeded."
                                    }
                                ]
                            },
                            "diagnostics": "Successfully updated resource \"Practitioner/P101/_history/3\"."
                        }
                    ]
                }
            }
        }
    ]
}

Failure Responses

Example: Invalid NPI-HIH Combination

{
    "resourceType": "Bundle",
    "id": "6b937cd9-f24a-4b15-881d-bbd827595cf1",
    "type": "batch-response",
    "link": [
        {
            "relation": "self",
            "url": "http://terminology.esmduat.cms.gov:9019/fhir"
        }
    ],
    "meta": {
        "profile": [
            "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-BundleServiceRegistrationResponse"
        ],
        "security": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
                "code": "V",
                "display": "very restricted"
            }
        ]
    },
    "identifier": {
        "system": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-TransactionId",
        "value": "QPF0007456167EC"
    },
    "entry": [
        {
            "response": {
                "status": "422 Unprocessable Entity",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "extension": [
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-PractitionerId",
                            "valueString": "P100"
                        },
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-NPI",
                            "valueString": "1871540237"
                        }
                    ],
                    "issue": [
                        {
                            "severity": "error",
                            "code": "processing",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://terminology.esmduat.cms.gov:8099/fhir/CodeSystem/Esmd-CS-ErrorOrWarningCodes",
                                        "code": "COMBINATION_HIH_NPI",
                                        "display": "The Action Code R Received in the Registration Request is not allowed for NPI 1871540237 as association with the HIH OID does not exist in esMD."
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        },
        {
            "response": {
                "status": "422 Unprocessable Entity",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "extension": [
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-PractitionerId",
                            "valueString": "P101"
                        },
                        {
                            "url": "https://terminology.esmduat.cms.gov:8099/fhir/StructureDefinition/Esmd-Ext-NPI",
                            "valueString": "1992858609"
                        }
                    ],
                    "issue": [
                        {
                            "severity": "error",
                            "code": "processing",
                            "details": {
                                "coding": [
                                    {
                                        "system": "https://terminology.esmduat.cms.gov:8099/fhir/CodeSystem/Esmd-CS-ErrorOrWarningCodes",
                                        "code": "COMBINATION_NPI_HIH",
                                        "display": "The HIH OID urn:oid:123.456.657.126 and NPI 1992858609 received for Action Code A is already registered with the submitting HIH or other HIH."
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        }
    ]
}