Book an Appointment

See our example use-case for booking an appointment with a doctor.
It is based on our Unified API, so you can check how one piece of code gives you connection to multiple EMR systems in one go.
Explore appointment booking
1

Care Units

Get Care Units

Typically, your first step would be to provide an end-user with a list of care units, where different healthcare services and resources can be found.
Your request to Leyr
Request
Response
1
2
3
curl --location --request GET 'https://api.leyr.io/api/emrs/cosmic/care-units' \ 
--header 'x-leyr-client-id: your-client-id' \
--header 'x-leyr-client-secret: your-client-secret'
Request
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[
    {
        "emr_id": "SE162321000024-0019936",
        "name": "Kirurgkliniken"
    },
    {
        "emr_id": "SE162321000024-0016313",
        "name": "Ögonkliniken"
    },
    {
        "emr_id": "SE2321000016-31LN",
        "name": "Surgery Clinic"
    }
]
Response from Leyr
Example end-user view
Kirurgkliniken
Ögonkliniken
Surgery Clinic
2

Resources

Get Resources

You can then get a full list available resources (doctors, rooms, roles, etc.) in the selected care unit. You can also request specific details for each of those resources.
Your request to Leyr
Request
Response
1
2
3
curl --location --request GET 'https://api.leyr.io/api/emrs/cosmic/care-units/10/resources' \ 
--header 'x-leyr-client-id: your-client-id' \
--header 'x-leyr-client-secret: your-client-secret'
Request
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[
    {
        "emr_id": "10-199107062391",
        "type": "personnel",
        "name": "Doctor Lind"
    },
    {
        "emr_id": "10-4000001",
        "type": "personnel",
        "name": "Doctor Holma"
    },
    {
        "emr_id": "10-2000003",
        "type": "role",
        "name": "Drop In"
    }
]
Response from Leyr
Example end-user view
Doctor Lind
Doctor Holma
Drop In
3

Healthcare Services

Get Healthcare Services

You can also find a list of healthcare services or categories of services available at the selected care unit.
Your request to Leyr
Request
Response
1
2
3
curl --location --request GET 'https://api.leyr.io/api/emrs/takecare/care-units/10/healthcare-services' \ 
--header 'x-leyr-client-id: your-client-id' \
--header 'x-leyr-client-secret: your-client-secret'
Request
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[
    {
        "emr_id": "10-1",
        "name": "Video consultation"
    },
    {
        "emr_id": "10-8",
        "name": "First Visit"
    },
    {
        "emr_id": "10-9",
        "name": "Follow-up Visit"
    }
]
Response from Leyr
Example end-user view
Video consultation
$$$
First Visit
$$$
Follow-up Visit
$$$
4

Time Slots

Get Available Time Slots

Based on the selected healthcare service or resource, you can find a list of available time slots for the selected care unit.
Your request to Leyr
Request
Response
1
2
3
curl --location --request GET 'https://api.leyr.io/api/emrs/takecare/care-units/10/timeslots?start=2022-12-01T00:00:00%2B02:00&end=2022-12-31T00:00:00%2B02:00&resource_id=10-7&healthcare_service_id=10-32' \ 
--header 'x-leyr-client-id: your-client-id' \
--header 'x-leyr-client-secret: your-client-secret'
Request
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[
    {
        "start": "2022-12-13T01:00:00+01:00",
        "end": "2022-12-13T01:05:00+01:00",
        "healthcare_service_id": "32",
        "healthcare_service_name": "Z Group A Limiter",
        "resource_id": "196211173148",
        "resource_name": "Tolvan Läkare (läk)"
    },
    {
        "start": "2022-14-28T01:25:00+01:00",
        "end": "2022-14-28T01:30:00+01:00",
        "healthcare_service_id": "32",
        "healthcare_service_name": "Z Group A Limiter",
        "resource_id": "196211173148",
        "resource_name": "Tolvan Läkare (läk)"
    },
    {
        "start": "2022-12-22T02:00:00+01:00",
        "end": "2022-12-22T02:05:00+01:00",
        "healthcare_service_id": "32",
        "healthcare_service_name": "Z Group A Limiter",
        "resource_id": "196211173148",
        "resource_name": "Tolvan Läkare (läk)"
    },
    {
        "start": "2022-12-28T02:25:00+01:00",
        "end": "2022-12-28T02:30:00+01:00",
        "healthcare_service_id": "32",
        "healthcare_service_name": "Z Group A Limiter",
        "resource_id": "196211173148",
        "resource_name": "Tolvan Läkare (läk)"
    }
]
Response from Leyr
Example end-user view
09 Dec 2022
SMTWTFS
5

Appointment

Book an Appointment

Finally, once your end user has selected a time slot for healthcare service and practitioner they want, you can book an appointment for them.
Your request to Leyr
Request
Response
1
2
3
4
5
6
7
8
9
10
11
12
curl --location --request POST 'https://api.leyr.io/api/emrs/takecare/appointments' \ 
--header 'x-leyr-client-id: your-client-id' \
--header 'x-leyr-client-secret: your-client-secret' \
--header 'Content-Type: application/json' \
--data-raw '{ "start": "2022-12-28T01:00:00+01:00", "end": "2022-12-28T01:05:00+01:00", "care_unit_id": "10", "healthcare_service_id": "32", "resource_id": "10-196202103138", "patient_id": 191212121212 }'
Request
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
    "emr_id": "199108082398-14084-199407062398-20221228-100-1-10-5-32",
    "start": "2022-12-28T01:00:00+02:00",
    "participants": [
        {
            "id": "199108082398",
            "role": "patient"
        },
        {
            "id": "199407062398",
            "role": "performer",
            "name": "Dr Holma"
        }
    ],
    "healthcare_services": [
        {
            "emr_id": "32",
            "name": "Acute Visit"
        }
    ]
}
Response from Leyr
Example end-user view
Book an Appointment
Care UnitCentral Hospital
Healthcare ServiceAcute Visit
DoctorDr Holma
Time Wed, 28 Dec 2022 00:00:00 GMT

Frequently Asked Questions

Here are some of the frequently asked questions about our Leyr API.

Subscribe to our newsletter

Get a summary of what we're building, how, and why. Only relevant information once a month and no spam. You can unsubscribe any time.

Stay up to date

We'd really love to stay connected with you. Follow us on LinkedIn for the latest news and updates on what's happening at Leyr!
@Leyr