---
title: "Frequently Requested APIs"
canonical: "https://wiki.patientsknowbest.com/space/api/3363471401/Frequently%20Requested%20APIs"
format: markdown
---
> Macro (toc)

# Details For The Most Frequently Requested APIs

The tables below provide some general information about the APIs most commonly utilised by organisations extracting data from the PKB data warehouse. We recommend that customers pursuing an integration begin by looking at utilising a combination of these as a starting point.

NB - where the scope is co-ordinator or clinician, the API will only return data for which the user has team/privacy access to view.

# Measurement Data

Whether measurements have been added manually by a patient or clinician, directly from a device integration or via an integrated data feed, the API will return all the current and historical data for any patient that grants the organisation API access to their record.

|  |  |  |  |
| --- | --- | --- | --- |
| **API** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output Overview** |  |  |
| [GET /v2-beta/measurements](https://my.patientsknowbest.com/swagger-ui/index.html#/Measurements/getMeasurements)<br>Returns all current and historical measurement data for a patient. | Utilises authorisation code granted by a patient<br>Option of selecting results for specific measurement(s) or returning all. | Dates of when taken and entered into PKB, along with measurement value(s) and the PKB measurement reference value.. | REST | Patient |
| [GET /v2-beta/measurements/{patientId}](https://my.patientsknowbest.com/swagger-ui/index.html#/Measurements/getMeasurementOfPatient)<br>The current and historical measurement field data  can be extracted for a patient. | Patient PKB ID   
   
 Measurement API Ref (e.g. medication compliance) | Dates of when taken and entered into PKB, along with measurement percentage. | REST | Clinician |
| [GET /v2-beta/measurements/apiRefs](https://my.patientsknowbest.com/swagger-ui/index.html#/Measurements/getMeasurementTypes)<br>Returns a list of all the measurement types PKB supports within the User Interface. | n/a | Information about every measurement, such as the name, PKB reference, category and measurement unit(s) | REST | Public |

See our help manual for details on measurement support within PKB:

<u>[https://manual.patientsknowbest.com/patient/measurements](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Fmeasurements&sa=D&sntz=1&usg=AOvVaw0lL3D9y2U8-QUm8LA9tpla)</u>

Technical information on how data can be sent via an HL7 message feed can be found here:

<u>[https://pkbdev.atlassian.net/wiki/spaces/api/pages/3364848908/Laboratory](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/3364848908)</u>

# Care Plans

Whether a care plan has been created manually (e.g. by a patient or clinician) or via an integrated data feed, the API will return data for all the plans (including any older versions) associated with the chosen patient.

|  |  |  |  |
| --- | --- | --- | --- |
| **API Name** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output Overview** |  |  |
| [GET /v2-beta/careplans/{patientId}](https://my.patientsknowbest.com/swagger-ui/index.html#/Care%20Plans/getCarePlansForPatient)<br>For a selected patient it returns data for all available care plans and care plan versions. | Patient PKB ID | For each care plan it will return general information such as: date created, care plan name, version No., date last edited, next review data and the associated patient id.   
   
 Data will also be provided on which user created the plan and who last edited it. | REST | Clinician<br>Coordinator |

See our help manual for information on how Care plans are supported within PKB:

<u>[https://manual.patientsknowbest.com/patient/plans](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Fplans&sa=D&sntz=1&usg=AOvVaw1yMfcjICpeQZhOgk5ACP_f)</u>

Technical information on how data can be sent via an HL7 message feed can be found here:

<u>[https://pkbdev.atlassian.net/wiki/spaces/api/pages/3365012559/Care+Plan](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/3365012559)</u>

# Allergies

Whether allergy information has been added manually (e.g. by the patient) or via an integrated data feed, the API will return all related data for a chosen patient that the API authorising clinician has medical record access for.

|  |  |  |  |
| --- | --- | --- | --- |
| **API Name** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output Overview** |  |  |
| [GET /v2-beta/allergies/forPatient/{patientId}](https://my.patientsknowbest.com/swagger-ui/index.html#/Allergies/getAllergiesForPatient)<br>Returns all recorded allergies for a chosen patient | Patient PKB ID | Information for every recorded allergy.  Including the code, name, date of onset, date entered, reactions and severity. | REST | Clinician |

See our help manual for information on how Allergy information is supported within PKB:

<u>[https://manual.patientsknowbest.com/patient/allergies](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Fallergies&sa=D&sntz=1&usg=AOvVaw2q5Ef63tZlOToG_R3KQIjh)</u>

Technical information on how data can be sent via an HL7 message feed can be found here:

<u>[https://pkbdev.atlassian.net/wiki/spaces/api/pages/3365078168/ADT+A28](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/3365078168)</u>

# Diagnosis

Whether diagnosis information has been added manually (e.g. by the patient) or via an integrated data feed, the API will return all related data for a chosen patient that the API authorising clinician has medical record access for. There is also the option to only return diagnosis data for entries entered after a chosen date.

|  |  |  |  |
| --- | --- | --- | --- |
| **API Name** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output Overview** |  |  |
| [GET /v2-beta/diagnoses/forPatient/{patientId}](https://my.patientsknowbest.com/swagger-ui/index.html#/Diagnoses/getDiagnosesForPatient)<br>Returns all recorded diagnosis for a chosen patient (past and current) | Patient PKB ID<br>Optionally, a date can be given to only return diagnosis with an entered date from that point forward. | Information for every recorded diagnosis.  Including the code, name, date of onset, date entered, reactions and severity. | REST | Clinician |

See our help manual for information on how Diagnosis information is supported within PKB:

<u>[https://manual.patientsknowbest.com/patient/diagnoses](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Fdiagnoses&sa=D&sntz=1&usg=AOvVaw23_wtRHavrwhLLqRHTaSgI)</u>

Technical information on how data can be sent via an HL7 message feed can be found here:

<u>[https://pkbdev.atlassian.net/wiki/spaces/api/pages/3365078168/ADT+A28](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/3365078168)</u>

# Test Results

Whether test results have been added manually (e.g. by the patient) or have been sent in via an integrated data feed, the API will return all the available results for a chosen patient. The test result data contains identifying information for the test, along with all the related result(s) values (there may be multiple returns where a test is undertaken multiple times) and any identifying codes.

|  |  |  |  |
| --- | --- | --- | --- |
| **API Name** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output** |  |  |
| [GET /v1/tests/results/all](https://my.patientsknowbest.com/swagger-ui/index.html#/Tests/getTestResults)<br>Returns all tests results for a patient | Patient selected is defined from the access code used to generate the API token. | Returns all data for every test result recorded in PKB for the patient.   
   
 Each individual test is returned and for each one the fields providing name, description, notes, result and code data are displayed. | REST | Patient |
| [GET /v1/tests/results/forPatient/byTestIds](https://my.patientsknowbest.com/swagger-ui/index.html#/Tests/getTestResultsForPatientByTestIds)<br>Returns all tests results for a patient.  NB - Filtering of results by LOINC id is supported | Patient PKB ID<br>Optionally - LOINC id (singular or multiple) | REST | Clinician |

See our help manual for information on how Test result information is supported within PKB:

<u>[https://manual.patientsknowbest.com/patient/tests](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Ftests&sa=D&sntz=1&usg=AOvVaw10dpkSBVPgVSZOYVR2wmXv)</u>

Technical information on how Test result data can be sent via an HL7 message feed can be found here:

<u>[https://pkbdev.atlassian.net/wiki/spaces/api/pages/3364848908/Laboratory](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/3364848908)</u>

# Messages

Returns the messages sent between a patient and clinician(s) via the PKB interface. Messages are returned within the context of a conversation, which ensures that the whole conversation thread is provided.

An additional API (<u>[GET /attachments/{id}](https://www.google.com/url?q=https%3A%2F%2Fsandbox.patientsknowbest.com%2Fapi%2F%23!%2FAttachments%2FgetAttachment&sa=D&sntz=1&usg=AOvVaw3hj5ftYz4NfqFYjMcHTzJI)</u>) is also available to enable the extraction of any document attachments linked to a message.

|  |  |  |  |
| --- | --- | --- | --- |
| **API Name** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output** |  |  |
| [GET /messages/after/{timestamp}](https://my.patientsknowbest.com/swagger-ui/index.html#/Messages/getMessagesSince)<br>Returns conversations between a patient and clinician.  Includes all messages in the thread, along with attachment details. | Message Date -  returns any conversations where a message has been sent after the specified date.<br>Set a limit for the number of conversation threads returned. | Conversations between the patient and all clinicians<br>Returns all messages in the conversation, displaying content, attachment details, sender and recipient info (including name) and message status | REST | Patient |
| Conversations between the clinician and any patients. Returns the same message data as above. | Clinician |

See our help manual for information on how Test result information is supported within PKB:

Patient perspective -[ ](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Fevents-messages&sa=D&sntz=1&usg=AOvVaw3KGUcb-zsSj-WuyxgQ421v)<u>[https://manual.patientsknowbest.com/patient/events-messages](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fpatient%2Fevents-messages&sa=D&sntz=1&usg=AOvVaw3KGUcb-zsSj-WuyxgQ421v)</u>

Clinician perspective -[ ](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fprofessional%2Fmessages&sa=D&sntz=1&usg=AOvVaw3HP55obys-VWPfCzeMuyuu)<u>[https://manual.patientsknowbest.com/professional/messages](https://www.google.com/url?q=https%3A%2F%2Fmanual.patientsknowbest.com%2Fprofessional%2Fmessages&sa=D&sntz=1&usg=AOvVaw3HP55obys-VWPfCzeMuyuu)</u>

# Finding Patient PKB ID with Demographics

The API calls below make it possible to extract the demographics, basic metrics and the internal PKB ID information for an individual patient or all patients a clinician or coordinator have access to.

The internal PKB ID is a parameter required for a number of the PKB APIs, so the use of the below APIs often form part of data extraction workflows.

|  |  |  |  |
| --- | --- | --- | --- |
| **API Name** | **Brief Description** | **API Type** | **Scope** |
| **Parameters** | **Output** |  |  |
| [GET /v2-beta/users/byNationalId/{nationalId}/{nationalIdType}](https://my.patientsknowbest.com/swagger-ui/index.html#/Users/getNationalNumberByPatientId)<br>Returns the PKB id, patient metrics and demographics for a chosen patient. Note - can support searching across the whole org or network with coordinator scoped access. | Patient national identifier (e.g. NHS number) | Internal PKB ID<br>Patient metrics such as height and weight.<br>Patient demographics including name, dob, address, contact details (i.e. email, phone number), gender, date deceased (where applicable) | REST | Patient<br>Clinician<br>Coordinator |
| [GET /v1/users/self/patients](https://my.patientsknowbest.com/swagger-ui/index.html#/Users/getMyPatients)<br>Returns the PKB id, patient metrics and demographics for all patient records in their list of accessible patient records. | **n/a** - as derived by the access to data defined by the Scope (e.g all patient records a coordinator has access to). | Internal PKB ID<br>Patient metrics such as height and weight.<br>Patient demographics including name, dob, address, contact details (i.e. email, phone number), gender, date deceased (where applicable) | REST | Clinician<br>Coordinator |

Technical information on how patient demographic data can be sent via an HL7 message feed can be found here:

<u>[https://pkbdev.atlassian.net/wiki/spaces/api/pages/3365078168/ADT+A28](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/3365078168)</u>