The POST user/facility Standard API endpoint unnecessarily requires facility_npi

Situation
When sending a POST request to the user/facility endpoint (i.e., /apis/default/api/facility) I am getting the following validation error:

{
“validationErrors”: {
“facility_npi”: {
“Required::NON_EXISTENT_KEY”: “facility_npi must be provided, but does not exist”
}
},
“internalErrors”: ,
“data”: ,
“links”:
}

This requirement is also present in the /swagger/openemr-api.yamlfile.

However, this is not a required field when creating a facility in OpenEMR. I created a facility with the same information as the payload in the API request and did not receive any errors.

The expected result was to be able to create a facility using the Standard API without an NPI. It makes sense not to require the facility_npi in the business logic since you can have a location without an NPI and also for international users they would not have an NPI.

OpenEMR Version
I’m using OpenEMR version 7.0.2 (3)
Also reproduced in version 7.0.3-dev

Browser:
I’m using: Google Chrome 134.0.6998.89 (Official Build) (arm64)

Operating System
I’m using: macOS 15.3.2

Search
Did you search the forum for similar questions? Yes

Logs
Did you check the logs? Yes
Was there anything pertinent in them? No

Hi Omar it’s been a while. Hope you are well.

I agree it makes sense that a facility NPI should not be required however most likely the endpoint developer may have required for ONC requirement(I don’t know if this is true) or other reporting needs.

I don’t have time to research this right now but if you could open a new bug issue, I’ll try to include in our next and first patch for 7.0.3.1

Great! Created: https://github.com/openemr/openemr/issues/8168

1 Like