Mercury Alert Logo API Endpoints

Description

At Mercury, we use the following terms that are referred to throughout this document:

User Endpoints

Create User

Get User Information

{
    "name": "John Smith",
    "phone_number": "+15550001",
    "email": "johnsmith@email.com"
}

Get Devices for a User

{
    "devices": [
        {
            "device_id": "mercury-example-0",
            "name": "Bedroom",
            "current_state": "fall",
            "time_in_state_minutes": 10
        },
        {
            "device_id": "mercury-example-1",
            "name": "Dad",
            "current_state": "fall",
            "time_in_state_minutes": 1
        },
    ]
}

Device Endpoints

Get Device Information

{
    "device_id": "mercury-example-1",
    "name": "Dad",
    "current_state": "fall",
    "time_in_state_minutes": 1
}

Get Caregivers for a Device

{
    "user_caregivers": [
        {
            "user_id": "ce689ddf-f359-4b9e-83ce-2d2dac44bbfa",
            "name": "John Smith",
            "email": "johnsmith@email.com",
            "phone_number": "+15550001"
        },
        {
            "user_id": "6b19fce6-31c8-4866-99a7-3ee4bfb8f423",
            "name": "Jane Doe",
            "email": "jane.doe1234@email.com",
            "phone_number": "+15550002"
        }
    ]
}

Get Owner for a Device

{
    "user_owner": {
        "user_id": "ce689ddf-f359-4b9e-83ce-2d2dac44bbfa",
        "name": "John Smith",
        "email": "johnsmith@email.com",
        "phone_number": "+15550001"
    }
}

Alert Settings Endpoints

Get Alert Settings for a Device

{
    "is_daily_update_enabled": true,
    "is_offline_notification_enabled": true,
    "is_out_of_bed_notification_enabled": true,
    "is_sitting_notification_enabled": true,
    "is_in_bed_notification_enabled": true,
    "is_fall_notification_enabled": true,
    "is_automatic_notification_period_enabled": false, 
    "is_notifications_enabled": true,
    "is_standing_notification_enabled": false,
    "is_caregiver_two_way_audio_enabled": true,
    "is_leaving_room_notification_enabled": false,
    "notification_start_time": {
        "hour": 14,
        "minute": 23,
        "timezone": "US/Pacific"
    },
    "notification_end_time": {
        "hour": 14,
        "minute": 23,
        "timezone": "US/Pacific"
    }
}

Update Alert Settings for a Device

{
    "is_daily_update_enabled": true,
    "is_sitting_notification_enabled": true,
    "is_in_bed_notification_enabled": true,
    "is_fall_notification_enabled": true,
    "is_automatic_notification_period_enabled": false, 
    "is_notifications_enabled": true,
    "is_standing_notification_enabled": false,
    "is_caregiver_two_way_audio_enabled": true,
}

Analytics Endpoints

Get In/Out Bed Detections for the Last 7 Days

{
    "2024-07-16": [
        {
            "night_date": "2024-07-16",
            "state": "in_bed",
            "start_time": "2024-07-16 23:58:45.193867",
            "end_time": "2024-07-17 00:23:45.193867",
            "duration_minutes": 25
        },
        {
            "night_date": "2024-07-16",
            "state": "out_of_bed",
            "start_time": "2024-07-16 23:58:45.193867",
            "end_time": "2024-07-17 00:23:45.193867",
            "duration_minutes": 25
        },
        ...
    ]
}

Get Safety Score

{
    "2024-07-16": 92,
    "2024-07-15": 91,
    "2024-07-14": 36,
    "2024-07-13": 74,
    "2024-07-12": 88,
    "2024-07-11": 94,
    "2024-07-11": 53,
}

Get Top Hours Left Bed

{
    "top_times": [
        {
            "hour": 0,
            "percentage": 65
        },
        {
            "hour": 3,
            "percentage": 35
        }
    ]
}

Get Average Time Spent In Bed, Out of Bed, and Sitting (Last 7 Days)

{
    "in_bed": 36,
    "out_of_bed": 192,
    "sitting": 12
}

Get Average Number of Times Getting In/Out of Bed and Sitting

{
    "in_bed": 5,
    "out_of_bed": 2,
    "sitting": 1,
}

Get Averages Across All Devices

{
    "duration": {
        "in_bed_minutes": 100,
        "out_of_bed_minutes": 30,
        "sitting": 10,
    },
    "occurrences": {
        "in_bed": 5,
        "out_of_bed": 2,
        "sitting": 1,
    },
    "safety_score": 84
}