ButterflyMX API V3

API Endpoint

OAuth2 Authentication

ButterflyMX API V3 implements Resource Owner Credentials (Password) Flow with refresh_token

Obtaining access_token

To obtain a valid access_token and refresh_token, you can send your $CLIENT_ID, $CLIENT_SECRET and Resource Owner’s $USERNAME and $PASSWORD

curl -X POST "https://accountstest.butterflymx.com/oauth/token" \
  -d grant_type=password \
  -d client_id=$CLIENT_ID \
  -d client_secret=$CLIENT_SECRET \
  --data-urlencode "username=$USERNAME"\
  --data-urlencode "password=$PASSWORD"

Response sample in case of success:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "access_token": "eyJ0eXAi...TcV3Q",
    "token_type": "bearer",
    "expires_in": 7200,
    "refresh_token": "6d8cd1d...9f75",
    "created_at": 1506068201
}

Response sample in case that your $CLIENT_ID doesn’t exist, or you didn’t include your $CLIENT_SECRET in the request:

{
  "error": "invalid_client",
  "error_description": "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."
}

Renewal of the access_token

After access_token expiration, an app can call the same API authentication endpoint to exchange the refresh_token for a new, valid access_token:

curl -X POST "https://accountstest.butterflymx.com/oauth/token" \
  -d grant_type=refresh_token \
  -d refresh_token=6d8cd1d...9f75 \
  -d client_id=$CLIENT_ID \
  -d client_secret=$CLIENT_SECRET

Response sample in case of success:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "access_token": "eyJ0eXAi...",
    "token_type": "bearer",
    "expires_in": 7200,
    "refresh_token": "6d8cd1d...",
    "created_at": 1506068601
}

Note: After successful refresh action, the mobile app has to store new access_token and refresh_token (both are changed)!

Last issued refresh_token doesn’t expire (it is valid indefinitely) but is still subject to invalidation for other reasons. In case that on the renewal request server responds with HTTP status 401, the app should immediately log-off user.

Response status 401, in this case, means that this refresh_token is invalid and refresh operation will not be possible. For example, if the mobile phone is stolen or compromised, the refresh_token can be invalidated on the server side.


User Password Change

Users can change their password by sending a PUT or PATCH request to the ButterflyMX Accounts API. All password change requests need to include the access_token in the Authorization header like this:

curl -X PUT 'https://accounts.butterflymx.com/api/v1/password' \
  -H 'Authorization:Bearer eyJ0eXAi...TcV3Q' \
  --data-urlencode 'account[current_password]=password' \
  --data-urlencode 'account[password]=new_password' \
  --data-urlencode 'account[password_confirmation]=new_password'

In case of the successful password change, the server will return HTTP status 204 No Content.

In case that current password was not correct, the server will respond with a ‘Wrong password’ message in the errors key, like this:

HTTP/1.1 422 Unprocessable Entity
  Content-Type: application/json

  { "errors" : "Wrong password" }

In case of any other errors while updating password, full error messages will be returned. The most common (and probably only) case where this could happen is when there is a password and password_confirmation values mismatch, like this:

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{ "errors" : ["Password confirmation doesn't match Password"] }

User Roles

Authenticated user can have any of the following roles (authorizations):

  • Tenant

  • Unit Admin

  • Zone Admin

  • Building Admin

Data Models

ButterflyMX Building model is divided into zones (e.g., residential, business, etc.). Zones can’t overlap. Each zone can contain many units. A unit can be apartment, office, garage, etc.

  • building has many zones

  • zone belongs to only one building

  • zone has many units

  • unit belongs to only one zone

  • user can be a tenant in many units

  • unit can have many tenants (users)

Building Data Model


JSON API Specification

ButterflyMX API V3 implements latest JSON API Specification (v1.0) published at: http://jsonapi.org/format/

Pagination

Pagination use query parameters such as page[number] and page[size].

For example:

GET https://apitest.butterflymx.com/v3/door_releases?page[size]=10&?page[number]=2
Accept: application/vnd.api+json

Sorting

Note: Examples are not url-encoded for a better readability

Example:

GET https://apitest.butterflymx.com/v3/door_releases?sort=name,created_at
Accept: application/vnd.api+json

Multiple Sort You can sort on multiple fields like this:

GET https://apitest.butterflymx.com/v3/door_releases?sort=name,created_at
Accept: application/vnd.api+json

Descendant Sort Note: The sort order for each attribute is ascending unless it is prefixed with a minus (U+002D HYPHEN-MINUS, -), in which case it is descending.

You can make desc sort with the character - like this:

GET https://apitest.butterflymx.com/v3/door_releases?sort=-created_at
Accept: application/vnd.api+json

Multiple Sort with Descendant Sort

GET https://apitest.butterflymx.com/v3/door_releases?sort=-created_at,name
Accept: application/vnd.api+json

The above example should return the newest door releases first. Any door release created on the same moment then be sorted by their name in ascending alphabetical order.

Filtering

Examples:

GET https://apitest.butterflymx.com/v3/door_releases?filter[unit]=11
Accept: application/vnd.api+json

or

GET https://apitest.butterflymx.com/v3/door_releases?filter[unit]=11&filter[user]=22
Accept: application/vnd.api+json

Check each resource to see which fields can be filtered.

Some endpoints can have other resources included, check the endpoint documentation to see which resources can be included for that endpoint.

Example:

GET https://apitest.butterflymx.com/v3/me?include=buildings,units
Accept: application/vnd.api+json

You can read more about includes here

Buildings

Buildings

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration* etc.)

List / Show Change Create Delete
Tenant - - - -
Unit Admin - - - -
Zone Admin - - - -
Building Admin - -

Fields that can be changed by the building admin:

  • name (String)

  • time_zone (String)

  • building_type (String)

  • display_name_strategy (String), one of the allowed values:

    • building
    • custom
    • first_name_and_last_name
    • first_name_initial_and_last_name
    • anonymous
    • first_name_and_last_name_initial
  • send_panel_status_report (Boolean)

  • panel_logo (File)

  • mobile_logo (File)

  • remove_panel_logo (Boolean)

  • remove_mobile_logo (Boolean)

  • qr_key_enabled (Boolean)

  • door_release_pin (String)

  • in_unit_phone_number (String)

  • address_1 (String)

  • address_2 (String)

  • city (String)

  • state (String)

  • zip_code (String)

  • phone_number (String)

  • country (String)

GET /v3/buildings
Requestsreturns the list of the buildings

GET  /v3/buildings

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "1",
      "type": "buildings",
      "attributes": {
        "name": "Roob-Gutmann-1",
        "building_type": "multi_family",
        "display_name_strategy": "last_name_and_first_name_initial_capitalized",
        "door_release_pin": false,
        "qr_key_enabled": true,
        "nfc_enabled": false,
        "send_panel_status_report": false,
        "mobile_logo_picture": {
          "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
          "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
        },
        "panel_logo_picture": {
          "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
          "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
        },
        "address_1": "795 Willa Port",
        "address_2": "West Beulah, PA 68120",
        "city": "West Beulah",
        "state": "Pennsylvania",
        "zip_code": "68120",
        "phone_number": "409.350.3129 x098",
        "country": "us",
        "time_zone": "Etc/UTC",
        "time_zone_offset": "+00:00"
      },
      "relationships": {
        "panels": {
          "data": [
            {
              "id": "1",
              "type": "panels"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "id": "1",
      "type": "panels",
      "attributes": {
        "name": "Janiya Underpass"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/buildings?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/buildings?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/buildings?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

List
GET/v3/buildings


GET /v3/buildings/3
Requestsreturns the building data

GET  /v3/buildings/3

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "3",
    "type": "buildings",
    "attributes": {
      "name": "Koepp-Miller-3",
      "building_type": "multi_family",
      "display_name_strategy": "first_name_initial_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": true,
      "nfc_enabled": false,
      "send_panel_status_report": false,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "address_1": "1037 Donnelly Mills",
      "address_2": "West Stanleyview, MA 13967-0058",
      "city": "West Stanleyview",
      "state": "Massachusetts",
      "zip_code": "13967-0058",
      "phone_number": "878.941.4706 x600",
      "country": "us",
      "time_zone": "Etc/UTC",
      "time_zone_offset": "+00:00"
    },
    "relationships": {
      "panels": {
        "data": [
          {
            "id": "2",
            "type": "panels"
          }
        ]
      }
    }
  }
}

Show
GET/v3/buildings/{id}

URI Parameters
HideShow
id
number (required) Example: 3

PATCH /v3/buildings/5
Requestsupdates the building dataupdates the building addressdoes not update the building addressremoves the panel_logo

PATCH  /v3/buildings/5

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "buildings",
    "id": "5",
    "attributes": {
      "name": "My Building",
      "building_type": "commercial_office",
      "display_name_strategy": "first_name_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": false,
      "send_panel_status_report": true,
      "time_zone": "Eastern Time (US & Canada)"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "5",
    "type": "buildings",
    "attributes": {
      "name": "My Building",
      "building_type": "commercial_office",
      "display_name_strategy": "first_name_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": false,
      "nfc_enabled": false,
      "send_panel_status_report": true,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "address_1": "487 Langworth Walks",
      "address_2": "Seanton, LA 16243-4450",
      "city": "Seanton",
      "state": "Louisiana",
      "zip_code": "16243-4450",
      "phone_number": "(337) 450-8242 x2853",
      "country": "us",
      "time_zone": "Eastern Time (US & Canada)",
      "time_zone_offset": "-04:00"
    },
    "relationships": {
      "panels": {
        "data": [
          {
            "id": "3",
            "type": "panels"
          }
        ]
      }
    }
  }
}

PATCH  /v3/buildings/7

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "buildings",
    "id": "7",
    "attributes": {
      "address_1": "New Building Address"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "7",
    "type": "buildings",
    "attributes": {
      "name": "Mante, Hahn and Gottlieb-7",
      "building_type": "multi_family",
      "display_name_strategy": "first_name_initial_and_last_name",
      "door_release_pin": false,
      "qr_key_enabled": true,
      "nfc_enabled": false,
      "send_panel_status_report": false,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "address_1": "New Building Address",
      "address_2": "Lake Gregoryside, SC 27840",
      "city": "Lake Gregoryside",
      "state": "South Carolina",
      "zip_code": "27840",
      "phone_number": "(474) 240-2972 x2292",
      "country": "us",
      "time_zone": "Etc/UTC",
      "time_zone_offset": "+00:00"
    },
    "relationships": {
      "panels": {
        "data": [
          {
            "id": "4",
            "type": "panels"
          }
        ]
      }
    }
  }
}

PATCH  /v3/buildings/9

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "buildings",
    "id": "9",
    "attributes": {
      "address_1": ""
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/address.address_1"
      },
      "detail": "can't be blank"
    }
  ]
}

PATCH  /v3/buildings/11

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "remove_panel_logo": true
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "11",
    "type": "buildings",
    "attributes": {
      "name": "Zemlak-Barrows-11",
      "building_type": "multi_family",
      "display_name_strategy": "last_name_and_first_name_initial_capitalized",
      "door_release_pin": false,
      "qr_key_enabled": true,
      "nfc_enabled": false,
      "send_panel_status_report": false,
      "mobile_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": null,
        "medium_url": null
      },
      "address_1": "386 Trey Plains",
      "address_2": "Strosinbury, NC 11528-9799",
      "city": "Strosinbury",
      "state": "North Carolina",
      "zip_code": "11528-9799",
      "phone_number": "1-812-224-9160 x86247",
      "country": "us",
      "time_zone": "Etc/UTC",
      "time_zone_offset": "+00:00"
    },
    "relationships": {
      "panels": {
        "data": [
          {
            "id": "6",
            "type": "panels"
          }
        ]
      }
    }
  }
}

Update
PATCH/v3/buildings/{id}

URI Parameters
HideShow
id
number (required) Example: 5

Current User

Status

Possible status values:

When call is VOIP:

  • initializing

  • canceled

  • timeout_online_signal

  • voip_connected

When call is mobile:

  • initializing

  • canceled

  • timeout_online_signal

  • connecting_sip

  • voip_rollover

  • rejected

GET /v3/me/calls/58e3aee1-5a57-4542-92bc-271491f3c466/status
Requestsreturns status of the callreturns not found

GET  /v3/me/calls/58e3aee1-5a57-4542-92bc-271491f3c466/status

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1",
    "type": "call_statuses",
    "attributes": {
      "status": "initializing",
      "multiple_devices": false,
      "created_at": "2019-09-12T10:41:47Z"
    },
    "relationships": {
      "call": {
        "data": {
          "id": "1",
          "type": "calls"
        }
      }
    }
  },
  "included": [
    {
      "id": "1",
      "type": "calls",
      "attributes": {
        "guid": "58e3aee1-5a57-4542-92bc-271491f3c466",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z",
        "logged_at": "2019-09-12T10:41:38Z",
        "panel_id": 7,
        "panel_name": "Denesik Creek",
        "panel_sip": "panel_7"
      }
    }
  ]
}

GET  /v3/me/calls/DOES_NOT_EXIST/status

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses404
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "title": "Record not found",
      "detail": "Couldn't find Call with [WHERE `units_users`.`deleted_at` IS NULL AND `units_users`.`user_id` = ? AND `calls`.`guid` = ?]"
    }
  ]
}

Call Status
GET/v3/me/calls/{call_guid}/status

URI Parameters
HideShow
call_guid
string (required) Example: 58e3aee1-5a57-4542-92bc-271491f3c466

Calls

Sortable fields:

  • created_at

  • logged_at

  • notification_type

  • call_type

Filterable fields:

  • unit -> integer

  • notification_type -> enum(string)

  • call_type -> enum(string)

  • guid -> string

Enumerations:

  • call_type:

    • voip
    • mobile
  • notification_type:

    • visitor
    • delivery
GET /v3/me/calls
Requestsreturns a list of calls

GET  /v3/me/calls

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "5",
      "type": "calls",
      "attributes": {
        "guid": "2bc382c4-7a5b-4583-b4b0-f8716f3f7988",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z",
        "logged_at": "2019-09-12T10:41:38Z",
        "status": "initializing"
      }
    },
    {
      "id": "4",
      "type": "calls",
      "attributes": {
        "guid": "e0cdd7d3-725d-4100-a532-ad416c376bf8",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z",
        "logged_at": "2019-09-12T10:41:38Z",
        "status": "initializing"
      }
    },
    {
      "id": "3",
      "type": "calls",
      "attributes": {
        "guid": "80370831-6e00-4419-b0bf-f1f88d5a7107",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z",
        "logged_at": "2019-09-12T10:41:38Z",
        "status": "initializing"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/me/calls?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/me/calls?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/me/calls?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

Calls
GET/v3/me/calls


Keychains

How to Create a Keychain with Virtual Keys

We use two concepts when creating a virtual key:

  • Keychain

  • Virtual Key

Keychain

Keychain contains information about the kind of key, what its duration is etc. A keychain can have many virtual keys, so a single keychain can be used to create virtual keys for multiple people. Information from the keychain is used by the panels to verify if the virtual key is still valid. Keychains must be associated with a unit.

Parameters that are always required for all keychains:

name -> string

unit -> relationship

Custom keychains

Custom keychains have a start and end date when they are valid e.g. a virtual key for a custom keychain will be valid from 01/01/2019 11:50 to 03/03/2019 13:45. Always use the iso8601 format when sending datetime data.

Endpoint examples

Parameters that are required for custom keychains:

starts_at -> datetime (iso8601)

ends_at -> datetime (iso8601)

Recurring keychains

Recurring keychains are valid only on certain weekdays and inside certain time periods e.g. a virtual key for a recurring keychain will be valid only on wednesdays and thursdays between 12:30 and 16:30. Recurring keychains also use the start and end dates to determine when they will completely expired, so if a recurring keychain has an end date on 03/03/2019 the above virtual key will no longer be valid on wendesdays and thursdays. Always use the iso8601 format when sending datetime data, for time data use the hh:mm format (06:21, 11:53, 22:51).

Endpoint examples

Parameters that are required for custom keychains:

weekdays -> array(enum)

start_date -> date (iso8601)

end_date -> date (iso8601)

time_to -> time (hh:mm)

time_from -> time (hh:mm)

Enumerations:

  • weekdays:
    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
    • sun

Virtual Key

Virtual key is used by a single person to open a door, it contains either an e-mail or an sms number of the person who will use it, a url to the qr code of the key which can be scanned to gain access to the building and a name which is used when the key is sent to the user.

Virtual keys are created from an array of recipients (e-mail or a mobile phone number) that is added to keychain parameters or on a separate endpoint.

Parameters that are required to create virtual keys:

recipients -> array(string)

POST /v3/me/keychains/custom
Requestscreates a new keychain with associated qr keysreturns bad request

POST  /v3/me/keychains/custom

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Custom Key",
      "starts_at": "2019-09-12T12:41:53+02:00",
      "ends_at": "2019-09-14T12:41:48+02:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 34
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1",
    "type": "keychains",
    "attributes": {
      "name": "Custom Key",
      "weekdays": null,
      "starts_at": "2019-09-12T10:41:53Z",
      "ends_at": "2019-09-14T10:41:48Z",
      "time_from": null,
      "time_to": null,
      "kind": "custom"
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "1",
            "type": "virtual_keys"
          },
          {
            "id": "2",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "1",
      "type": "virtual_keys",
      "attributes": {
        "name": "Custom Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/qr_code_20190912-1259941-156bsut.png",
        "email": "test@example.com",
        "sms_number": null
      }
    },
    {
      "id": "2",
      "type": "virtual_keys",
      "attributes": {
        "name": "Custom Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/qr_code_20190912-1259941-1bjmvop.png",
        "email": null,
        "sms_number": "+12345678901"
      }
    }
  ]
}

POST  /v3/me/keychains/custom

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Custom Key",
      "starts_at": "",
      "ends_at": "2019-09-14T12:41:49+02:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 35
        }
      }
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/starts_at"
      },
      "detail": "can't be blank"
    },
    {
      "source": {
        "pointer": "/data/attributes/starts_at"
      },
      "detail": "is not a valid datetime"
    },
    {
      "source": {
        "pointer": "/data/attributes/ends_at"
      },
      "detail": "Error occurred validating ends_at for :after restriction:\ncomparison of ActiveSupport::TimeWithZone with nil failed"
    }
  ]
}

Create Custom Keychain
POST/v3/me/keychains/custom


GET /v3/me/keychains
Requestsshows a list of keychainsshows a list of keychains with included resources

GET  /v3/me/keychains

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "4",
      "type": "keychains",
      "attributes": {
        "name": "Regional Response Facilitator 3",
        "weekdays": null,
        "starts_at": "2019-09-02T10:00:00Z",
        "ends_at": "2019-09-27T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom"
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "3",
      "type": "keychains",
      "attributes": {
        "name": "Internal Metrics Agent 2",
        "weekdays": null,
        "starts_at": "2019-09-02T10:00:00Z",
        "ends_at": "2019-09-27T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom"
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "2",
      "type": "keychains",
      "attributes": {
        "name": "Chief Optimization Officer 1",
        "weekdays": null,
        "starts_at": "2019-09-02T10:00:00Z",
        "ends_at": "2019-09-27T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom"
      },
      "relationships": {
        "virtual_keys": {
          "data": [
            {
              "id": "3",
              "type": "virtual_keys"
            }
          ]
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/me/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/me/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/me/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

GET  /v3/me/keychains?include=virtual_keys

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "7",
      "type": "keychains",
      "attributes": {
        "name": "Chief Configuration Director 6",
        "weekdays": null,
        "starts_at": "2019-09-02T10:00:00Z",
        "ends_at": "2019-09-27T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom"
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "6",
      "type": "keychains",
      "attributes": {
        "name": "Dynamic Accounts Associate 5",
        "weekdays": null,
        "starts_at": "2019-09-02T10:00:00Z",
        "ends_at": "2019-09-27T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom"
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "5",
      "type": "keychains",
      "attributes": {
        "name": "Human Integration Manager 4",
        "weekdays": null,
        "starts_at": "2019-09-02T10:00:00Z",
        "ends_at": "2019-09-27T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom"
      },
      "relationships": {
        "virtual_keys": {
          "data": [
            {
              "id": "4",
              "type": "virtual_keys"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "id": "4",
      "type": "virtual_keys",
      "attributes": {
        "name": "Virgil Smitham",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/qr_code_20190912-1259941-13vk7k6.png",
        "email": "emery@example.com",
        "sms_number": "+12546273779"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/me/keychains?include=virtual_keys&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/me/keychains?include=virtual_keys&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/me/keychains?include=virtual_keys&page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

List
GET/v3/me/keychains


GET /v3/me/keychains/8
Requestsreturns the keychain

GET  /v3/me/keychains/8

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "8",
    "type": "keychains",
    "attributes": {
      "name": "Dynamic Factors Engineer 7",
      "weekdays": null,
      "starts_at": "2019-09-02T10:00:00Z",
      "ends_at": "2019-09-27T23:25:00Z",
      "time_from": null,
      "time_to": null,
      "kind": "custom"
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "5",
            "type": "virtual_keys"
          }
        ]
      }
    }
  }
}

Show
GET/v3/me/keychains/{id}

URI Parameters
HideShow
id
number (required) Example: 8

DELETE /v3/me/keychains/9
Requestsdeletes the keychain and associated qr keys

DELETE  /v3/me/keychains/9

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/me/keychains/{id}

URI Parameters
HideShow
id
number (required) Example: 9

POST /v3/me/keychains/recurring
Requestscreates a new keychain with associated qr keysreturns bad request

POST  /v3/me/keychains/recurring

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Recurring Key",
      "start_date": "2019-09-12",
      "end_date": "2019-09-14",
      "time_from": "11:20",
      "time_to": "11:50",
      "weekdays": [
        "wed",
        "sat"
      ],
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 51
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "14",
    "type": "keychains",
    "attributes": {
      "name": "Recurring Key",
      "weekdays": [
        "wed",
        "sat"
      ],
      "starts_at": "2019-09-12T11:20:00Z",
      "ends_at": "2019-09-14T11:50:00Z",
      "time_from": "11:20",
      "time_to": "11:50",
      "kind": "recurring"
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "9",
            "type": "virtual_keys"
          },
          {
            "id": "10",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "9",
      "type": "virtual_keys",
      "attributes": {
        "name": "Recurring Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/qr_code_20190912-1259941-xxupli.png",
        "email": "test@example.com",
        "sms_number": null
      }
    },
    {
      "id": "10",
      "type": "virtual_keys",
      "attributes": {
        "name": "Recurring Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/qr_code_20190912-1259941-19tis3t.png",
        "email": null,
        "sms_number": "+12345678901"
      }
    }
  ]
}

POST  /v3/me/keychains/recurring

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "",
      "start_date": "2019-09-12",
      "end_date": "2019-09-14",
      "time_from": "11:20",
      "time_to": "11:50",
      "weekdays": [
        "wed",
        "sat"
      ],
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 52
        }
      }
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/name"
      },
      "detail": "can't be blank"
    }
  ]
}

Create Recurring Keychain
POST/v3/me/keychains/recurring


Door Releases

Sortable fields:

  • created_at

  • logged_at

  • notification_type

  • call_type

Filterable fields:

  • unit -> integer

  • release_method -> enum

  • door_release_type -> enum

  • name -> string

  • call_guid -> string

Enumerations:

  • release_method:

    • mobile
    • panel
    • qr_key
    • nfc
    • voip
    • bluetooth
    • front_door_view
    • rfid
  • door_release_type:

    • visitor
    • delivery
GET /v3/me/door_releases
Requestsreturns a list of door releases

GET  /v3/me/door_releases

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "3",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "call_guid": "60cb1a0b-fd60-42f5-a69f-185914136839",
        "name": "Karley Nicolas Jr.",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb/small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium/small_picture.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      }
    },
    {
      "id": "2",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "call_guid": "6db86f45-6ef2-4626-9d2e-e3ef94ecbe78",
        "name": "Dorcas Bechtelar",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb/small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium/small_picture.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      }
    },
    {
      "id": "1",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "call_guid": "fb6689e9-1fcd-4fb7-bf27-4a011a8ada9a",
        "name": "Miss Vern Harber",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/thumb/small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/medium/small_picture.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/me/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/me/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/me/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

Door Releases
GET/v3/me/door_releases


Messages

Sortable fields:

  • message_type

  • created_at

Filterable fields:

  • message_type -> enum

Enumerations:

  • message_type:
    • text
    • voice
GET /v3/me/messages
Requestsreturns a list of messages

GET  /v3/me/messages

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "3",
      "type": "messages",
      "attributes": {
        "message": null,
        "voice": {
          "url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/voice_message.mp3"
        },
        "message_type": "voice"
      }
    },
    {
      "id": "2",
      "type": "messages",
      "attributes": {
        "message": null,
        "voice": {
          "url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/voice_message.mp3"
        },
        "message_type": "voice"
      }
    },
    {
      "id": "1",
      "type": "messages",
      "attributes": {
        "message": null,
        "voice": {
          "url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/voice_message.mp3"
        },
        "message_type": "voice"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/me/messages?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/me/messages?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/me/messages?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

Messages
GET/v3/me/messages


Virtual Keys

POST /v3/me/keychains/10/virtual_keys
Requestscreates a new qr keyreturns bad requestreturns not found

POST  /v3/me/keychains/10/virtual_keys

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Virtual Key",
      "email": "test@example.com"
    },
    "type": "virtual_keys",
    "relationships": null
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "7",
    "type": "virtual_keys",
    "attributes": {
      "name": "Virtual Key",
      "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1568284898-68e18d30dc78b2701040151507f45c02/store/original/qr_code_20190912-1259941-xr79xh.png",
      "email": "test@example.com",
      "sms_number": null
    }
  }
}

POST  /v3/me/keychains/11/virtual_keys

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Virtual Key",
      "sms_number": "DOES_NOT_EXIST"
    },
    "type": "virtual_keys",
    "relationships": null
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/sms_number"
      },
      "detail": "DOES_NOT_EXIST is invalid"
    }
  ]
}

POST  /v3/me/keychains/DOES_NOT_EXIST/virtual_keys

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Virtual Key",
      "email": "test@example.com"
    },
    "type": "virtual_keys",
    "relationships": null
  }
}
Responses404
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "title": "Record not found",
      "detail": "Couldn't find Keychain with 'id'=DOES_NOT_EXIST [WHERE `keychains`.`deleted_at` IS NULL AND `units_users`.`deleted_at` IS NULL AND `units_users`.`user_id` = ?]"
    }
  ]
}

Create
POST/v3/me/keychains/{keychain_id}/virtual_keys

URI Parameters
HideShow
keychain_id
number (required) Example: 10

DELETE /v3/me/keychains/13/virtual_keys/8
Requestsdeletes the virtual key

DELETE  /v3/me/keychains/13/virtual_keys/8

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/me/keychains/{keychain_id}/virtual_keys/{id}

URI Parameters
HideShow
keychain_id
number (required) Example: 13
id
number (required) Example: 8

User

Resources that can be included:

  • buildings

  • tenants

GET /v3/me
Requestsshows current user informationshows current user information with included resources

GET  /v3/me

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "30",
    "type": "users",
    "attributes": {
      "name": "Doyle DuBuque",
      "first_name": "Doyle",
      "last_name": "DuBuque",
      "contact_preference": "phone_call",
      "thumb_url": null,
      "medium_url": null,
      "sip_username": "30",
      "email": "brent.okuneva@jastschoen.name",
      "sms_phone_number": null,
      "phone_number": null
    },
    "relationships": {
      "buildings": {
        "data": [
          {
            "id": "30",
            "type": "buildings"
          }
        ]
      },
      "tenants": {
        "data": [
          {
            "id": "36",
            "type": "tenants"
          }
        ]
      }
    }
  }
}

GET  /v3/me?include=buildings,tenants

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "31",
    "type": "users",
    "attributes": {
      "name": "Caroline Osinski",
      "first_name": "Caroline",
      "last_name": "Osinski",
      "contact_preference": "phone_call",
      "thumb_url": null,
      "medium_url": null,
      "sip_username": "31",
      "email": "ottilie@wunsch.org",
      "sms_phone_number": null,
      "phone_number": null
    },
    "relationships": {
      "buildings": {
        "data": [
          {
            "id": "31",
            "type": "buildings"
          }
        ]
      },
      "tenants": {
        "data": [
          {
            "id": "37",
            "type": "tenants"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "31",
      "type": "buildings",
      "attributes": {
        "name": "Vandervort, Prohaska and Veum-31",
        "building_type": "multi_family",
        "mobile_logo_picture": {
          "thumb_url": null,
          "medium_url": null
        },
        "panel_logo_picture": {
          "thumb_url": null,
          "medium_url": null
        },
        "address_1": "95771 Hackett Route",
        "address_2": "Grahambury, NV 53790-8740",
        "city": "Grahambury",
        "state": "Nevada",
        "zip_code": "53790-8740",
        "phone_number": "(245) 861-4619 x18714",
        "country": "us",
        "time_zone": "Etc/UTC"
      }
    },
    {
      "id": "37",
      "type": "tenants",
      "attributes": {
        "unit_id": 54
      }
    }
  ]
}

Show
GET/v3/me


PUT /v3/me
Requestsupdates the current userreturns bad request

PUT  /v3/me

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "32",
    "attributes": {
      "last_name": "Baker"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "32",
    "type": "users",
    "attributes": {
      "name": "Clement Baker",
      "first_name": "Clement",
      "last_name": "Baker",
      "contact_preference": "phone_call",
      "thumb_url": null,
      "medium_url": null,
      "sip_username": "32",
      "email": "maymie@ziemannbernhard.co",
      "sms_phone_number": null,
      "phone_number": null
    },
    "relationships": {
      "buildings": {
        "data": [
          {
            "id": "32",
            "type": "buildings"
          }
        ]
      },
      "tenants": {
        "data": [
          {
            "id": "38",
            "type": "tenants"
          }
        ]
      }
    }
  }
}

PUT  /v3/me

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "33",
    "attributes": {
      "last_name": ""
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "error": "Bad Request",
  "error_description": "Last name can't be blank"
}

Update
PUT/v3/me


Door Releases

Door Releases

Note: symbol ✓ marks permission on all entries in the authorized scope (e.g. all buildings where the Building Admin is authorized for administration* etc.)

List / Show Change Create Delete
Tenant - - -
Unit Admin - - -
Zone Admin - - -
Building Admin - - -

Request Samples with Filter:

GET /v3/door_releases?unit_id=11

GET /v3/door_releases?user_id=22

GET /v3/door_releases?unit_id=11&user_id=22

GET /v3/door_releases?door_release_type=delivery


Request Samples with Sort:

GET /v3/door_releases?sort=created

GET /v3/door_releases?sort=-created,name

The sort order for each attribute is ascending unless it is prefixed with a minus (U+002D HYPHEN-MINUS, “-“), in which case it is descending.


Allowed values for:

  • release_method:

    • mobile
    • panel
    • qr_key
    • nfc
    • voip
  • door_release_type:

    • visitor
    • delivery
  • panel_user_type:

    • default
    • doorman
GET /v3/door_releases
Requestsreturns recent door releases of the tenant's unit

GET  /v3/door_releases

Headers
Accept: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "27",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "doorman",
        "call_guid": "ab0bdd9f-d964-4548-9048-0d4cc09a5f23",
        "name": "Jeramie Hudson Sr.",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "26",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "doorman",
        "call_guid": "3b15afaf-73d2-4f19-9a1c-a5e8990f46b1",
        "name": "Johnny Parisian",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "25",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "687c1e37-ebd9-4894-aed4-3cff73158d6a",
        "name": "Virgil Spencer",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "24",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "aedafadb-e625-4bbf-a09c-2abdb1c57182",
        "name": "Lonny Schaden",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "23",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "delivery",
        "panel_user_type": "default",
        "call_guid": "a9246972-f831-429f-bdd9-36b9e50c93b5",
        "name": "Annabel Leannon",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "22",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "delivery",
        "panel_user_type": "default",
        "call_guid": "bbe0195d-f6ab-41ab-b6c8-edf672d8e41b",
        "name": "Mr. Delilah Klocko",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "21",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "1d686fb8-8b0c-4c03-8b49-eb9d8dec2ee7",
        "name": "Johnnie Eichmann",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "20",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "97e2d28d-8296-4644-9a47-f0bf9f4f3476",
        "name": "Paul Mohr",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "19",
      "type": "door_releases",
      "attributes": {
        "release_method": "qr_key",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "73ca0a8f-c748-4cbd-b4f5-c272806c0172",
        "name": "Aniya Farrell",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "18",
      "type": "door_releases",
      "attributes": {
        "release_method": "qr_key",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "82a32621-5925-4934-9547-e00fc006e740",
        "name": "Mr. Leora Lehner",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "17",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "37cb6858-8909-4696-94bf-ecd1f2a4cf30",
        "name": "Jerod Leannon",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "16",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "88e6a0ee-c41d-4214-be70-667704fd86a5",
        "name": "Benedict Auer",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-09-12T10:41:38Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "58",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "34",
            "type": "users"
          }
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/door_releases?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

List
GET/v3/door_releases


Notifications

Call Accepted

POST /v3/notifications/call_accepted
Requestsreturns notification successreturns validation error

POST  /v3/notifications/call_accepted

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "16",
    "attributes": {
      "panel_id": 16,
      "video": true,
      "audio": false,
      "call_guid": "e67533f8-1824-48d2-a675-93b99450b52f"
    }
  }
}
Responses204
This response has no content.

POST  /v3/notifications/call_accepted

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "17",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "video": true,
      "audio": false,
      "call_guid": "407b94cc-9e45-4798-8269-b2f9974e7eae"
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/panel_id"
      },
      "detail": "No panel with that ID"
    }
  ]
}

Call Accepted
POST/v3/notifications/call_accepted


Call Ended

POST /v3/notifications/call_ended
Requestsreturns notification successreturns validation error

POST  /v3/notifications/call_ended

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "18",
    "attributes": {
      "panel_id": 18,
      "call_guid": "a7194b90-5eca-47b9-875b-d740e444ad96"
    }
  }
}
Responses204
This response has no content.

POST  /v3/notifications/call_ended

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "19",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "call_guid": "af2ff704-a885-4131-8714-4769ee52fcc7"
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/panel_id"
      },
      "detail": "No panel with that ID"
    }
  ]
}

Call Ended
POST/v3/notifications/call_ended


Is Active

POST /v3/notifications/is_active
Requestsreturns notification successreturns validation error

POST  /v3/notifications/is_active

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "20",
    "attributes": {
      "panel_id": 20,
      "call_guid": "8de82bd9-7cae-4d9a-8922-b6db32d5e12f"
    }
  }
}
Responses204
This response has no content.

POST  /v3/notifications/is_active

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "21",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "call_guid": "c0cc6c1b-38ef-47dd-96f5-7d0facd30196"
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/panel_id"
      },
      "detail": "No panel with that ID"
    }
  ]
}

Is Active
POST/v3/notifications/is_active


Open Door

POST /v3/notifications/open_door
Requestsreturns notification successreturns validation error

POST  /v3/notifications/open_door

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "22",
    "attributes": {
      "panel_id": 22,
      "call_guid": "73110ebe-d957-45a8-9afc-89c7424db931"
    }
  }
}
Responses204
This response has no content.

POST  /v3/notifications/open_door

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "23",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "call_guid": "be39bc55-dfcd-4780-895c-618735d930ff"
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/panel_id"
      },
      "detail": "No panel with that ID"
    }
  ]
}

Open Door
POST/v3/notifications/open_door


Toggle Camera

POST /v3/notifications/toggle_camera
Requestsreturns notification successreturns validation error

POST  /v3/notifications/toggle_camera

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "24",
    "attributes": {
      "panel_id": 24,
      "video": true,
      "audio": false,
      "call_guid": "6fcbae2b-d6fb-4755-bce4-fb3e7e83cff3"
    }
  }
}
Responses204
This response has no content.

POST  /v3/notifications/toggle_camera

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "notifications",
    "id": "25",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "video": true,
      "audio": false,
      "call_guid": "6151135c-14d4-488e-8fc5-3079ef283ea5"
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/panel_id"
      },
      "detail": "No panel with that ID"
    }
  ]
}

Toggle Camera
POST/v3/notifications/toggle_camera


Pins

Pins

PUT /v3/pins
Requestschanges the pin for the tenantdoes not change the pin for the tenant

PUT  /v3/pins

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "pins",
    "id": "54",
    "attributes": {
      "code": "085434"
    }
  }
}
Responses204
This response has no content.

PUT  /v3/pins

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "pins",
    "id": "55",
    "attributes": {
      "code": ""
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/code"
      },
      "detail": "can't be blank"
    }
  ]
}

Set
PUT/v3/pins


Tenants

Tenants

Assign User to the Unit as a Tenant

A user is assigned as a unit’s tenant by creating a tenancy. This can be achieved with API call: POST /v3/tenants

And sending following required attributes:

  • email (String) - must be a valid email address

  • first_name (String)

  • last_name (String)

  • unit_id (Integer)

Optional Attributes:

  • active_at (DateTime) - in ISO 8601 format e.g. 2017-12-27T11:03:50Z

  • inactive_at (DateTime)

  • pin (String)

  • directory_message (String)

  • display_name_strategy (String), one of the allowed values:

    • building
    • custom
    • first_name_and_last_name
    • first_name_initial_and_last_name
    • anonymous
    • first_name_and_last_name_initial
  • sms_notifications (boolean)

  • email_notifications (boolean)

  • do_not_disturb (boolean)

When a valid email is submitted, then:

  • if there is no registered user in ButterflyMX having this email, a new user will be created and added as a tenant

  • if there is a registered user with this email, an existing user will be added as a tenant (submitted attributes first_name and last_name will be ignored)

On success, server will respond with a 201 Created status code and a JSON API document

Sortable fields:

  • created_at

Filterable fields:

  • display_name_strategy

  • display_only_on_search

  • pin_enabled

  • email_notifications

  • sms_notifications

  • do_not_disturb

Enumerations:

  • display_name_strategy:
    • building
    • custom
    • first_name_and_last_name
    • first_name_initial_and_last_name
    • anonymous
    • first_name_and_last_name_initial
GET /v3/tenants
Requestsshows a list of tenants

GET  /v3/tenants

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "58",
      "type": "units_users",
      "attributes": {
        "active_at": "2019-09-12T10:42:00Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "Principal Operations Representative",
        "display_name": "Mohamed Goodwin",
        "display_name_strategy": "building",
        "display_first_name": "Kacey Schimmel",
        "display_last_name": "Ms. Adalberto Deckow",
        "display_only_on_search": true,
        "pin_enabled": false,
        "pin": null,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "78",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "54",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "57",
      "type": "units_users",
      "attributes": {
        "active_at": "2019-09-12T10:42:00Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "Dynamic Implementation Director",
        "display_name": "Humberto Jenkins",
        "display_name_strategy": "building",
        "display_first_name": "Finn Denesik",
        "display_last_name": "Reinhold Prosacco",
        "display_only_on_search": true,
        "pin_enabled": false,
        "pin": null,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "78",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "53",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "56",
      "type": "units_users",
      "attributes": {
        "active_at": "2019-09-12T10:42:00Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "Legacy Security Representative",
        "display_name": "Davonte Dicki",
        "display_name_strategy": "building",
        "display_first_name": "Howard Mante DVM",
        "display_last_name": "Geovany Schumm",
        "display_only_on_search": false,
        "pin_enabled": false,
        "pin": null,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "78",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "52",
            "type": "users"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "54",
      "type": "users",
      "attributes": {
        "name": "Erick Murazik",
        "first_name": "Erick",
        "last_name": "Murazik",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "54",
        "email": "ignatius@batz.info",
        "sms_phone_number": null,
        "phone_number": null
      }
    },
    {
      "id": "53",
      "type": "users",
      "attributes": {
        "name": "Royce Murazik",
        "first_name": "Royce",
        "last_name": "Murazik",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "53",
        "email": "makayla@thompson.biz",
        "sms_phone_number": null,
        "phone_number": null
      }
    },
    {
      "id": "52",
      "type": "users",
      "attributes": {
        "name": "Ransom Bogisich",
        "first_name": "Ransom",
        "last_name": "Bogisich",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "52",
        "email": "jeica@skiles.com",
        "sms_phone_number": null,
        "phone_number": null
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/tenants?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/tenants?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/tenants?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

List
GET/v3/tenants


GET /v3/tenants/59
Requestsshows the tenant

GET  /v3/tenants/59

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "59",
    "type": "units_users",
    "attributes": {
      "active_at": "2019-09-12T10:42:00Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": "Central Metrics Technician",
      "display_name": "Adolfo Runolfsdottir",
      "display_name_strategy": "building",
      "display_first_name": "Lucas Koss",
      "display_last_name": "Mr. Vernie Boehm",
      "display_only_on_search": true,
      "pin_enabled": false,
      "pin": null,
      "email_notifications": true,
      "sms_notifications": true,
      "do_not_disturb": false
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "80",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "56",
          "type": "users"
        }
      }
    }
  },
  "included": [
    {
      "id": "56",
      "type": "users",
      "attributes": {
        "name": "Garry Simonis",
        "first_name": "Garry",
        "last_name": "Simonis",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "56",
        "email": "rhett@ondricka.org",
        "sms_phone_number": null,
        "phone_number": null
      }
    }
  ]
}

Show
GET/v3/tenants/{id}

URI Parameters
HideShow
id
number (required) Example: 59

POST /v3/tenants
Requestscreates a tenantreturns bad request

POST  /v3/tenants

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "unit_id": 82,
      "email": "winona.hyatt@rowefritsch.io",
      "active_at": "2019-09-12T10:42:01Z"
    },
    "type": "tenants",
    "relationships": null
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "60",
    "type": "units_users",
    "attributes": {
      "active_at": "2019-09-12T10:42:01Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": null,
      "display_name": "Dorthy M.",
      "display_name_strategy": "building",
      "display_first_name": "Dorthy",
      "display_last_name": "M.",
      "display_only_on_search": false,
      "pin_enabled": false,
      "pin": null,
      "email_notifications": false,
      "sms_notifications": false,
      "do_not_disturb": false
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "82",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "58",
          "type": "users"
        }
      }
    }
  }
}

POST  /v3/tenants

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "unit_id": 84,
      "email": "",
      "first_name": "",
      "last_name": "User",
      "active_at": "2019-09-12T10:42:01Z"
    },
    "type": "tenants",
    "relationships": null
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/user"
      },
      "detail": "must exist"
    },
    {
      "source": {
        "pointer": "/data/attributes/user"
      },
      "detail": "can't be blank"
    }
  ]
}

Create
POST/v3/tenants


PATCH /v3/tenants/61
Requestsupdates the tenantreturns bad request

PATCH  /v3/tenants/61

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "61",
    "attributes": {
      "do_not_disturb": true
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "61",
    "type": "units_users",
    "attributes": {
      "active_at": "2019-09-12T10:42:01Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": "Human Markets Associate",
      "display_name": "Junior Pfeffer",
      "display_name_strategy": "building",
      "display_first_name": "Dr. Hellen Leannon",
      "display_last_name": "Dr. Roslyn Ondricka",
      "display_only_on_search": true,
      "pin_enabled": false,
      "pin": null,
      "email_notifications": true,
      "sms_notifications": true,
      "do_not_disturb": true
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "86",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "62",
          "type": "users"
        }
      }
    }
  }
}

PATCH  /v3/tenants/62

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "62",
    "attributes": {
      "display_name_strategy": ""
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/user_panel_config.display_name_strategy"
      },
      "detail": "can't be blank"
    }
  ]
}

Update
PATCH/v3/tenants/{id}

URI Parameters
HideShow
id
number (required) Example: 61

DELETE /v3/tenants/63
Requestsdeletes the tenant

DELETE  /v3/tenants/63

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/tenants/{id}

URI Parameters
HideShow
id
number (required) Example: 63

Units

Units

Unit creation

  • When creating a unit, a building_id needs to be sent alongside the units attributes, so a unit can be assigned to a building.

Includeable resources:

  • building

  • users

Filterable fields:

  • floor_number (integer)

  • unit_type (enumeration)

  • label (string)

Sortable fields:

  • id

  • floor_number

  • unit_type

  • label

  • updated_at

  • created_at

Enumerations:

  • unit_type:
    • apartment
GET /v3/units/93
Requestsshows the unit

GET  /v3/units/93

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "93",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "37037",
      "floor_number": 37
    },
    "relationships": {
      "building": {
        "data": {
          "id": "55",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

Show
GET/v3/units/{id}

URI Parameters
HideShow
id
number (required) Example: 93

GET /v3/units
Requestsshows a list of tenantsshows a list of tenants with included resources

GET  /v3/units

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "97",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "40040",
        "floor_number": 40
      },
      "relationships": {
        "building": {
          "data": {
            "id": "57",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "96",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "39039",
        "floor_number": 39
      },
      "relationships": {
        "building": {
          "data": {
            "id": "57",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "95",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "38038",
        "floor_number": 38
      },
      "relationships": {
        "building": {
          "data": {
            "id": "57",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "94",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "00",
        "floor_number": 1
      },
      "relationships": {
        "building": {
          "data": {
            "id": "57",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/units?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/units?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/units?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

GET  /v3/units?include=users,building

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "101",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "43043",
        "floor_number": 43
      },
      "relationships": {
        "building": {
          "data": {
            "id": "58",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "100",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "42042",
        "floor_number": 42
      },
      "relationships": {
        "building": {
          "data": {
            "id": "58",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "99",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "41041",
        "floor_number": 41
      },
      "relationships": {
        "building": {
          "data": {
            "id": "58",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "98",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "00",
        "floor_number": 1
      },
      "relationships": {
        "building": {
          "data": {
            "id": "58",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    }
  ],
  "included": [
    {
      "id": "58",
      "type": "buildings",
      "attributes": {
        "name": "Jaskolski-Hintz-58",
        "building_type": "multi_family",
        "display_name_strategy": "first_name_and_last_name",
        "door_release_pin": false,
        "qr_key_enabled": false,
        "nfc_enabled": false,
        "send_panel_status_report": false,
        "mobile_logo_picture": {
          "thumb_url": null,
          "medium_url": null
        },
        "panel_logo_picture": {
          "thumb_url": null,
          "medium_url": null
        },
        "address_1": "51071 Crystel Wall",
        "address_2": "South Cullenborough, MT 71391",
        "city": "South Cullenborough",
        "state": "Montana",
        "zip_code": "71391",
        "phone_number": "1-242-000-3460 x02575",
        "country": "us",
        "time_zone": "Etc/UTC",
        "time_zone_offset": "+00:00"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/units?include=users%2Cbuilding&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/units?include=users%2Cbuilding&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/units?include=users%2Cbuilding&page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

List
GET/v3/units


POST /v3/buildings/59/units
Requestscreates the unitreturns bad requestreturns not found

POST  /v3/buildings/59/units

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "unit_type": "apartment",
      "label": "foo",
      "floor_number": 11
    },
    "type": "units",
    "relationships": null
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "103",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "foo",
      "floor_number": 11
    },
    "relationships": {
      "building": {
        "data": {
          "id": "59",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

POST  /v3/buildings/60/units

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units",
    "attributes": {
      "unit_type": "apartment"
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/label"
      },
      "detail": "can't be blank"
    },
    {
      "source": {
        "pointer": "/data/attributes/floor_number"
      },
      "detail": "can't be blank"
    },
    {
      "source": {
        "pointer": "/data/attributes/floor_number"
      },
      "detail": "is not a number"
    }
  ]
}

POST  /v3/buildings/DOES_NOT_EXIST/units

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "foo",
      "floor_number": 11
    }
  }
}
Responses404
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "title": "Record not found",
      "detail": "Couldn't find Building with 'id'=DOES_NOT_EXIST [WHERE `buildings`.`deleted_at` IS NULL]"
    }
  ]
}

Create
POST/v3/buildings/{building_id}/units

URI Parameters
HideShow
building_id
number (required) Example: 59

PUT /v3/units/108
Requestsupdates the unitreturns bad request

PUT  /v3/units/108

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "New Label",
      "floor_number": 11,
      "building_id": 62
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "108",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "New Label",
      "floor_number": 11
    },
    "relationships": {
      "building": {
        "data": {
          "id": "62",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

PUT  /v3/units/111

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "units",
    "attributes": {
      "label": ""
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/label"
      },
      "detail": "can't be blank"
    }
  ]
}

Update
PUT/v3/units/{id}

URI Parameters
HideShow
id
number (required) Example: 108

DELETE /v3/units/114
Requestsdeletes a unit

DELETE  /v3/units/114

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Responses204
This response has no content.

Delete
DELETE/v3/units/{id}

URI Parameters
HideShow
id
number (required) Example: 114

Generated by aglio on 12 Sep 2019