Document upload/retrieval using API is not working as expected

I’m uploading documents using the /api/patient/99185485-1eb9-4154-8f09-cbc468fb024c/document?path=test endpoint. Storing the Document works. At least i get a 200 response with ‘true’ back.

My problem is however twofold:

  1. The files does not show up in the UI under the test category (the test category is present).
  2. When i use /api/patient/99185485-1eb9-4154-8f09-cbc468fb024c/document?path=test endpoint to retrieve the patient documents again, i get a 404.

The query that is being used is " SELECT doc.url,, doc.mimetype, doc.docdate FROM documents doc JOIN categories_to_documents ctd on ctd.document_id = WHERE ctd.category_id = ? and doc.foreign_id = ? and doc.deleted = 0". Where categoryId is the categoryID and foreignID is the $pid. However if i look in the database, this foreignId is not stored.

Is this a bug or am i doing something wrong?

OpenEMR Version
I’m using OpenEMR version latest

I’m using postman

Operating System
I’m using macOS

Did you search the forum for similar questions?


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

I understand the problem already. patient UUID’s in the FHIR API are not exchangeable for pid’s in the normal api. This in itself is not the problem, however the FHIR API’s don’t return the pids.

In fhir there is concept of resource Id’s and logical Id’s. Have you ever considered returning the pid as a logical id? it would make switching between both API’s considerably easier.