---
title: "Link the Patient To Your PKB Organisation"
canonical: "https://wiki.patientsknowbest.com/space/api/4491968591/Link%20the%20Patient%20To%20Your%20PKB%20Organisation"
format: markdown
---
> Macro (toc)

# Why

The patient must be in your PKB organisation, with access to the appropriate privacy labels, in order to pull data out of the [PKB Aggregated endpoint](https://wiki.patientsknowbest.com/space/api/3364388935/Aggregated) for the patient.  

# Prerequisites

- A verified patient identifier (either national identifier or PKB public id) and basic demographic details to create a PKB record (first name, last name, date of birth, gender).  If you don’t already have an identifier, see the [Patient demographic retrieval](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/4504551428) page.
- API credentials – *issued by PKB once development dates have been agreed*

# How To

## Via HL7

- Send an [ADT^A28/31](https://wiki.patientsknowbest.com/space/api/3365078168/ADT+A28) message to PKB using either Organisation or Partner HL7 credentials.  The PKB integrations team will help determine which credential type will be used.
  - That demographic message will automatically create /  add the patient to the PKB organisation.
- If [auto create](https://wiki.patientsknowbest.com/space/api/3365077836/Identifiers+&+matching#Auto-create) is turned on, [any HL7 message](https://wiki.patientsknowbest.com/space/api/3364946836/HL7+Message+Scopes) sent to PKB with a verified identifier will create / add the patient to the PKB organisation.
- See PKB’s [HL7 connectivity information](https://wiki.patientsknowbest.com/space/api/4348313769/HL7+API+-+Network+Connectivity) for details on endpoints.

## Via FHIR (version STU3)

- See [PKB’s FHIR API connectivity information](https://wiki.patientsknowbest.com/space/api/4348444939/FHIR+API+-+Network+Connectivity) overview.
- Obtain a valid access token through [OAuth 2.0](https://wiki.patientsknowbest.com/space/api/3365078610/OAuth+2.0) using the [Client credentials grant workflow (example requests and responses).](https://wiki.patientsknowbest.com/space/api/3364947437/Client+credentials)
- Once you have a valid access token, use PKB’s [Messaging FHIR API](https://wiki.patientsknowbest.com/space/api/3364028560/Messaging) to add the patient to your PKB organisation.  Refer to the [example request and response](https://wiki.patientsknowbest.com/space/api/3575513089/Messaging:+Examples) for further details.