---
title: "Confirm Appointments"
description: "Confirm requested appointments via the PATCH Appointments endpoint when an EHR requires a confirmation code."
canonical_url: "https://docs.leyr.io/api/guides/appointments/confirm-appointments"
---
# Confirm Appointments

> Confirm requested appointments via the PATCH Appointments endpoint when an EHR requires a confirmation code.

In some cases, Leyr will now prompt you to confirm an appointment that was requested (created via `POST` Appointments endpoint).
You can now use our `PATCH` Appointments endpoint to confirm such appointments.

## Why do I need to confirm appointments?

This is requested by some EHRs. We can see the most common scenario is patient-facing appointments booking (e.g. where booking an appointment is public and done by a patient, and not a practitioner).

Example of such EHR would be Anita Systems in Norway.

## When do I need to confirm appointments?

Whenever you receive `"status": "awaiting_confirmation"` in the response from creating an appointment with Leyr

```text
POST https://api.leyr.io/api/emrs/{emr}/care-units/{care_unit_id}/appointments
```

```text
{
  "id": "...",
  "start": "...",
  "end": "...",
  "status": "awaiting_confirmation",
  "comment": "...",
}
```

You don't have to worry about actual confirmation initiation - Leyr will do all the necessary steps and request your end-user with SMS or e-mail confirmation.

The only thing you have to do is to redirect your end-users to a confirmation page with an input field where they can enter a confirmation code.

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

Also, to clarify
<br />

<br />


You don't have to confirm appointments with `PATCH` endpoint if you receive `"status": "booked"` when creating an appointment. This simply means selected EHR allows direct bookings, without confirmation from the end-user.

</template>
</u-alert>

## How do I confirm appointments?

By making a following call to Leyr's `PATCH` Appointments endpoint

```text
PATCH https://api.leyr.io/api/emrs/{emr}/care-units/{care_unit_id}/appointments/{appointment_id}
```

```text
{
    "confirmation": {
        "code": "{code}"
    }
}
```

, where:

- `appointment_id` is an ID of appointment returned in response from `POST` Appointments
- `code` is a confirmation code that was sent to the end user, and which they e.g. have entered on your confirmation page

## What will happen after appointment is confirmed?

Once `PATCH` Appointments request is submitted with confirmation code, you will receive a normal response with `"status": "booked"`, if confirmation was successful.

That's when you know the appointment was properly booked on the EHR side 👍

## Next steps

<card-group>
<card icon="i-heroicons-pencil-square" title="Update Appointments" to="https://docs.leyr.io/api/guides/appointments/update-appointments">

Reschedule or modify booked appointments.

</card>

<card icon="i-heroicons-x-circle" title="Cancel Appointments" to="https://docs.leyr.io/api/guides/appointments/cancel-appointments">

Cancel one or more booked appointments.

</card>
</card-group>


## Sitemap

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