---
title: "Patient IDs"
description: "Use different patient ID types, such as EHR IDs and national ID numbers, in Leyr API requests."
canonical_url: "https://docs.leyr.io/api/guides/patient-id"
---
# Patient IDs

> Use different patient ID types, such as EHR IDs and national ID numbers, in Leyr API requests.

It is possible to use different types of patient IDs in requests to Leyr API.
Get patient details, book appointments, create medical notes and documents using EHR IDs, social security numbers, national IDs and more.

## Supported Patient ID types

Following patient ID types are generally supported.

- EHR ID - internal identifier, used by EHR vendors internally
- Norwegian Personal Number - national identity number in Norway
- Swedish Personal Number - national identity number in Sweden
- NHS Number - National Health Service number in the United Kingdom
- Header - used to pass patient ID in the header parameter. [Read more](#header)

<u-alert color="warning" variant="subtle" icon="heroicons:shield-exclamation">
<template v-slot:description="">

**Security Recommendation.** Leyr recommends using the header approach to pass sensitive patient data. This helps protect against information exposure through query strings and path params in URLs, a common OWASP vulnerability. [Learn more about this vulnerability](https://owasp.org/www-community/vulnerabilities/Information_exposure_through_query_strings_in_url).

</template>
</u-alert>

Different EHR vendors support different types of patient IDs, e.g. based on the country they operate in.

<table>
<thead>
  <tr>
    <th>
      EHR
    </th>
    
    <th>
      Supported Patient ID Types
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Acuity Scheduling
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Anita Systems
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Athenaone
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Athenapractice
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Avon
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Cerner
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Cliniko
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Dentally
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      DIPS
    </td>
    
    <td>
      EHR ID, Norwegian Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      DynamicHealth
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      EasyPractice
    </td>
    
    <td>
      EHR ID, Norwegian Personal Number, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Epic
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Exact
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Frenda
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      GoSensei
    </td>
    
    <td>
      EHR ID, NHS Number
    </td>
  </tr>
  
  <tr>
    <td>
      J4
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Kaddio
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Konfidens
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      MakePlans
    </td>
    
    <td>
      EHR ID, Norwegian Personal Number, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Muntra
    </td>
    
    <td>
      EHR ID, Norwegian Personal Number, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Nextech
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Opus Dental
    </td>
    
    <td>
      EHR ID, Norwegian Personal Number, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      PasientSky
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Physica
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Pridok
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Prorenata
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Psykbase
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      SolvIT
    </td>
    
    <td>
      EHR ID, Norwegian Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Speare
    </td>
    
    <td>
      EHR ID
    </td>
  </tr>
  
  <tr>
    <td>
      Takecare
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      Vena
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
  
  <tr>
    <td>
      WebDoc
    </td>
    
    <td>
      EHR ID, Swedish Personal Number
    </td>
  </tr>
</tbody>
</table>

## Use Patient ID types

Parameters, where Patient ID is used, and where the different types can be applied:

- `patient_id` path parameter of [Get Patient Details](https://api.leyr.io/docs#tag/Patients/operation/patients-get_patient) endpoint
- `patient_id` query parameter in [Get Appointments](https://api.leyr.io/docs#tag/Appointments/operation/appointments-get_appointments) endpoint
- `patient_id` field in JSON body of [Create Appointment](https://api.leyr.io/docs#tag/Appointments/operation/appointments-create_appointment) endpoint
- `patient_id` path parameter of [Get Medical Notes](https://api.leyr.io/docs#tag/Medical-Notes/operation/medical%20notes-get_medical_notes) endpoint
- `patient_id` path parameter of [Create Medical Note](https://api.leyr.io/docs#tag/Medical-Notes/operation/medical%20notes-create_medical_note) endpoint

Where `patient_id` is passed in, e.g.

```text
GET /api/emrs/pasientsky/care-units/L0_10/appointments?patient_id=191212121212
```

or

```text
POST /api/emrs/webdoc/care-units/L0_1/patients/191212121212/medical-notes
```

as well as in all applicable cases mentioned above, it is possible to construct `patient_id` parameter, using the following structure:

```text
{patient_id_type}:{patient_id_value}
```

where currently supported `patient_id_type` are:

- `emr_id`
- `no_personal_number`
- `se_personal_number`
- `nhs_number`

## Examples

Examples of fully constructed `patient_id` are:

- `emr_id:abc_12345`
- `no_personal_number:26258605879`
- `se_personal_number:191212121212`
- `nhs_number:9434765919`

<u-alert color="primary" variant="subtle">
<template v-slot:description="">

It is also possible to skip the prefix completely, e.g. by passing only `abc_12345` as `patient_id`. In this case Leyr will treat it as `emr_id`, i.e. an internal Patient identifier, used by the target EHR system.
<br />

<br />


In practice this means `emr_id:abc_12345` and `abc_12345` are equivalent.

</template>
</u-alert>

### emr_id

```text
GET /api/emrs/pasientsky/care-units/L0_10/appointments?patient_id=emr_id:abc_12345
```

In this case Leyr will look for appointments for a patient, which **internal EHR ID** is `abc_12345`

### no_personal_number

```text
POST /api/emrs/pasientsky/care-units/L0_10/appointments

{
  "patient_id": "no_personal_number:26258605879",
  "start_time": "2022-01-01T10:00:00",
  "end_time": "2022-01-01T10:30:00",
  "resource_id": "L0_12345",
  "healthcare_service_id": "L0_12345",
}
```

In this case Leyr will look up a patient, whose **Norwegian Personal Number** is `26258605879`, and book an appointment for that patient.

### se_personal_number

```text
POST /api/emrs/webdoc/care-units/L0_1/patients/se_personal_number:191212121212/medical-notes
```

In this case Leyr will look up a patient, whose **Swedish Personal Number** is `191212121212`, and create a medical note for that patient.

### nhs_number

```text
GET /api/emrs/gosensei/care-units/L0_10/patients/nhs_number:9434765919
```

In this case Leyr will look up a patient, whose **NHS Number** is `9434765919`, and return their details.

### Nothing provided

```text
GET /api/emrs/takecare/care-units/L0_10/appointments?patient_id=abc_12345
```

The value passed there is treated as `emr_id`.
In this case Leyr will look for appointments for a patient, which **internal EHR ID** is `abc_12345`.

### header

While Leyr never logs sensitive data (including patient IDs in URLs and query parameters), it's a known issue that some intermediary servers, DNS providers, and networking tools might log URLs or query parameters as part of their standard operation. To provide our customers with an additional layer of security when handling sensitive patient information, we've implemented the ability to pass patient IDs through headers instead of URLs or request bodies.

This header-based approach ensures that sensitive patient identifiers are less likely to appear in various system logs along the request path, as headers are typically handled with more discretion in logging systems.

To use a header reference, construct the parameter value using the following structure:

```text
header:{header_name}
```

where `header_name` is the name of the header containing the actual patient ID.

In this case, Leyr will look for the patient ID in the header with the name `header_name` and take the value from there.

#### Examples

Using header reference in path parameter:

```text
Headers:
x-patient-id: se_personal_number:191212121212

GET /api/emrs/webdoc/care-units/L0_1/patients/header:x-patient-id/medical-notes
```

Using header reference in query parameter:

```text
Headers:
x-current-patient: no_personal_number:26258605879

GET /api/emrs/pasientsky/care-units/L0_10/appointments?patient_id=header:x-current-patient
```

Using header reference in request body:

```text
Headers:
x-referring-patient: emr_id:abc_12345

POST /api/emrs/pasientsky/care-units/L0_10/appointments
{
  "patient_id": "header:x-referring-patient",
  "start_time": "2022-01-01T10:00:00",
  "end_time": "2022-01-01T10:30:00",
  "resource_id": "L0_12345",
  "healthcare_service_id": "L0_12345"
}
```

The value in the referenced header must still be a valid patient ID format, as descibed in the beginning of this page.

For example, if your header contains a Swedish personal number, the header value should be `se_personal_number:191212121212`, and if you want to use EHR ID - it should be `emr_id:abc_12345` or `abc_12345` (which will be treated as an `emr_id`).

## Next steps

<card-group>
<card icon="i-heroicons-magnifying-glass" title="Find or Get Patient" to="https://docs.leyr.io/api/quickstart/find-patient">

Look up a patient and choose the correct patient_id for your requests.

</card>

<card icon="i-heroicons-identification" title="Resource IDs" to="https://docs.leyr.io/api/guides/resource-id">

Use EHR IDs, HSA IDs, and other identifier types for resources.

</card>
</card-group>


## Sitemap

See the full [sitemap](https://docs.leyr.io/sitemap.md) for all pages.
