---
title: "Extract Patient"
canonical: "https://wiki.patientsknowbest.com/space/api/5150474272/Extract%20Patient"
format: markdown
---
> Macro (toc)

## What

> Macro (excerpt)
> 
> Enables you to pull out the current patient demographics held against the patients PKB record.  See the [Validation and Business rules](https://wiki.patientsknowbest.com/space/api/3364388935/Aggregated#Validation-and-business-rules) section for further details on what is included in the Aggregated endpoint.

## Prerequisites

- You must have an identifier (national id or PKB public id) for the patient.
- You must have [access to the data in the patient’s PKB record](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/4491968591).
  - The patient’s PKB record must be in your PKB organisation.
- [Obtain an access token to the Aggregated FHIR endpoint](https://wiki.hub.patientsknowbest.com/wiki/spaces/api/pages/4513202208).

## How to

> Macro (excerpt)
> 
> - With a valid token, call the base URL with the Patient resource, using the patient’s identifier (with the corresponding system)
>   - *National ID Example: *[https://aggregated-fhir.sandbox.patientsknowbest.com/fhir/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number%7C9571270652](https://aggregated-fhir.sandbox.patientsknowbest.com/fhir/Appointment?actor:Patient.identifier=https://fhir.nhs.uk/Id/nhs-number%7C9571270652)
>   - *PKB Public ID Example:* [https://aggregated-fhir.sandbox.patientsknowbest.com/fhir/Patient?identifier=http://fhir.patientsknowbest.com/id/public-id%7C1d4a8b2d-f885-499f-ba51-50600312f316](https://aggregated-fhir.sandbox.patientsknowbest.com/fhir/Appointment?actor:Patient.identifier=http://fhir.patientsknowbest.com/id/public-id%7C1d4a8b2d-f885-499f-ba51-50600312f316)
> - A FHIR bundle is returned to you in json format with all of the patient’s demographics that are in their PKB record.

> Macro (excerpt)
> 
> ## Useful links
> 
> - Further information on [connectivity and endpoints](https://wiki.patientsknowbest.com/space/api/4348444939/FHIR+API+-+Network+Connectivity).
> - PKB uses the [Patient](https://hl7.org/fhir/R4/patient.html) FHIR resource.  [You can read the full capability statement here.](https://wiki.patientsknowbest.com/space/api/3364389010/Capabilities:+Aggregated+Endpoint#Appointment)
> - Read more about how [PKB maps any non-FHIR patient data (HL7 or UI entered) to FHIR](https://wiki.patientsknowbest.com/space/api/3711074317/Aggregated+Patient).

## **Example**

> Macro (excerpt)
> 
> Here’s an example response for pulling all of this patient’s demographic data
> 
> <span style="color: #36b37e">**GET**</span>** **[https://aggregated-fhir.sandbox.patientsknowbest.com/fhir/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number%7C9994179586](https://aggregated-fhir.sandbox.patientsknowbest.com/fhir/Appointment?actor:Patient.identifier=https://fhir.nhs.uk/Id/nhs-number%7C9571270652)
> 
> ```json
> {
>     "resourceType": "Bundle",
>     "meta": {
>         "versionId": "0",
>         "lastUpdated": "2026-02-06T11:08:15.764+00:00"
>     },
>     "type": "searchset",
>     "total": 1,
>     "link": [
>         {
>             "relation": "first",
>             "url": "/fhir/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number%7C9994179586&page=1"
>         },
>         {
>             "relation": "self",
>             "url": "/fhir/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number%7C9994179586"
>         }
>     ],
>     "entry": [
>         {
>             "link": [
>                 {
>                     "relation": "self",
>                     "url": "http://fhir-server-sandboxaggregated-sandbox.sandbox.svc.cluster.local.:8080/Patient/c26c3156-9196-3fef-ae5e-357721245c91"
>                 }
>             ],
>             "fullUrl": "http://fhir-server-sandboxaggregated-sandbox.sandbox.svc.cluster.local.:8080/Patient/c26c3156-9196-3fef-ae5e-357721245c91",
>             "resource": {
>                 "resourceType": "Patient",
>                 "id": "c26c3156-9196-3fef-ae5e-357721245c91",
>                 "meta": {
>                     "extension": [
>                         {
>                             "url": "http://fhir.patientsknowbest.com/structuredefinition/version-persisted",
>                             "valueDateTime": "2026-02-06T10:10:16.057+00:00"
>                         },
>                         {
>                             "url": "ex:createdAt",
>                             "valueInstant": "2026-02-06T10:10:18.765009Z"
>                         }
>                     ],
>                     "versionId": "9045996",
>                     "lastUpdated": "2026-02-06T10:11:44.420924Z"
>                 },
>                 "extension": [
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/default-account",
>                         "valueReference": {
>                             "identifier": {
>                                 "system": "urn:uuid:cd97da65-0aa4-43a6-b695-cfd0c6f3267d",
>                                 "value": "0c71b08b-38f8-4973-aaff-e4103151cd42"
>                             }
>                         }
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/status",
>                         "valueString": "EMAIL_CONFIRMED"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/registered-on",
>                         "valueDateTime": "2026-02-06T10:11:30.822+00:00"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/language-code",
>                         "valueString": "en"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/time-zone-id",
>                         "valueString": "Europe/London"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/two-factor-auth-state",
>                         "valueString": "DISABLED"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/notification-option",
>                         "valueString": "MAX_ONE_EMAIL_PER_DAY"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/status-date",
>                         "valueDateTime": "2026-02-06T10:11:30.895+00:00"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/user-type",
>                         "valueString": "PATIENT"
>                     },
>                     {
>                         "url": "http://fhir.patientsknowbest.com/structuredefinition/source-organization-time-zone-id",
>                         "valueString": "Europe/London"
>                     }
>                 ],
>                 "identifier": [
>                     {
>                         "system": "http://fhir.patientsknowbest.com/id/pkbperson-legacy-identifier",
>                         "value": "15139023"
>                     },
>                     {
>                         "system": "http://fhir.patientsknowbest.com/id/public-id",
>                         "value": "2f244205-96ea-4101-8944-9d4ea699bf32"
>                     },
>                     {
>                         "extension": [
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/id/nationalid-legacy-identifier",
>                                 "valueDecimal": 15139026
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/access-route",
>                                 "valueCoding": {
>                                     "system": "http://fhir.patientsknowbest.com/codesystem/access-route",
>                                     "code": "HL7_API",
>                                     "display": "Integration (HL7)"
>                                 }
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/created-date",
>                                 "valueDateTime": "2026-02-06T10:10:16.232+00:00"
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/entered-date",
>                                 "valueDateTime": "2026-02-06T10:06:00.000+00:00"
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/version-persisted",
>                                 "valueDateTime": "2026-02-06T10:10:16.232+00:00"
>                             }
>                         ],
>                         "system": "https://fhir.nhs.uk/Id/nhs-number",
>                         "value": "9994179586"
>                     }
>                 ],
>                 "name": [
>                     {
>                         "family": "Smith",
>                         "given": [
>                             "Joan"
>                         ],
>                         "prefix": [
>                             "Mrs"
>                         ]
>                     }
>                 ],
>                 "telecom": [
>                     {
>                         "extension": [
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/contact-confirmed",
>                                 "valueBoolean": true
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/id/personcontact-legacy-identifier",
>                                 "valueDecimal": 15139024
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/access-route",
>                                 "valueCoding": {
>                                     "system": "http://fhir.patientsknowbest.com/codesystem/access-route",
>                                     "code": "HL7_API",
>                                     "display": "Integration (HL7)"
>                                 }
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/created-date",
>                                 "valueDateTime": "2026-02-06T10:10:16.066+00:00"
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/entered-date",
>                                 "valueDateTime": "2026-02-06T10:06:00.000+00:00"
>                             },
>                             {
>                                 "url": "http://fhir.patientsknowbest.com/structuredefinition/version-persisted",
>                                 "valueDateTime": "2026-02-06T10:11:30.821+00:00"
>                             }
>                         ],
>                         "system": "email",
>                         "value": "joan_smith@pkbtest.com",
>                         "rank": 1
>                     }
>                 ],
>                 "gender": "female",
>                 "birthDate": "1980-07-08",
>                 "address": [
>                     {
>                         "line": [
>                             "14B Rowan Lane"
>                         ],
>                         "city": "Leeds",
>                         "state": "West Yorkshire",
>                         "postalCode": "LS19 9AD",
>                         "country": "GB-ENG"
>                     }
>                 ]
>             },
>             "search": {
>                 "mode": "match"
>             }
>         }
>     ]
> }
> ```