Openemr api issue

Hi, I am trying to access {base_url}/apis/default/api/patient/{pid}/insurance having Api Client Application with the scope api:oemr, but it throws 401 status code. And also, there is scope like user/insurance.read and user/insurance.write in the api documentation openemr/API_README.md at rel-701 · openemr/openemr · GitHub, but there isn’t any while creating Api Client Application. Can you please help?

What do you mean by creating Api Client Application? Are you talking about the GUI registration? You can do a manual registration if you follow the API_README.md using a regular HTTP POST request to get the scopes you are interested in.

I’m attempting to access the OpenEMR API endpoint:

/apis/default/api/patient/${pid}/insurance

However, I’m receiving a 401 Unauthorized status code in response.

Steps I’ve taken so far:

  1. I registered an application via the OpenEMR GUI: Admin → System → API Clients
  2. During the registration process, I enabled all available scopes . However, I did not see the scopes user/insurance.read and user/insurance.write in the GUI — even though they are mentioned in the API_README.md documentation.
  3. In my Flutter application, I configured the registered app using the provided client_id, client_secret, and included all necessary scopes , including: openid, online_access,offline_access,launch,api:oemr,patient/Patient.read,user/insurance.read,user/insurance.write.
  4. The access token is generated successfully, but when I try to access the /apis/default/api/patient/${pid}/insurance endpoint using the token, I receive a 401 Unauthorized error.

My questions:

  • Are the user/insurance.read and user/insurance.write scopes currently supported in OpenEMR?
  • Is there any additional server-side configuration required to access this endpoint?
  • Could the issue be related to the fact that these scopes do not appear in the GUI during app registration, despite being documented?

Any help or guidance on how to resolve this and successfully access the endpoint would be greatly appreciated.