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": "Aufderhar Inc-1",
        "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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
          "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
        },
        "panel_logo_picture": {
          "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
          "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
        },
        "open_door_button_enabled": true,
        "address_1": "80331 Ankunding Ports",
        "address_2": "Port Ibrahim, IN 56492",
        "city": "Port Ibrahim",
        "state": "Indiana",
        "zip_code": "56492",
        "phone_number": "1-819-077-3747 x528",
        "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": "Wayne Mountains"
      }
    }
  ],
  "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": "Baumbach LLC-3",
      "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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "open_door_button_enabled": true,
      "address_1": "39430 Prohaska Garden",
      "address_2": "South Elbert, MT 24105-0134",
      "city": "South Elbert",
      "state": "Montana",
      "zip_code": "24105-0134",
      "phone_number": "1-642-975-5020 x432",
      "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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "open_door_button_enabled": true,
      "address_1": "233 Herzog Trail",
      "address_2": "Metzland, TN 79830",
      "city": "Metzland",
      "state": "Tennessee",
      "zip_code": "79830",
      "phone_number": "1-182-970-1141 x4869",
      "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": "McCullough Group-7",
      "building_type": "multi_family",
      "display_name_strategy": "anonymous",
      "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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "open_door_button_enabled": true,
      "address_1": "New Building Address",
      "address_2": "West Lexus, TX 79997-9528",
      "city": "West Lexus",
      "state": "Texas",
      "zip_code": "79997-9528",
      "phone_number": "819.484.9424",
      "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": "Jacobi, Gibson and Leannon-11",
      "building_type": "multi_family",
      "display_name_strategy": "first_name_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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb_small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium_small_picture.jpg"
      },
      "panel_logo_picture": {
        "thumb_url": null,
        "medium_url": null
      },
      "open_door_button_enabled": true,
      "address_1": "980 Colton Forges",
      "address_2": "Brakusstad, DE 22169-8188",
      "city": "Brakusstad",
      "state": "Delaware",
      "zip_code": "22169-8188",
      "phone_number": "1-116-485-1826 x4176",
      "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

Integrations

Integrations

Allowed integrators:

  • webhook

Allowed config attributes for integrators:

  • webhook
    • url (String)
    • method (String get or post)

Allowed binding resource types:

  • call

  • door_release

GET /v3/buildings/1337/integrations
Requestsreturns a list of all the building's integrations

GET  /v3/buildings/1337/integrations

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "79c9dc15-1bef-4ecc-956e-824be46901ce",
      "type": "integrations",
      "attributes": {
        "integrator": "webhook",
        "config": {
          "url": "http://localhost:999",
          "method": "get"
        },
        "bindings": [
          {
            "resource_type": "door_release",
            "resource_id": "7",
            "actions": [
              "update",
              "destroy"
            ]
          }
        ]
      },
      "relationships": {
        "bindings": {
          "data": [
            {
              "resource_type": "door_release",
              "resource_id": "7",
              "actions": [
                "update",
                "destroy"
              ]
            }
          ]
        },
        "building": {
          "data": {
            "id": "1337",
            "type": "buildings"
          }
        },
        "tenant": {
          "data": null
        }
      },
      "links": {
        "self": "http://api.butterflymx.com/v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/buildings/1337/integrations?page%5Bnumber%5D=1&page%5Bsize%5D=10",
    "first": "http://api.butterflymx.com/v3/buildings/1337/integrations?page%5Bnumber%5D=1&page%5Bsize%5D=10",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/buildings/1337/integrations?page%5Bnumber%5D=1&page%5Bsize%5D=10"
  }
}

List
GET/v3/buildings/{building_id}/integrations

URI Parameters
HideShow
building_id
number (required) Example: 1337

GET /v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce
Requestsreturns a single integration for the building

GET  /v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "79c9dc15-1bef-4ecc-956e-824be46901ce",
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "config": {
        "url": "http://localhost:999",
        "method": "get"
      },
      "bindings": [
        {
          "resource_type": "door_release",
          "resource_id": "7",
          "actions": [
            "update",
            "destroy"
          ]
        }
      ]
    },
    "relationships": {
      "bindings": {
        "data": [
          {
            "resource_type": "door_release",
            "resource_id": "7",
            "actions": [
              "update",
              "destroy"
            ]
          }
        ]
      },
      "building": {
        "data": {
          "id": "1337",
          "type": "buildings"
        }
      },
      "tenant": {
        "data": null
      }
    },
    "links": {
      "self": "http://api.butterflymx.com/v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce"
    }
  }
}

Show
GET/v3/buildings/{building_id}/integrations/{id}

URI Parameters
HideShow
building_id
number (required) Example: 1337
id
string (required) Example: 79c9dc15-1bef-4ecc-956e-824be46901ce

POST /v3/buildings/1337/integrations
Requestscreates an integration for the building

POST  /v3/buildings/1337/integrations

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Body
{
  "data": {
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "configuration": {
        "url": "http://localhost:666",
        "method": "post"
      },
      "bindings": [
        {
          "actions": [
            "create"
          ],
          "resource_type": "call",
          "resource_id": null
        }
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "79c9dc15-1bef-4ecc-956e-824be46901ce",
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "config": {
        "url": "http://localhost:666",
        "method": "post"
      },
      "bindings": [
        {
          "resource_type": "call",
          "resource_id": "",
          "actions": [
            "create"
          ]
        }
      ]
    },
    "relationships": {
      "bindings": {
        "data": [
          {
            "resource_type": "call",
            "resource_id": "",
            "actions": [
              "create"
            ]
          }
        ]
      },
      "building": {
        "data": {
          "id": "1337",
          "type": "buildings"
        }
      },
      "tenant": {
        "data": null
      }
    },
    "links": {
      "self": "http://api.butterflymx.com/v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce"
    }
  }
}

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

URI Parameters
HideShow
building_id
number (required) Example: 1337

PATCH /v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce
Requestsupdates a building's integration

PATCH  /v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Body
{
  "data": {
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "configuration": {
        "url": "http://localhost:999",
        "method": "get"
      },
      "bindings": [
        {
          "actions": [
            "update",
            "destroy"
          ],
          "resource_type": "door_release",
          "resource_id": "7"
        }
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "79c9dc15-1bef-4ecc-956e-824be46901ce",
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "config": {
        "url": "http://localhost:999",
        "method": "get"
      },
      "bindings": [
        {
          "resource_type": "door_release",
          "resource_id": "7",
          "actions": [
            "update",
            "destroy"
          ]
        }
      ]
    },
    "relationships": {
      "bindings": {
        "data": [
          {
            "resource_type": "door_release",
            "resource_id": "7",
            "actions": [
              "update",
              "destroy"
            ]
          }
        ]
      },
      "building": {
        "data": {
          "id": "1337",
          "type": "buildings"
        }
      },
      "tenant": {
        "data": null
      }
    },
    "links": {
      "self": "http://api.butterflymx.com/v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce"
    }
  }
}

Update
PATCH/v3/buildings/{building_id}/integrations/{id}

URI Parameters
HideShow
building_id
number (required) Example: 1337
id
string (required) Example: 79c9dc15-1bef-4ecc-956e-824be46901ce

DELETE /v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce
Requestsdeletes a building's integration

DELETE  /v3/buildings/1337/integrations/79c9dc15-1bef-4ecc-956e-824be46901ce

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

Delete
DELETE/v3/buildings/{building_id}/integrations/{id}

URI Parameters
HideShow
building_id
number (required) Example: 1337
id
string (required) Example: 79c9dc15-1bef-4ecc-956e-824be46901ce

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/3bdea55c-22a7-4002-859c-4b5407eb3edd/status
Requestsreturns status of the callreturns not found

GET  /v3/me/calls/3bdea55c-22a7-4002-859c-4b5407eb3edd/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-10-21T11:00:33Z"
    },
    "relationships": {
      "call": {
        "data": {
          "id": "1",
          "type": "calls"
        }
      }
    }
  },
  "included": [
    {
      "id": "1",
      "type": "calls",
      "attributes": {
        "guid": "3bdea55c-22a7-4002-859c-4b5407eb3edd",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z",
        "logged_at": "2019-10-21T11:00:28Z",
        "panel_id": 7,
        "panel_name": "Sabrina Overpass",
        "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": "Requested record could not be found"
    }
  ]
}

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

URI Parameters
HideShow
call_guid
string (required) Example: 3bdea55c-22a7-4002-859c-4b5407eb3edd

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": "b69d1c2c-4c81-4572-8ad3-91626dadf1a6",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z",
        "logged_at": "2019-10-21T11:00:28Z",
        "status": "initializing"
      }
    },
    {
      "id": "4",
      "type": "calls",
      "attributes": {
        "guid": "ef4c5300-1883-4075-ba5a-a3d112f8ffc8",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z",
        "logged_at": "2019-10-21T11:00:28Z",
        "status": "initializing"
      }
    },
    {
      "id": "3",
      "type": "calls",
      "attributes": {
        "guid": "6e2e9d81-ddba-4a73-9806-77ed32793f5d",
        "call_type": "voip",
        "notification_type": "visitor",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z",
        "logged_at": "2019-10-21T11:00:28Z",
        "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


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": "4e76a975-e320-4676-a803-1acd06d76a5c",
        "name": "Clarabelle Walsh DVM",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb/small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium/small_picture.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      }
    },
    {
      "id": "2",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "call_guid": "f8e8265d-0619-40a6-9973-d1bfb3a7a3fd",
        "name": "Zelma Rohan",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb/small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium/small_picture.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      }
    },
    {
      "id": "1",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "call_guid": "732e24b2-f66a-4c89-a1dc-497d95c932a6",
        "name": "Clement Ratke",
        "thumb_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/thumb/small_picture.jpg",
        "medium_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/medium/small_picture.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      }
    }
  ],
  "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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/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


Open Door

POST /v3/me/open_door
Requestssends a request to open the doorreturns bad request

POST  /v3/me/open_door

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {},
    "type": "open_door",
    "relationships": {
      "panel": {
        "data": {
          "type": "panel",
          "id": 11
        }
      },
      "unit": {
        "data": {
          "type": "unit",
          "id": 37
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1",
    "type": "door_release_requests",
    "attributes": {
      "guid": "c7c9a845-2522-44d2-80ea-a7df7ca567aa",
      "created_at": "2019-10-21T11:01:16Z"
    }
  }
}

POST  /v3/me/open_door

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {},
    "type": "open_doors",
    "relationships": {
      "panels": {
        "data": {
          "type": "panels",
          "id": "DOES_NOT_EXIST"
        }
      },
      "unit": {
        "data": {
          "type": "unit",
          "id": 38
        }
      }
    }
  }
}
Responses400
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/panel"
      },
      "detail": "must exist"
    }
  ]
}

Open Door
POST/v3/me/open_door


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": "20",
    "type": "users",
    "attributes": {
      "name": "Maxine Ryan",
      "first_name": "Maxine",
      "last_name": "Ryan",
      "contact_preference": "phone_call",
      "thumb_url": null,
      "medium_url": null,
      "sip_username": "20",
      "email": "winifred_sporer@abbott.io",
      "sms_phone_number": null,
      "phone_number": null
    },
    "relationships": {
      "buildings": {
        "data": [
          {
            "id": "20",
            "type": "buildings"
          }
        ]
      },
      "tenants": {
        "data": [
          {
            "id": "26",
            "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": "21",
    "type": "users",
    "attributes": {
      "name": "Gordon Haley",
      "first_name": "Gordon",
      "last_name": "Haley",
      "contact_preference": "phone_call",
      "thumb_url": null,
      "medium_url": null,
      "sip_username": "21",
      "email": "kaden.greenholt@botsford.biz",
      "sms_phone_number": null,
      "phone_number": null
    },
    "relationships": {
      "buildings": {
        "data": [
          {
            "id": "21",
            "type": "buildings"
          }
        ]
      },
      "tenants": {
        "data": [
          {
            "id": "27",
            "type": "tenants"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "21",
      "type": "buildings",
      "attributes": {
        "name": "Satterfield Inc-21",
        "building_type": "multi_family",
        "mobile_logo_picture": {
          "thumb_url": null,
          "medium_url": null
        },
        "panel_logo_picture": {
          "thumb_url": null,
          "medium_url": null
        },
        "address_1": "9236 Funk Parks",
        "address_2": "Rodolfoborough, OH 20427",
        "city": "Rodolfoborough",
        "state": "Ohio",
        "zip_code": "20427",
        "phone_number": "645.154.1672",
        "country": "us",
        "time_zone": "Etc/UTC"
      }
    },
    {
      "id": "27",
      "type": "tenants",
      "attributes": {
        "unit_id": 40
      }
    }
  ]
}

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": "22",
    "attributes": {
      "last_name": "Baker"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "22",
    "type": "users",
    "attributes": {
      "name": "Celia Baker",
      "first_name": "Celia",
      "last_name": "Baker",
      "contact_preference": "phone_call",
      "thumb_url": null,
      "medium_url": null,
      "sip_username": "22",
      "email": "garnet@jakubowski.info",
      "sms_phone_number": null,
      "phone_number": null
    },
    "relationships": {
      "buildings": {
        "data": [
          {
            "id": "22",
            "type": "buildings"
          }
        ]
      },
      "tenants": {
        "data": [
          {
            "id": "28",
            "type": "tenants"
          }
        ]
      }
    }
  }
}

PUT  /v3/me

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "23",
    "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": "8c9ae583-878a-433b-9465-a7f909d3d6a2",
        "name": "Tressie Vandervort",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "26",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "doorman",
        "call_guid": "bf11fca6-0604-4ed8-a255-2df30f3c8261",
        "name": "Alvah Smitham PhD",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "25",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "57a1ccb2-536e-4ccf-bc50-b700cb8b3e21",
        "name": "Coty Langworth",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "24",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "e05b88a7-1697-4984-b1e5-1a580a77a31c",
        "name": "Joanie Kautzer",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "23",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "delivery",
        "panel_user_type": "default",
        "call_guid": "4b688286-d5cf-4b19-bee2-d020771862b2",
        "name": "Dr. Shaun Leffler",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "22",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "delivery",
        "panel_user_type": "default",
        "call_guid": "7162c60f-f08d-49aa-b0cf-2e6c870c307b",
        "name": "Wilson Olson",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "21",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "bdac6697-9ce1-4cda-aad3-7f8e31c4a871",
        "name": "Caesar Swift",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "20",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "3b563fb6-db41-4289-971a-2f28fc4e9cae",
        "name": "Mrs. Stanley Heaney",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "19",
      "type": "door_releases",
      "attributes": {
        "release_method": "qr_key",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "70c145cb-0886-4895-a9e3-9e28a0ede5a8",
        "name": "Janessa Abernathy",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "18",
      "type": "door_releases",
      "attributes": {
        "release_method": "qr_key",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "cdbe0c5f-7fca-49dc-93e5-0377683aa241",
        "name": "Kenya Bogan",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "17",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "abf77091-a6c8-4122-944c-faf8004b1303",
        "name": "Mrs. Diamond Mueller",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "16",
      "type": "door_releases",
      "attributes": {
        "release_method": "mobile",
        "door_release_type": "visitor",
        "panel_user_type": "default",
        "call_guid": "073e7f89-98f2-4521-998c-6802b402cc17",
        "name": "Eugenia Bartoletti",
        "thumb_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "medium_url": "/assets/no_pic-9bef3f18928279a698143de0b6f96efe17dedee59b8bd0668312d62911d14c82.jpg",
        "created_at": "2019-10-21T11:00:28Z"
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "47",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "27",
            "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


Keychains

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

tenant -> relationship or unit -> relationship

If you wish to have the keychain associated with tenant send the tenant relationship, otherwise send the unit as relationship. The second case is useful if you have large tenant turnover in a unit (e.g short term tourist renals). If you wish to allow your tenants to create and share keys by themselves, tenant association is required.

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

One time keychains

Virtual keys that belong to one time keychains can be used only once inside a predefined period of tim, which is determined by starts_at and ends_at fields. After they are used or if they’re not inside a predefined period of time they are no longer valid e.g. if a keychain’s validity period is from 01/01/2019 11:50 to 03/03/2019 13:45, it will not be valid if it’s used inside that period or when the time of 03/03/2019 13:45 has passed.

To determine if a particular virtual key for the one time keychain has been used, check the one_time_key_used_at field on the virtual key.

Parameters that are required for one time keychains:

starts_at -> datetime (iso8601)

ends_at -> datetime (iso8601)

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)

Filterable fields:

  • unit -> integer

  • tenant -> integer

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

POST  /v3/keychains/custom

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Custom Key",
      "starts_at": "2019-10-21T11:01:23+00:00",
      "ends_at": "2019-10-23T11:01:18+00:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 43
        }
      }
    }
  }
}
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-10-21T11:01:23Z",
      "ends_at": "2019-10-23T11:01:18Z",
      "time_from": null,
      "time_to": null,
      "kind": "custom",
      "start_date": null,
      "end_date": null
    },
    "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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1b2afg3.png",
        "email": "test@example.com",
        "sms_number": null,
        "one_time_key_used_at": 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-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1i7kbvw.png",
        "email": null,
        "sms_number": "+12345678901",
        "one_time_key_used_at": null
      }
    }
  ]
}

POST  /v3/keychains/custom

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Custom Key",
      "starts_at": "2019-10-21T11:01:23+00:00",
      "ends_at": "2019-10-23T11:01:18+00:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "tenant": {
        "data": {
          "type": "tenant",
          "id": 31
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "2",
    "type": "keychains",
    "attributes": {
      "name": "Custom Key",
      "weekdays": null,
      "starts_at": "2019-10-21T11:01:23Z",
      "ends_at": "2019-10-23T11:01:18Z",
      "time_from": null,
      "time_to": null,
      "kind": "custom",
      "start_date": null,
      "end_date": null
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "3",
            "type": "virtual_keys"
          },
          {
            "id": "4",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "3",
      "type": "virtual_keys",
      "attributes": {
        "name": "Custom Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1csrbyz.png",
        "email": "test@example.com",
        "sms_number": null,
        "one_time_key_used_at": null
      }
    },
    {
      "id": "4",
      "type": "virtual_keys",
      "attributes": {
        "name": "Custom Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1w1hy2z.png",
        "email": null,
        "sms_number": "+12345678901",
        "one_time_key_used_at": null
      }
    }
  ]
}

POST  /v3/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-10-23T11:01:19+00:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "tenant": {
        "data": {
          "type": "tenant",
          "id": 32
        }
      }
    }
  }
}
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/keychains/custom


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

GET  /v3/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": "6",
      "type": "keychains",
      "attributes": {
        "name": "Dynamic Implementation Agent 4",
        "weekdays": null,
        "starts_at": "2019-10-11T10:00:00Z",
        "ends_at": "2019-11-05T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom",
        "start_date": null,
        "end_date": null
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "5",
      "type": "keychains",
      "attributes": {
        "name": "National Infrastructure Officer 3",
        "weekdays": null,
        "starts_at": "2019-10-11T10:00:00Z",
        "ends_at": "2019-11-05T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom",
        "start_date": null,
        "end_date": null
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "4",
      "type": "keychains",
      "attributes": {
        "name": "International Security Representative 2",
        "weekdays": null,
        "starts_at": "2019-10-11T10:00:00Z",
        "ends_at": "2019-11-05T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom",
        "start_date": null,
        "end_date": null
      },
      "relationships": {
        "virtual_keys": {
          "data": [
            {
              "id": "6",
              "type": "virtual_keys"
            }
          ]
        }
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/keychains?page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

GET  /v3/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": "9",
      "type": "keychains",
      "attributes": {
        "name": "Human Mobility Director 7",
        "weekdays": null,
        "starts_at": "2019-10-11T10:00:00Z",
        "ends_at": "2019-11-05T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom",
        "start_date": null,
        "end_date": null
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "8",
      "type": "keychains",
      "attributes": {
        "name": "Senior Mobility Facilitator 6",
        "weekdays": null,
        "starts_at": "2019-10-11T10:00:00Z",
        "ends_at": "2019-11-05T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom",
        "start_date": null,
        "end_date": null
      },
      "relationships": {
        "virtual_keys": {
          "data": []
        }
      }
    },
    {
      "id": "7",
      "type": "keychains",
      "attributes": {
        "name": "Central Interactions Technician 5",
        "weekdays": null,
        "starts_at": "2019-10-11T10:00:00Z",
        "ends_at": "2019-11-05T23:25:00Z",
        "time_from": null,
        "time_to": null,
        "kind": "custom",
        "start_date": null,
        "end_date": null
      },
      "relationships": {
        "virtual_keys": {
          "data": [
            {
              "id": "7",
              "type": "virtual_keys"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "id": "7",
      "type": "virtual_keys",
      "attributes": {
        "name": "Sister Rau DDS",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1t3xccf.png",
        "email": "yeenia_okon@example.org",
        "sms_number": "+12546231335",
        "one_time_key_used_at": null
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/keychains?include=virtual_keys&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "first": "http://api.butterflymx.com/v3/keychains?include=virtual_keys&page%5Bnumber%5D=1&page%5Bsize%5D=20",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/keychains?include=virtual_keys&page%5Bnumber%5D=1&page%5Bsize%5D=20"
  }
}

List
GET/v3/keychains


GET /v3/keychains/10
Requestsreturns the keychain

GET  /v3/keychains/10

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": "10",
    "type": "keychains",
    "attributes": {
      "name": "Future Functionality Consultant 8",
      "weekdays": null,
      "starts_at": "2019-10-11T10:00:00Z",
      "ends_at": "2019-11-05T23:25:00Z",
      "time_from": null,
      "time_to": null,
      "kind": "custom",
      "start_date": null,
      "end_date": null
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "8",
            "type": "virtual_keys"
          }
        ]
      }
    }
  }
}

Show
GET/v3/keychains/{id}

URI Parameters
HideShow
id
number (required) Example: 10

DELETE /v3/keychains/11
Requestsdeletes the keychain and associated qr keys

DELETE  /v3/keychains/11

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

Delete
DELETE/v3/keychains/{id}

URI Parameters
HideShow
id
number (required) Example: 11

POST /v3/keychains/one_time
Requestscreates a new keychain with associated qr keyscreates a new keychain with associated qr keysreturns bad request

POST  /v3/keychains/one_time

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "One-Time Key",
      "starts_at": "2019-10-21T11:01:31+00:00",
      "ends_at": "2019-10-23T11:01:26+00:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 81
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "12",
    "type": "keychains",
    "attributes": {
      "name": "One-Time Key",
      "weekdays": null,
      "starts_at": "2019-10-21T11:01:31Z",
      "ends_at": "2019-10-23T11:01:26Z",
      "time_from": null,
      "time_to": null,
      "kind": "one_time",
      "start_date": null,
      "end_date": null
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "10",
            "type": "virtual_keys"
          },
          {
            "id": "11",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "10",
      "type": "virtual_keys",
      "attributes": {
        "name": "One-Time Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1ck5e7x.png",
        "email": "test@example.com",
        "sms_number": null,
        "one_time_key_used_at": null
      }
    },
    {
      "id": "11",
      "type": "virtual_keys",
      "attributes": {
        "name": "One-Time Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-31b0wy.png",
        "email": null,
        "sms_number": "+12345678901",
        "one_time_key_used_at": null
      }
    }
  ]
}

POST  /v3/keychains/one_time

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "One-Time Key",
      "starts_at": "2019-10-21T11:01:31+00:00",
      "ends_at": "2019-10-23T11:01:26+00:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "tenant": {
        "data": {
          "type": "tenant",
          "id": 2278
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "13",
    "type": "keychains",
    "attributes": {
      "name": "One-Time Key",
      "weekdays": null,
      "starts_at": "2019-10-21T11:01:31Z",
      "ends_at": "2019-10-23T11:01:26Z",
      "time_from": null,
      "time_to": null,
      "kind": "one_time",
      "start_date": null,
      "end_date": null
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "12",
            "type": "virtual_keys"
          },
          {
            "id": "13",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "12",
      "type": "virtual_keys",
      "attributes": {
        "name": "One-Time Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-lj3tu.png",
        "email": "test@example.com",
        "sms_number": null,
        "one_time_key_used_at": null
      }
    },
    {
      "id": "13",
      "type": "virtual_keys",
      "attributes": {
        "name": "One-Time Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-wjz5jj.png",
        "email": null,
        "sms_number": "+12345678901",
        "one_time_key_used_at": null
      }
    }
  ]
}

POST  /v3/keychains/one_time

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "One-Time Key",
      "starts_at": "",
      "ends_at": "2019-10-23T11:01:27+00:00",
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "tenant": {
        "data": {
          "type": "tenant",
          "id": 2279
        }
      }
    }
  }
}
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 One-Time Keychain
POST/v3/keychains/one_time


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

POST  /v3/keychains/recurring

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Recurring Key",
      "start_date": "2019-10-21",
      "end_date": "2019-10-23",
      "time_from": "11:20",
      "time_to": "11:50",
      "weekdays": [
        "wed",
        "sat"
      ],
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "unit": {
        "data": {
          "type": "unit",
          "id": 98
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "18",
    "type": "keychains",
    "attributes": {
      "name": "Recurring Key",
      "weekdays": [
        "wed",
        "sat"
      ],
      "starts_at": null,
      "ends_at": null,
      "time_from": "11:20",
      "time_to": "11:50",
      "kind": "recurring",
      "start_date": "2019-10-21",
      "end_date": "2019-10-23"
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "16",
            "type": "virtual_keys"
          },
          {
            "id": "17",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "16",
      "type": "virtual_keys",
      "attributes": {
        "name": "Recurring Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1v65ejx.png",
        "email": "test@example.com",
        "sms_number": null,
        "one_time_key_used_at": null
      }
    },
    {
      "id": "17",
      "type": "virtual_keys",
      "attributes": {
        "name": "Recurring Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-rl9hkx.png",
        "email": null,
        "sms_number": "+12345678901",
        "one_time_key_used_at": null
      }
    }
  ]
}

POST  /v3/keychains/recurring

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "Recurring Key",
      "start_date": "2019-10-21",
      "end_date": "2019-10-23",
      "time_from": "11:20",
      "time_to": "11:50",
      "weekdays": [
        "wed",
        "sat"
      ],
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "tenant": {
        "data": {
          "type": "tenant",
          "id": 2288
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "19",
    "type": "keychains",
    "attributes": {
      "name": "Recurring Key",
      "weekdays": [
        "wed",
        "sat"
      ],
      "starts_at": null,
      "ends_at": null,
      "time_from": "11:20",
      "time_to": "11:50",
      "kind": "recurring",
      "start_date": "2019-10-21",
      "end_date": "2019-10-23"
    },
    "relationships": {
      "virtual_keys": {
        "data": [
          {
            "id": "18",
            "type": "virtual_keys"
          },
          {
            "id": "19",
            "type": "virtual_keys"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "18",
      "type": "virtual_keys",
      "attributes": {
        "name": "Recurring Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-431129.png",
        "email": "test@example.com",
        "sms_number": null,
        "one_time_key_used_at": null
      }
    },
    {
      "id": "19",
      "type": "virtual_keys",
      "attributes": {
        "name": "Recurring Key",
        "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-axckpv.png",
        "email": null,
        "sms_number": "+12345678901",
        "one_time_key_used_at": null
      }
    }
  ]
}

POST  /v3/keychains/recurring

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "name": "",
      "start_date": "2019-10-21",
      "end_date": "2019-10-23",
      "time_from": "11:20",
      "time_to": "11:50",
      "weekdays": [
        "wed",
        "sat"
      ],
      "recipients": [
        "test@example.com",
        "+12345678901"
      ]
    },
    "type": "keychains",
    "relationships": {
      "tenant": {
        "data": {
          "type": "tenant",
          "id": 2289
        }
      }
    }
  }
}
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/keychains/recurring


Virtual Keys

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

POST  /v3/keychains/14/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": "14",
    "type": "virtual_keys",
    "attributes": {
      "name": "Virtual Key",
      "qr_code_image_url": "https://bmx-rails-staging.s3.amazonaws.com/system/uploads/test-1-1571655628-6619d82dbe429dba4e76be1a5cb9f895/store/original/qr_code_20191021-27071-1ht6wj2.png",
      "email": "test@example.com",
      "sms_number": null,
      "one_time_key_used_at": null
    }
  }
}

POST  /v3/keychains/15/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/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": "Requested record could not be found"
    }
  ]
}

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

URI Parameters
HideShow
keychain_id
number (required) Example: 14

DELETE /v3/keychains/17/virtual_keys/15
Requestsdeletes the virtual key

DELETE  /v3/keychains/17/virtual_keys/15

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

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

URI Parameters
HideShow
keychain_id
number (required) Example: 17
id
number (required) Example: 15

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": "18",
    "attributes": {
      "panel_id": 18,
      "video": true,
      "audio": false,
      "call_guid": "7a3f13ac-245b-46e9-bbbb-27fe3c1dc207"
    }
  }
}
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": "19",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "video": true,
      "audio": false,
      "call_guid": "0010cbc4-8941-46b5-98ff-8d26174ceaa3"
    }
  }
}
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": "20",
    "attributes": {
      "panel_id": 20,
      "call_guid": "8db3ceaf-90a1-48d0-ad3f-e7d80038799a"
    }
  }
}
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": "21",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "call_guid": "a871b0c8-0c5d-484d-b8fa-077f5427bd98"
    }
  }
}
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": "22",
    "attributes": {
      "panel_id": 22,
      "call_guid": "96f13526-003f-4f55-a536-d741c114a386"
    }
  }
}
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": "23",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "call_guid": "33d94bd7-b93c-4a39-b4c5-8ed8cbe07059"
    }
  }
}
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": "24",
    "attributes": {
      "panel_id": 24,
      "call_guid": "61776745-fa7e-4489-bc9d-9963577611e4"
    }
  }
}
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": "25",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "call_guid": "7e4280ac-cb2b-4ee5-ba67-aa53f6a202e8"
    }
  }
}
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": "26",
    "attributes": {
      "panel_id": 26,
      "video": true,
      "audio": false,
      "call_guid": "ae8a544d-0eee-4276-adcb-f994231bc4aa"
    }
  }
}
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": "27",
    "attributes": {
      "panel_id": "NOT_EXIST",
      "video": true,
      "audio": false,
      "call_guid": "548484b0-f14b-4c73-94d1-6713eb1f8249"
    }
  }
}
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

On these endpoints you can create and view PINs for tenants. The id parameter in the request must be the id of the tenant.

Parameters that are required for pins:

id -> integer

code -> string (must be numeric)

GET /v3/pins/2280
Requestsreturns the PIN code

GET  /v3/pins/2280

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": "2280",
    "type": "pins",
    "attributes": {
      "code": "583494"
    }
  }
}

Show
GET/v3/pins/{id}

URI Parameters
HideShow
id
number (required) Example: 2280

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": "2281",
    "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": "2282",
    "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

Integrations

Integrations

Allowed integrators:

  • webhook

Allowed config attributes for integrators:

  • webhook
    • url (String)
    • method (String get or post)

Allowed binding resource types:

  • call

  • door_release

GET /v3/tenants/2262/integrations
Requestsreturns the list of integrations associated with this tenant

GET  /v3/tenants/2262/integrations

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70",
      "type": "integrations",
      "attributes": {
        "integrator": "webhook",
        "config": {
          "url": "http://localhost:999",
          "method": "get"
        },
        "bindings": [
          {
            "resource_type": "door_release",
            "resource_id": "7",
            "actions": [
              "update",
              "destroy"
            ]
          }
        ]
      },
      "relationships": {
        "bindings": {
          "data": [
            {
              "resource_type": "door_release",
              "resource_id": "7",
              "actions": [
                "update",
                "destroy"
              ]
            }
          ]
        },
        "building": {
          "data": null
        },
        "tenant": {
          "data": {
            "id": "2262",
            "type": "units_users"
          }
        }
      },
      "links": {
        "self": "http://api.butterflymx.com/v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70"
      }
    }
  ],
  "links": {
    "self": "http://api.butterflymx.com/v3/tenants/2262/integrations?page%5Bnumber%5D=1&page%5Bsize%5D=10",
    "first": "http://api.butterflymx.com/v3/tenants/2262/integrations?page%5Bnumber%5D=1&page%5Bsize%5D=10",
    "prev": null,
    "next": null,
    "last": "http://api.butterflymx.com/v3/tenants/2262/integrations?page%5Bnumber%5D=1&page%5Bsize%5D=10"
  }
}

List
GET/v3/tenants/{tenant_id}/integrations

URI Parameters
HideShow
tenant_id
number (required) Example: 2262

GET /v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70
Requestsreturns the requested integration

GET  /v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70",
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "config": {
        "url": "http://localhost:999",
        "method": "get"
      },
      "bindings": [
        {
          "resource_type": "door_release",
          "resource_id": "7",
          "actions": [
            "update",
            "destroy"
          ]
        }
      ]
    },
    "relationships": {
      "bindings": {
        "data": [
          {
            "resource_type": "door_release",
            "resource_id": "7",
            "actions": [
              "update",
              "destroy"
            ]
          }
        ]
      },
      "building": {
        "data": null
      },
      "tenant": {
        "data": {
          "id": "2262",
          "type": "units_users"
        }
      }
    },
    "links": {
      "self": "http://api.butterflymx.com/v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70"
    }
  }
}

Show
GET/v3/tenants/{tenant_id}/integrations/{id}

URI Parameters
HideShow
tenant_id
number (required) Example: 2262
id
string (required) Example: bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70

POST /v3/tenants/2262/integrations
Requestscreates the integration for the tenant

POST  /v3/tenants/2262/integrations

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Body
{
  "data": {
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "configuration": {
        "url": "http://localhost:666",
        "method": "post"
      },
      "bindings": [
        {
          "actions": [
            "create"
          ],
          "resource_type": "call",
          "resource_id": null
        }
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70",
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "config": {
        "url": "http://localhost:666",
        "method": "post"
      },
      "bindings": [
        {
          "resource_type": "call",
          "resource_id": "",
          "actions": [
            "create"
          ]
        }
      ]
    },
    "relationships": {
      "bindings": {
        "data": [
          {
            "resource_type": "call",
            "resource_id": "",
            "actions": [
              "create"
            ]
          }
        ]
      },
      "building": {
        "data": null
      },
      "tenant": {
        "data": {
          "id": "2262",
          "type": "units_users"
        }
      }
    },
    "links": {
      "self": "http://api.butterflymx.com/v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70"
    }
  }
}

Create
POST/v3/tenants/{tenant_id}/integrations

URI Parameters
HideShow
tenant_id
number (required) Example: 2262

PATCH /v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70
Requestsupdates the tenet's integration

PATCH  /v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70

Headers
Accept: application/vnd.api+json
Content-Type: application/json
Body
{
  "data": {
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "configuration": {
        "url": "http://localhost:999",
        "method": "get"
      },
      "bindings": [
        {
          "actions": [
            "update",
            "destroy"
          ],
          "resource_type": "door_release",
          "resource_id": "7"
        }
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70",
    "type": "integrations",
    "attributes": {
      "integrator": "webhook",
      "config": {
        "url": "http://localhost:999",
        "method": "get"
      },
      "bindings": [
        {
          "resource_type": "door_release",
          "resource_id": "7",
          "actions": [
            "update",
            "destroy"
          ]
        }
      ]
    },
    "relationships": {
      "bindings": {
        "data": [
          {
            "resource_type": "door_release",
            "resource_id": "7",
            "actions": [
              "update",
              "destroy"
            ]
          }
        ]
      },
      "building": {
        "data": null
      },
      "tenant": {
        "data": {
          "id": "2262",
          "type": "units_users"
        }
      }
    },
    "links": {
      "self": "http://api.butterflymx.com/v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70"
    }
  }
}

Update
PATCH/v3/tenants/{tenant_id}/integrations/{id}

URI Parameters
HideShow
tenant_id
number (required) Example: 2262
id
string (required) Example: bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70

DELETE /v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70
Requestsdeletes the tenant's integration

DELETE  /v3/tenants/2262/integrations/bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70

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

Delete
DELETE/v3/tenants/{tenant_id}/integrations/{id}

URI Parameters
HideShow
tenant_id
number (required) Example: 2262
id
string (required) Example: bb7b0ec9-8b2f-46c4-a1c7-4bf439ca4c70

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": "2292",
      "type": "tenants",
      "attributes": {
        "active_at": "2019-10-21T11:01:31Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "Dynamic Assurance Strategist",
        "display_name": "Dr. Alexandria Hermiston",
        "display_name_strategy": "building",
        "display_first_name": "Miss Robb Krajcik",
        "display_last_name": "Lila Hahn Sr.",
        "display_only_on_search": false,
        "pin_enabled": false,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "102",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "73",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "2291",
      "type": "tenants",
      "attributes": {
        "active_at": "2019-10-21T11:01:31Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "Direct Quality Director",
        "display_name": "Josianne Buckridge",
        "display_name_strategy": "building",
        "display_first_name": "Cathrine Trantow",
        "display_last_name": "Mr. Luciano Deckow",
        "display_only_on_search": true,
        "pin_enabled": false,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "102",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "72",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "2290",
      "type": "tenants",
      "attributes": {
        "active_at": "2019-10-21T11:01:31Z",
        "inactive_at": null,
        "qr_key_enabled": true,
        "directory_message": "District Intranet Orchestrator",
        "display_name": "Aimee Littel Sr.",
        "display_name_strategy": "building",
        "display_first_name": "Shaylee Zboncak",
        "display_last_name": "Miss Dashawn Turner",
        "display_only_on_search": false,
        "pin_enabled": false,
        "email_notifications": true,
        "sms_notifications": true,
        "do_not_disturb": false
      },
      "relationships": {
        "unit": {
          "data": {
            "id": "102",
            "type": "units"
          }
        },
        "user": {
          "data": {
            "id": "71",
            "type": "users"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "73",
      "type": "users",
      "attributes": {
        "name": "Jayne Skiles",
        "first_name": "Jayne",
        "last_name": "Skiles",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "73",
        "email": "destiney.ohara@dachfeil.biz",
        "sms_phone_number": null,
        "phone_number": null
      }
    },
    {
      "id": "72",
      "type": "users",
      "attributes": {
        "name": "Nikki Moen",
        "first_name": "Nikki",
        "last_name": "Moen",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "72",
        "email": "juliana_reilly@beer.co",
        "sms_phone_number": null,
        "phone_number": null
      }
    },
    {
      "id": "71",
      "type": "users",
      "attributes": {
        "name": "Nestor Feest",
        "first_name": "Nestor",
        "last_name": "Feest",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "71",
        "email": "toney@mills.io",
        "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/2293
Requestsshows the tenant

GET  /v3/tenants/2293

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": "2293",
    "type": "tenants",
    "attributes": {
      "active_at": "2019-10-21T11:01:31Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": "Dynamic Solutions Director",
      "display_name": "Rebeka Huels",
      "display_name_strategy": "building",
      "display_first_name": "Forrest Davis",
      "display_last_name": "Forest Lind",
      "display_only_on_search": false,
      "pin_enabled": false,
      "email_notifications": true,
      "sms_notifications": true,
      "do_not_disturb": false
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "104",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "75",
          "type": "users"
        }
      }
    }
  },
  "included": [
    {
      "id": "75",
      "type": "users",
      "attributes": {
        "name": "Lori Aufderhar",
        "first_name": "Lori",
        "last_name": "Aufderhar",
        "contact_preference": "phone_call",
        "thumb_url": null,
        "medium_url": null,
        "sip_username": "75",
        "email": "lonnie@greenfeldergraham.io",
        "sms_phone_number": null,
        "phone_number": null
      }
    }
  ]
}

Show
GET/v3/tenants/{id}

URI Parameters
HideShow
id
number (required) Example: 2293

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": 106,
      "email": "zella@konopelski.co",
      "active_at": "2019-10-21T11:01:31Z"
    },
    "type": "tenants",
    "relationships": null
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "2294",
    "type": "tenants",
    "attributes": {
      "active_at": "2019-10-21T11:01:31Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": null,
      "display_name": "Sandra Kohler",
      "display_name_strategy": "building",
      "display_first_name": "Sandra",
      "display_last_name": "Kohler",
      "display_only_on_search": false,
      "pin_enabled": false,
      "email_notifications": false,
      "sms_notifications": false,
      "do_not_disturb": false
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "106",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "77",
          "type": "users"
        }
      }
    }
  }
}

POST  /v3/tenants

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "attributes": {
      "unit_id": 108,
      "email": "",
      "first_name": "",
      "last_name": "User",
      "active_at": "2019-10-21T11:01:32Z"
    },
    "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/2295
Requestsupdates the tenantreturns bad request

PATCH  /v3/tenants/2295

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "2295",
    "attributes": {
      "do_not_disturb": true
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "2295",
    "type": "tenants",
    "attributes": {
      "active_at": "2019-10-21T11:01:32Z",
      "inactive_at": null,
      "qr_key_enabled": true,
      "directory_message": "Chief Implementation Executive",
      "display_name": "Grayson Waelchi",
      "display_name_strategy": "building",
      "display_first_name": "Dr. Marianne Feeney",
      "display_last_name": "Valerie Osinski",
      "display_only_on_search": true,
      "pin_enabled": false,
      "email_notifications": true,
      "sms_notifications": true,
      "do_not_disturb": true
    },
    "relationships": {
      "unit": {
        "data": {
          "id": "110",
          "type": "units"
        }
      },
      "user": {
        "data": {
          "id": "81",
          "type": "users"
        }
      }
    }
  }
}

PATCH  /v3/tenants/2296

Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "tenants",
    "id": "2296",
    "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: 2295

DELETE /v3/tenants/2297
Requestsdeletes the tenant

DELETE  /v3/tenants/2297

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: 2297

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/117
Requestsshows the unit

GET  /v3/units/117

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": "117",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "43043",
      "floor_number": 43
    },
    "relationships": {
      "building": {
        "data": {
          "id": "1372",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

Show
GET/v3/units/{id}

URI Parameters
HideShow
id
number (required) Example: 117

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": "121",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "46046",
        "floor_number": 46
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1374",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "120",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "45045",
        "floor_number": 45
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1374",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "119",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "44044",
        "floor_number": 44
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1374",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "118",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "00",
        "floor_number": 1
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1374",
            "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": "125",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "49049",
        "floor_number": 49
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1375",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "124",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "48048",
        "floor_number": 48
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1375",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "123",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "47047",
        "floor_number": 47
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1375",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    },
    {
      "id": "122",
      "type": "units",
      "attributes": {
        "unit_type": "apartment",
        "label": "00",
        "floor_number": 1
      },
      "relationships": {
        "building": {
          "data": {
            "id": "1375",
            "type": "buildings"
          }
        },
        "users": {
          "data": []
        }
      }
    }
  ],
  "included": [
    {
      "id": "1375",
      "type": "buildings",
      "attributes": {
        "name": "Dietrich-Lang-76",
        "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
        },
        "open_door_button_enabled": true,
        "address_1": "22897 Jaskolski Spring",
        "address_2": "North Euniceton, NH 56432",
        "city": "North Euniceton",
        "state": "New Hampshire",
        "zip_code": "56432",
        "phone_number": "1-777-586-7420",
        "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/1376/units
Requestscreates the unitreturns bad requestreturns not found

POST  /v3/buildings/1376/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": "127",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "foo",
      "floor_number": 11
    },
    "relationships": {
      "building": {
        "data": {
          "id": "1376",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

POST  /v3/buildings/1377/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": "Requested record could not be found"
    }
  ]
}

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

URI Parameters
HideShow
building_id
number (required) Example: 1376

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

PUT  /v3/units/132

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": 1379
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "132",
    "type": "units",
    "attributes": {
      "unit_type": "apartment",
      "label": "New Label",
      "floor_number": 11
    },
    "relationships": {
      "building": {
        "data": {
          "id": "1379",
          "type": "buildings"
        }
      },
      "users": {
        "data": []
      }
    }
  }
}

PUT  /v3/units/135

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: 132

DELETE /v3/units/138
Requestsdeletes a unit

DELETE  /v3/units/138

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: 138

Generated by aglio on 21 Oct 2019