Introduction


Attention: LockState’s v1 API is currently in Beta.

LockState makes periodic changes to improve the performance of our API, as well as adding new functionality. LockState will notify registered API users of updates requiring changes.


This document contains all necessary resources to consume the LockState RESTful API, meaning that a client application is able authenticate a user, fetch, create, update, delete and perform other actions via HTTP with objects in JSON representation.

Production environment

  • OAuth base URL: https://connect.remotelock.com
  • API base URL: https://api.remotelock.com

Changelog

  • 2018-08-13
    • Added battery_replaced event type for Lock.
  • 2018-04-12
    • Added a signal_quality attribute to Lock, PowerPlug, Thermostat.
    • Deprecated wifi_level attribute on Lock, PowerPlug, Thermostat.
  • 2017-09-19
    • Added a generate_pin attribute when creating and updating access persons. Its default value is false and when true is passed, a random PIN is generated for that access person.
  • 2017-07-27
    • Add requirements and recommendations for webhook endpoint handler.

      See Notification Subscriber > Create a webhook notification subscriber section.

      The new requirements will be enforced as of August 14, 2017.

  • 2017-07-18
    • Add status attribute to access_guest and access_user types.

      Statuses for access_guest type:

      • upcoming - initial status when start time has not met yet
      • current - initial status when start time has already met
      • expired - when end time has already met
      • deactivated - when a user manually deactivates it. See new endpoint below


      Statuses for access_user type:

      • current - initial status
      • deactivated - when a user manually deactivates it. See new endpoint below


    • Add PUT /access_persons/:id/deactivate endpoint to deactivate access person on associated devices and keep the record on history. We recommend using this new endpoint rather than DELETE /access_persons/:id because you can fetch past access persons using the filter explained below.

      The current behavior of DELETE /access_persons/:id was preserved: once it deletes, the access person cannot be fetched via API or UI anymore.

    • Add ability to filter access persons by status(es). Example:

      GET /access_persons?attributes[status][]=deactivated&attributes[status][]=expired

    • When status filter is not provided to GET /access_persons, the current behavior was preserved: it only retrieves upcoming and current statuses.

  • 2017-06-20
    • Remove record_type, record_id, to_type and to_id attributes from PUT /common_doors/:id endpoint.
  • 2017-05-24
    • Remove ACS instructions and all the remaining ACS controller endpoints.
  • 2017-03-14
    • remove Access Instructions, Device Permissions, Guest Email Templates, Roles, User Roles, User Invitations
  • 2017-02-27
    • Add event examples for new event types: access_person_synced_event, access_person_sync_failed_event and access_guest_late_sync_event
  • 2017-02-23
    • Add the following fields to access_person_access API type:
      • devices_count
      • devices_synced_count
      • devices_failed_sync_count
      • devices_pending_sync_count
  • 2017-02-20
    • Add email preview/resend capability to Resort Lock Guests
  • 2017-02-07
    • remove generated_pin_digits attribute from the Account
    • removed all attributes from ACS doors except name, state, lock_action_schedule_id and location_id
  • 2017-01-26
    • change wake_wifi parameter options
    • add LS-5i only wake_wifi option user_action_except_manual
  • 2016-12-19
    • Remove all billing endpoints.
  • 2016-12-06
    • Deprecate all ACS endpoints except ACS doors.
    • Devices endpoint returns ACS doors instead of ACS readers.
    • Multiple endpoints now accept or are related to ACS doors instead of ACS readers: events, notifications, device permissions, door groups, notification subscriptions, access person accesses and common doors.
    • All the existing objects that used ‘acs_reader’ type are now migrated to ‘acs_door’ (ID stays the same).
  • 2016-11-23
    • Added Common Doors functionality
  • 2016-11-18
    • wifi_level_changed event is now connectivity
    • power_level_changed event is now power_level_low
  • 2016-11-15
    • Guest emails are no longer automatically sent (with the exception of integrations). You must explicitly send the email via: POST /access_persons/:id/email/notify
  • 2016-11-02
    • Local PINs support for 5i/6i/7i.
  • 2016-11-01
    • Resort Lock Guests only support hours. Please see parameters.
    • Delivery of Access Denied and Locked notifications.

Authentication


RemoteLock uses OAuth 2.0 to authenticate users in applications installed in mobile devices or running in external servers. The supported OAuth flows:

  • Authorization Code Grant - RFC 6749-Section 4.1

    The RemoteLock user credentials are only accepted in RemoteLock sign in page, which generates an Authorization Code for an access token request.

    The access token for this flow gives access to the user resources that signed in using your Application.

  • Client Credentials Grant - RFC 6749-Section 4.4

    Only the Application ID and Secret are used to authorize access to the API.

    The access token for this flow only allows access to resources associated with the application’s account.

Once a user is authorized, every API request must include a valid access token.

Before proceeding: pick the OAuth flow that is suitable for your business and skip the flows that do not apply to your account in this guide.

The following OAuth 2.0 endpoints are available under https://connect.remotelock.com/. These are needed for OAuth2 client library you’ll be using:

    GET       /oauth/authorize
    POST      /oauth/token

Choose an OAuth2 client library for your language

To simplify integration with RemoteLock it is strongly recommended to use one of the open source OAuth2 client libraries available in your language. The library will handle many details described in this documentation.

Since OAuth2 is an open protocol a quick Google search will give you at least a couple options. Here are some examples:

  • iOS: https://github.com/OAuthSwift/OAuthSwift
  • Android: https://github.com/wuman/android-oauth-client
  • Ruby: https://github.com/intridea/oauth2

Setup a new Application

  1. Send an email to sales@lockstate.com requesting API Access for your account.
  2. Once API access is enabled for your account, go to the developer portal and sign in to manage your OAuth Applications.

1. Authorization Code Grant - RFC 6749-Section 4.1

1.1. Generating the initial Authorization Code

Whenever you need access to a user’s account for the first time, the application should load the Authorize URL in a browser or webview. The user will enter the credentials and the server will redirect to the Callback URL so that the application can extract the authorization code and then generate an access token.

Example:

Let your Application settings be:

Application ID: abc
Secret: xyz
Callback URL: http://your.server/oauth_callback

The Authorize URL should be:

https://connect.remotelock.com/oauth/authorize?client_id=a1b2c3&response_type=code&redirect_uri=http://your.server/oauth_callback

Your app should load the above URL in a browser and the user will enter credentials on it. Once the authentication succeeds, the server will redirect the request to:

http://your.server/oauth_callback?code=123

where 123 is the Authorization Code that is valid for 10 minutes, which is enough time to your application request the token for the first time. Your application must be able to handle this URL in order to capture this code so that it can obtain the OAuth Token.

1.2. Generating an OAuth Token

  • Make the following POST request to obtain Access and Refresh tokens:

    POST /oauth/token
    Host: connect.remotelock.com
    Content-Type: application/x-www-form-urlencoded
    
    code=123&
    client_id=abc&
    client_secret=xyz&
    redirect_uri=http://your.server/oauth_callback&
    grant_type=authorization_code
    
  • The response will be a JSON such as:

    {
      "access_token": "1/4cc3ss-t0k3n",
      "expires_in": 7200,
      "token_type": "Bearer",
      "refresh_token": "1/r3fR3sH-t0k3n"
    }
    

1.3. Refresh Token

Each access token expires in 7200 seconds (2 hours). The access token JSON response contains a refresh_token that can be used to issue a new access_token without asking for user authentication again.

  • In order to get a new access token, make the following POST request:

    POST /oauth/token
    Host: connect.remotelock.com
    Content-Type: application/x-www-form-urlencoded
    
    client_id=abc&
    client_secret=123&
    refresh_token=1/r3fR3sH-t0k3n&
    grant_type=refresh_token
    
  • The response will be a JSON such as:

    {
      "access_token": "1/N3w-4cc3ss-T0k3n",
      "expires_in": 7200,
      "refresh_token": "1/n3w-r3fR3sH-t0k3n"
      "token_type": "Bearer"
    }
    

Your application should store both Access Token and Refresh Token so that it can access the user account when the user is offline or the application is running in background.

Whenever an Access Token expires and you use the Refresh Token to request a new Access Token, the response includes a new Refresh Token, meaning the previous one became invalid, and then your application should store the new Access Token and Refresh Token replacing the previous (expired) ones.

Here is an example of this flow:

  1. Customer authorizes and you get the initial Access Token A as well as a Refresh Token X
  2. You access customer data using Access Token A
  3. After 2 hours the Access Token A expires, but you need to access customer data and you notice that Access Token A is expired
  4. You make a request to issue a new Access Token based on the Refresh Token X and you get a new Access Token B and a new Refresh Token Y. At this point, the Refresh Token X becomes invalid since it was just used
  5. Repeat from step 2 replacing A with B and X with Y

The user can revoke the authorization to your app at anytime, so the Refresh Token will become invalid and your app will need to ask for user authorization again.

2. Client Credentials Grant - RFC 6749-Section 4.4

In this flow, only your account resources are available via API. For this reason, the only credentials required are the Application ID and Secret.

Let your Application settings be:

Application ID: abc
Secret: xyz

2.1. Generating an OAuth Token

  • Make the following POST request to obtain Access and Refresh tokens:

    POST /oauth/token
    Host: connect.remotelock.com
    Content-Type: application/x-www-form-urlencoded
    
    client_id=abc&
    client_secret=xyz&
    grant_type=client_credentials
    
  • The response will be a JSON such as:

    {
      "access_token": "1/4cc3ss-t0k3n",
      "expires_in": 7200,
      "token_type": "Bearer",
    }
    

Notice that this flow does not include a Refresh Token, meaning that this same request must be done when the access token expires.

Making requests with an OAuth Token

Just make a GET request using a valid access token. Example:

GET /locations
Host: api.remotelock.com
Accept: application/vnd.lockstate.v1+json
Authorization: Bearer 1/4cc3ss-t0k3n

Revoking an OAuth Access Token

Send the following POST request to immediately revoke a token:

POST /oauth/revoke
Host: connect.remotelock.com
Content-Type: application/x-www-form-urlencoded

client_id=abc&
client_secret=xyz&
token=1/4cc3ss-t0k3n

JSON Structure Overview

JSON request structure

The HTTP methods POST/PUT/PATCH require the header Content-Type: application/json and the request body must contain a valid JSON structure.

Other HTTP methods accept empty or missing Content-Type header since the request body is ignored.

Example JSON request structure:

  • POST https://api.remotelock.com/articles/3/comments

    {
      "attributes": {
        "body": "Very informative article"
      }
    }
    

JSON response structure

  • All responses have data root key. data object keys are id, type, attributes and links (optional).
  • meta top level key is used for collection pagination.
  • Relationship resource URLs can be fetched from the links key. A self URL is also included.
  • “1-to-1” relationship object ids are included in the attributes object. Example: "author_id": 1 for the author relationship.
  • All date and time fields are using ISO 8601 format.

JSON response structure for a collection

  • GET https://api.remotelock.com/articles

    {
      "data": [
        {
          "type": "article",
          "id": "3",
          "attributes": {
            "title": "JSON API paints my bikeshed!",
            "body": "The shortest article. Ever.",
            "author_id": 1,
            "created_at": "2015-07-23T18:51:11Z",
            "updated_at": "2015-07-23T18:51:11Z"
          },
          "links": {
            "self": "https://api.remotelock.com/articles/3",
            "author": "https://api.remotelock.com/authors/1",
            "comments": "https://api.remotelock.com/comments"
          }
        },
        {
          "type": "article",
          "id": "5",
          "attributes": {
            "title": "Ruby on Rails framework",
            "body": "RoR is 10 years old!",
            "author_id": 1,
            "created_at": "2015-05-22T14:56:29Z",
            "updated_at": "2015-05-22T14:56:28Z"
          },
          "links": {
            "self": "https://api.remotelock.com/articles/3",
            "author": "https://api.remotelock.com/authors/1",
            "comments": "https://api.remotelock.com/comments"
          }
        }
      ],
      "meta": {
        "page": 1,
        "per_page": 2,
        "total_pages": 7,
        "total_count": 14
      }
    }
    

JSON response structure for a single resource

  • GET https://api.remotelock.com/articles/3

    {
      "data": {
        "type": "article",
        "id": "3",
        "attributes": {
          "title": "JSON API paints my bikeshed!",
          "body": "The shortest article. Ever.",
          "author_id": 1,
          "created_at": "2015-07-23T18:51:11Z",
          "updated_at": "2015-07-23T18:51:11Z"
        },
        "links": {
          "self": "https://api.remotelock.com/articles/3",
          "author": "https://api.remotelock.com/authors/1",
          "comments": "https://api.remotelock.com/comments"
        }
      }
    }
    

Errors

There are 2 types of error responses:

  • resource errors
  • general errors

Resource errors

Resource errors are used to indicate an error happened for a resource you’re trying to work with. For example: if an invalid configuration option is passed when updating a lock, the response will be a resource error.

Here’s the example response when an error happens:

{
  "attributes": {
    "name": "",
    "age": 10
  },
  "errors": [{
    "attribute": "name",
    "messages": ["is empty"],
    "full_messages": ["name is empty"]
  }]
}

In case an error is not related to a particular attribute, the errors attribute value will be null.

{
  "attributes": {
    "name": "",
    "age": 10
  },
  "errors": [{
    "attribute": null,
    "messages": ["Subuser creation limit reached, please upgrade your account."],
    "full_messages": ["Subuser creation limit reached, please upgrade your account."]
  }]
}

General errors

General errors are used to describe application-wide errors. For example: the response contains general error if you try creating a lock but the account doesn’t have a paid subscription.

Here’s the example response:

{
  "message": "Please create a subscription",
  "type": "billing_subscription_required"
}

Pagination

Collection resources can be paginated using the data from meta top level key.

{
  "data": { ... },
  "meta": {
    "page": 1,
    "per_page": 2,
    "total_pages": 7,
    "total_count": 14
  }
}

On every endpoint that responds with a collection of resources, you can provide the following query parameters:

  • page (Default: 1, Minimum: 1, Maximum: value of total_pages from meta)
  • per_page (Default: 25, Mimimum: 1, Maximum: 50)

The pagination is limited to access up to 10,000 resources, which means the product page * per_page should not exceed that number.

Examples:

  • /devices?page=5 retrieves the 5th page of devices
  • /devices?per_page=40 retrieves the first 40 devices
  • /devices?per_page=50&page=2 retrieves devices from 51 to 100

Filtering

Filter results by multiple ids

Supported in endpoints that return a collection of resources

  • Query format: ?id[]=<id 1>&id[]=<id 2>&...

    Example: To retrieve devices with ids a1b2 and c3d4:

    GET https://api.remotelock.com/devices?id[]=a1b2&id[]=c3d4

Filter results by resource type

Supported in endpoints that return a collection of resources of multiple types

  • Query format for a single type: ?type=<type>

    Example: To retrieve devices of a single type, lock:

    GET https://api.remotelock.com/devices?type=lock

  • Query format for multiple type: ?type[]=<type 1>&type[]=<type 2>&...

    Example: To retrieve devices of types power_plug and camera:

    GET https://api.remotelock.com/devices?type[]=camera&type[]=power_plug

Filter results by association

Used to apply the id or type filter in a resource association

Example: To retrieve devices of the location a1b2

GET https://api.remotelock.com/devices?attributes[location_id]=a1b2

Sorting


Most endpoints that return a collection are sortable. Additionally, these endpoints usually have a default sort attribute. The documentation for each endpoint specifies the default sort attribute as well as other attributes that can be used for sorting (if any).

Query formats

  • using single sort attribute: ?sort=<attr>
  • using multiple sort attributes: ?sort[]=<attr 1>&sort[]=<attr 2>&...

Sort order

The default sort order for any attribute is “ascending”. In order to get “descending” sort order prefix the attribute with hyphen (-).

Examples:

  • “ascending” sort order: ?sort=name
  • “descending” sort order with hyphen: ?sort=-name

Examples:

  • Retrieve devices sorted “ascending” by name attribute:

    GET https://api.remotelock.com/devices?sort=name

  • Retrieve devices sorted “descending” by name attribute:

    GET https://api.remotelock.com/devices?sort=-name

  • Retrieve devices sorted “ascending” by created_at and “descending” by name:

    GET https://api.remotelock.com/devices?sort[]=created_at&sort[]=-name

API versioning


Specifying API version

It is strongly recommended to explicitly specify the version. Specifying the version can be done:

  • in the resource url

      https://api.remotelock.com/v1/articles/1
    
  • or via request Accept header

      Accept: application/vnd.lockstate+json; version=1
    

If API version is not specified, the application will default to the latest version.

Changes

API version will increase only if there’s a breaking change.

For example: if a single field is added to the resource, the version won’t change as this is a non breaking change.

Rate Limiting


Currently, each account is limited to 120 requests/minute.

Each API response includes rate limiting related headers such as:

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 15
X-RateLimit-Reset: 1452626187
Header Description
X-RateLimit-Limit The maximum number of requests that the account is allowed to make per minute.
X-RateLimit-Remaining The number of requests remaining in current rate limit window.
X-RateLimit-Reset UTC epoch seconds in which the current rate limit window will reset


Whenever the account has exceeded the rate limit, the request will be responded with status 429 (Too Many Requests) and the body will contain following JSON:

{
  message: "Your account has exceeded the rate limit. Check the X-RateLimit-* headers."
}

Access Exceptions

Get all access exceptions

Endpoint

GET /access_exceptions

Parameters

Name Description
sort Sortable attributes: created_at and name, default: created_at ascending

Request

Route

GET /access_exceptions

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_exception",
      "attributes": {
        "name": "Quaerat ut omnis deserunt animi reprehenderit corporis ea et.",
        "dates": [
          {
            "start_date": "2016-11-24",
            "end_date": "2016-11-25"
          },
          {
            "start_date": "2015-12-25",
            "end_date": "2015-12-25"
          }
        ],
        "created_at": "2018-08-29T18:24:14Z",
        "updated_at": "2018-08-29T18:24:14Z"
      },
      "id": "0edb93b5-f1ce-4880-96ac-7dd3ed8e1346",
      "links": {
        "self": "http://api.lockstate.dev/access_exceptions/0edb93b5-f1ce-4880-96ac-7dd3ed8e1346"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 1
  }
}

Get an access exception

Endpoint

GET /access_exceptions/:id

Request

Route

GET /access_exceptions/377096e0-90d5-48ce-a945-f2619f65bb6c

Response

Status

200

Body

{
  "data": {
    "type": "access_exception",
    "attributes": {
      "name": "Sed non atque reiciendis non molestiae consequatur suscipit et.",
      "dates": [
        {
          "start_date": "2016-11-24",
          "end_date": "2016-11-25"
        },
        {
          "start_date": "2015-12-25",
          "end_date": "2015-12-25"
        }
      ],
      "created_at": "2018-08-29T18:24:15Z",
      "updated_at": "2018-08-29T18:24:15Z"
    },
    "id": "377096e0-90d5-48ce-a945-f2619f65bb6c",
    "links": {
      "self": "http://api.lockstate.dev/access_exceptions/377096e0-90d5-48ce-a945-f2619f65bb6c"
    }
  }
}

Create an access exception

Endpoint

POST /access_exceptions

Parameters

Name Description
attributes[name] required Access exception name
attributes[dates] required [{ "start_date": "2016-01-01", "end_date": "2016-01-01" }, ...]

Request

Route

POST /access_exceptions

Body

{
  "attributes": {
    "name": "Thanks Giving and Christmas",
    "dates": [
      {
        "start_date": "2016-11-24",
        "end_date": "2016-11-25"
      },
      {
        "start_date": "2015-12-25",
        "end_date": "2015-12-25"
      }
    ]
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "access_exception",
    "attributes": {
      "name": "Thanks Giving and Christmas",
      "dates": [
        {
          "start_date": "2016-11-24",
          "end_date": "2016-11-25"
        },
        {
          "start_date": "2015-12-25",
          "end_date": "2015-12-25"
        }
      ],
      "created_at": "2018-08-29T18:24:15Z",
      "updated_at": "2018-08-29T18:24:15Z"
    },
    "id": "b1ccbf80-fc04-42cd-b6cb-fb3f3a426d84",
    "links": {
      "self": "http://api.lockstate.dev/access_exceptions/b1ccbf80-fc04-42cd-b6cb-fb3f3a426d84"
    }
  }
}

Update an access exception

Endpoint

PUT /access_exceptions/:id

Parameters

Name Description
attributes[name] Access exception name
attributes[dates] required [{ "start_date": "2016-01-01", "end_date": "2016-01-01" }, ...]

Request

Route

PUT /access_exceptions/b16d9a6d-20ea-4e0b-b6f4-50253808158c

Body

{
  "attributes": {
    "name": "Thanks Giving",
    "dates": [
      {
        "start_date": "2016-11-24",
        "end_date": "2016-11-25"
      }
    ]
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "access_exception",
    "attributes": {
      "name": "Thanks Giving",
      "dates": [
        {
          "start_date": "2016-11-24",
          "end_date": "2016-11-25"
        }
      ],
      "created_at": "2018-08-29T18:24:15Z",
      "updated_at": "2018-08-29T18:24:15Z"
    },
    "id": "b16d9a6d-20ea-4e0b-b6f4-50253808158c",
    "links": {
      "self": "http://api.lockstate.dev/access_exceptions/b16d9a6d-20ea-4e0b-b6f4-50253808158c"
    }
  }
}

Delete an access exception

Endpoint

DELETE /access_exceptions/:id

Request

Route

DELETE /access_exceptions/1d47f1e3-0398-442a-8521-670b8b4ef629

Response

Status

204

Access Persons

Get access persons

Returns all access person types (homogeneous).

Status

Statuses for access_guest type:

  • upcoming - initial status when start time has not met yet
  • current - initial status when start time has already met
  • expired - when end time has already met
  • deactivated - when a user manually deactivates it. See new endpoint below


Statuses for access_user type:

  • current - initial status
  • deactivated - when a user manually deactivates it. See new endpoint below

This endpoint returns only current and upcoming by default. See next example to fetch expired and deactivated access persons.

Endpoint

GET /access_persons

Parameters

Name Description method
type Filter by type(s). Supported types: access_user and access_guest
sort Sortable attributes: created_at, updated_at, name, department, starts_at, and ends_at, default: created_at ascending
attributes[status] Status: current, upcoming, deactivated or expired. Default: current and upcoming. Supports array query status_param

Request

Route

GET /access_persons

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_user",
      "attributes": {
        "name": "Shaun Breitenberg",
        "email": "damaris@boscochristiansen.co",
        "phone": null,
        "pin": "1128",
        "card_number": null,
        "department": null,
        "status": "current",
        "rental_source": null,
        "created_at": "2018-08-29T18:24:34Z",
        "updated_at": "2018-08-29T18:24:34Z"
      },
      "id": "e006fad1-ea9f-448e-89de-5b77d3647fdf",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/e006fad1-ea9f-448e-89de-5b77d3647fdf"
      }
    },
    {
      "type": "access_guest",
      "attributes": {
        "name": "Yasmeen Beier",
        "email": "alexis@kilback.co",
        "phone": null,
        "pin": "1129",
        "card_number": null,
        "department": null,
        "status": "upcoming",
        "rental_source": null,
        "created_at": "2018-08-29T18:24:34Z",
        "updated_at": "2018-08-29T18:24:34Z",
        "starts_at": "2018-09-10T00:00:00",
        "ends_at": "2018-09-20T00:00:00"
      },
      "id": "af182f4f-4bbf-4bec-b2f3-351831cf6beb",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/af182f4f-4bbf-4bec-b2f3-351831cf6beb"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get access persons filtered by status

Endpoint

GET /access_persons

Parameters

Name Description method
type Filter by type(s). Supported types: access_user and access_guest
sort Sortable attributes: created_at, updated_at, name, department, starts_at, and ends_at, default: created_at ascending
attributes[status] Status: current, upcoming, deactivated or expired. Default: current and upcoming. Supports array query status_param

Request

Route

GET /access_persons?attributes[status][]=deactivated&attributes[status][]=expired

Query Parameters

attributes={"status"=>["deactivated", "expired"]}

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_user",
      "attributes": {
        "name": "Hilton Zboncak",
        "email": "breanne@cruickshankjohns.name",
        "phone": null,
        "pin": "1130",
        "card_number": null,
        "department": null,
        "status": "deactivated",
        "rental_source": null,
        "created_at": "2018-08-29T18:24:34Z",
        "updated_at": "2018-08-29T18:24:34Z"
      },
      "id": "13e09dc9-6e82-4e32-9c49-bbf07aca0965",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/13e09dc9-6e82-4e32-9c49-bbf07aca0965"
      },
      "meta": {
        "restricted_actions": [
          "update"
        ]
      }
    },
    {
      "type": "access_guest",
      "attributes": {
        "name": "Lee Rempel",
        "email": "lucinda_jacobson@orn.net",
        "phone": null,
        "pin": "1132",
        "card_number": null,
        "department": null,
        "status": "expired",
        "rental_source": null,
        "created_at": "2018-08-29T18:24:34Z",
        "updated_at": "2018-08-29T18:24:34Z",
        "starts_at": "2018-08-26T18:24:34",
        "ends_at": "2018-08-28T18:24:34"
      },
      "id": "5141d726-a86d-483b-8d84-88810db2391c",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/5141d726-a86d-483b-8d84-88810db2391c"
      },
      "meta": {
        "restricted_actions": [
          "update"
        ]
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get an access person

Endpoint

GET /access_persons/:id

Request

Route

GET /access_persons/a3f8f801-8f1d-4d61-90df-729909b32c1c

Response

Status

200

Body

{
  "data": {
    "type": "access_user",
    "attributes": {
      "name": "Cleo Reilly",
      "email": "mariah@mcclure.io",
      "phone": null,
      "pin": "1143",
      "card_number": null,
      "department": null,
      "status": "current",
      "rental_source": null,
      "created_at": "2018-08-29T18:24:37Z",
      "updated_at": "2018-08-29T18:24:37Z"
    },
    "id": "a3f8f801-8f1d-4d61-90df-729909b32c1c",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/a3f8f801-8f1d-4d61-90df-729909b32c1c"
    }
  }
}

Create an access user

‘Access user’ is a permanent access person type. The only difference from ‘access guest’ is it doesn’t accept ‘starts_at’ and ‘ends_at’ parameters.

Endpoint

POST /access_persons

Parameters

Name Description
type required access_user
attributes[name] required Name
attributes[email] Email
attributes[pin] Access person pin (pin, generate_pin or card_number are required)
attributes[card_number] Card number (pin, generate_pin or card_number are required)
attributes[generate_pin] When true, a random pin is generated (pin, generate_pin or card_number are required). Default: false
attributes[department] Department name

Request

Route

POST /access_persons

Body

{
  "type": "access_user",
  "attributes": {
    "name": "Ann Smith",
    "email": "ann.smith@example.com",
    "department": "Human Resources",
    "pin": "1234",
    "card_number": "23456"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "access_user",
    "attributes": {
      "name": "Ann Smith",
      "email": "ann.smith@example.com",
      "phone": null,
      "pin": "1234",
      "card_number": "23456",
      "department": "Human Resources",
      "status": "current",
      "rental_source": null,
      "created_at": "2018-08-29T18:24:37Z",
      "updated_at": "2018-08-29T18:24:37Z"
    },
    "id": "a083f2cb-f91a-47c5-a929-4c3b6aa53493",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/a083f2cb-f91a-47c5-a929-4c3b6aa53493"
    }
  }
}

Create an access guest

‘Access guest’ is a temporary access person type. It has all the same features as ‘access user’, with the addition of ‘starts_at’ and ‘ends_at’ parameters that enable additional access limiting.

Endpoint

POST /access_persons

Parameters

Name Description
type required access_guest
attributes[name] required Name
attributes[email] Email
attributes[pin] Access person pin (pin, generate_pin or card_number are required)
attributes[card_number] Card number (pin, generate_pin or card_number are required)
attributes[generate_pin] When true, a random pin is generated (pin, generate_pin or card_number are required). Default: false
attributes[starts_at] required Starts at ISO 8601 timestamp without time zone
attributes[ends_at] required Ends at ISO 8601 timestamp without time zone

Request

Route

POST /access_persons

Body

{
  "type": "access_guest",
  "attributes": {
    "starts_at": "2020-01-02T16:04:00",
    "ends_at": "2021-01-02T16:04:00",
    "name": "Ann Smith",
    "pin": "1234"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "access_guest",
    "attributes": {
      "name": "Ann Smith",
      "email": null,
      "phone": null,
      "pin": "1234",
      "card_number": null,
      "department": null,
      "status": "upcoming",
      "rental_source": null,
      "created_at": "2018-08-29T18:24:37Z",
      "updated_at": "2018-08-29T18:24:37Z",
      "starts_at": "2020-01-02T16:04:00",
      "ends_at": "2021-01-02T16:04:00"
    },
    "id": "06e7202d-612d-4963-9913-ab6ad3feb9e7",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/06e7202d-612d-4963-9913-ab6ad3feb9e7"
    }
  }
}

Update an access user

Endpoint

PUT /access_persons/:id

Parameters

Name Description
attributes[name] Name
attributes[email] Email
attributes[pin] Access person pin (pin, generate_pin or card_number are required)
attributes[card_number] Card number (pin, generate_pin or card_number are required)
attributes[generate_pin] When true, a random pin is generated (pin, generate_pin or card_number are required). Default: false
attributes[department] Department name

Request

Route

PUT /access_persons/2a2365cd-10c7-42c1-8d57-e763f275a3cb

Body

{
  "attributes": {
    "name": "House Owner",
    "pin": "2345"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "access_user",
    "attributes": {
      "name": "House Owner",
      "email": "jarrett_sauer@harberkeebler.net",
      "phone": null,
      "pin": "2345",
      "card_number": null,
      "department": null,
      "status": "current",
      "rental_source": null,
      "created_at": "2018-08-29T18:24:38Z",
      "updated_at": "2018-08-29T18:24:38Z"
    },
    "id": "2a2365cd-10c7-42c1-8d57-e763f275a3cb",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/2a2365cd-10c7-42c1-8d57-e763f275a3cb"
    }
  }
}

Update an access guest

Endpoint

PUT /access_persons/:id

Parameters

Name Description
attributes[name] Name
attributes[email] Email
attributes[pin] Access person pin (pin, generate_pin or card_number are required)
attributes[card_number] Card number (pin, generate_pin or card_number are required)
attributes[generate_pin] When true, a random pin is generated (pin, generate_pin or card_number are required). Default: false
attributes[starts_at] Starts at ISO 8601 timestamp without time zone
attributes[ends_at] Ends at ISO 8601 timestamp without time zone

Request

Route

PUT /access_persons/b45969cc-190c-4a59-b221-2f6f43eba625

Body

{
  "attributes": {
    "name": "Cleaning Crew",
    "ends_at": "2018-09-21T00:00:00Z"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "access_guest",
    "attributes": {
      "name": "Cleaning Crew",
      "email": "jonathan@hartmann.biz",
      "phone": null,
      "pin": "1160",
      "card_number": null,
      "department": null,
      "status": "upcoming",
      "rental_source": null,
      "created_at": "2018-08-29T18:24:39Z",
      "updated_at": "2018-08-29T18:24:39Z",
      "starts_at": "2018-09-11T00:00:00",
      "ends_at": "2018-09-21T00:00:00"
    },
    "id": "b45969cc-190c-4a59-b221-2f6f43eba625",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/b45969cc-190c-4a59-b221-2f6f43eba625"
    }
  }
}

Deactivates an access person

We recommend using this endpoint rather than DELETE /access_persons/:id because it allows you to fetch deactivated and expired access persons.

Endpoint

PUT /access_persons/:id/deactivate

Request

Route

PUT /access_persons/67ba738e-c1ee-4cfb-99ab-0427542845f9/deactivate

Response

Status

200

Body

{
  "data": {
    "type": "access_user",
    "attributes": {
      "name": "Mr. Kailey Kovacek",
      "email": "america_mitchell@lindgren.co",
      "phone": null,
      "pin": "1161",
      "card_number": null,
      "department": null,
      "status": "deactivated",
      "rental_source": null,
      "created_at": "2018-08-29T18:24:39Z",
      "updated_at": "2018-08-29T18:24:39Z"
    },
    "id": "67ba738e-c1ee-4cfb-99ab-0427542845f9",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/67ba738e-c1ee-4cfb-99ab-0427542845f9"
    },
    "meta": {
      "restricted_actions": [
        "update"
      ]
    }
  }
}

Delete an access person

Endpoint

DELETE /access_persons/:id

Request

Route

DELETE /access_persons/bb2b35d2-933a-47b4-9f93-043c4afd9d37

Response

Status

204

Schedule sending access instructions email to access guest

Endpoint

POST /access_persons/:id/email/notify

Parameters

Name Description
attributes[days_before] Schedule sending email a number of days before guest start time. Default: sends the email immediately.

Request

Route

POST /access_persons/963ea9e7-92b0-4e5d-8516-97ad5b9c2280/email/notify

Body

{
  "attributes": {
    "days_before": 1
  }
}

Response

Status

200

Get all of an access person's accesses

Endpoint

GET /access_persons/:access_person_id/accesses

Request

Route

GET /access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392/accesses

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 1,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 1,
        "devices_failed_sync_count": 0,
        "accessible_type": "lock",
        "created_at": "2018-08-29T18:24:42Z",
        "updated_at": "2018-08-29T18:24:42Z",
        "access_person_id": "b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "access_person_type": "access_user",
        "accessible_id": "9e8adb22-efa9-4d2c-b20f-b9032c01a600"
      },
      "id": "beb9fe3e-8482-445b-9d83-117409912c72",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392/accesses/beb9fe3e-8482-445b-9d83-117409912c72",
        "access_person": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "accessible": "http://api.lockstate.dev/devices/9e8adb22-efa9-4d2c-b20f-b9032c01a600"
      }
    },
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "acs_door",
        "created_at": "2018-08-29T18:24:42Z",
        "updated_at": "2018-08-29T18:24:42Z",
        "access_person_id": "b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "access_person_type": "access_user",
        "accessible_id": "00f86e19-895c-4521-80b3-df8598006eb0"
      },
      "id": "d100193d-8f3f-4e64-ad47-b30ec4553a57",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392/accesses/d100193d-8f3f-4e64-ad47-b30ec4553a57",
        "access_person": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "accessible": "http://api.lockstate.dev/acs/doors/00f86e19-895c-4521-80b3-df8598006eb0"
      }
    },
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "door_group",
        "created_at": "2018-08-29T18:24:42Z",
        "updated_at": "2018-08-29T18:24:42Z",
        "access_person_id": "b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "access_person_type": "access_user",
        "accessible_id": "84f299bd-df26-4374-a6f3-220377229705"
      },
      "id": "883afad4-2ce9-4ee0-ac1b-b354b7196ea0",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392/accesses/883afad4-2ce9-4ee0-ac1b-b354b7196ea0",
        "access_person": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "accessible": "http://api.lockstate.dev/groups/84f299bd-df26-4374-a6f3-220377229705"
      }
    },
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "location",
        "created_at": "2018-08-29T18:24:42Z",
        "updated_at": "2018-08-29T18:24:42Z",
        "access_person_id": "b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "access_person_type": "access_user",
        "accessible_id": "1d775981-56b4-4505-8981-41b1bf6349ae"
      },
      "id": "c587ebd0-173d-4ab8-a444-9ebf5b2c16cc",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392/accesses/c587ebd0-173d-4ab8-a444-9ebf5b2c16cc",
        "access_person": "http://api.lockstate.dev/access_persons/b5f238bc-ddc6-4845-af5d-9b4540f40392",
        "accessible": "http://api.lockstate.dev/locations/1d775981-56b4-4505-8981-41b1bf6349ae"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 4
  }
}

Get an access person's access

Endpoint

GET /access_persons/:access_person_id/accesses/:id

Request

Route

GET /access_persons/7028bbbd-145c-4bed-9a3c-ed06666a5ef2/accesses/35174379-3a11-412c-bc21-942fef54c2b1

Response

Status

200

Body

{
  "data": {
    "type": "access_person_access",
    "attributes": {
      "guest_start_time": null,
      "guest_end_time": null,
      "devices_count": 1,
      "devices_synced_count": 0,
      "devices_pending_sync_count": 1,
      "devices_failed_sync_count": 0,
      "accessible_type": "lock",
      "created_at": "2018-08-29T18:24:43Z",
      "updated_at": "2018-08-29T18:24:43Z",
      "access_person_id": "7028bbbd-145c-4bed-9a3c-ed06666a5ef2",
      "access_person_type": "access_user",
      "accessible_id": "f3b7e5c1-74dc-4cf8-b4eb-99ff6bab5753"
    },
    "id": "35174379-3a11-412c-bc21-942fef54c2b1",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/7028bbbd-145c-4bed-9a3c-ed06666a5ef2/accesses/35174379-3a11-412c-bc21-942fef54c2b1",
      "access_person": "http://api.lockstate.dev/access_persons/7028bbbd-145c-4bed-9a3c-ed06666a5ef2",
      "accessible": "http://api.lockstate.dev/devices/f3b7e5c1-74dc-4cf8-b4eb-99ff6bab5753"
    }
  }
}

Grant an access person access

Accessible can be one of: lock, acs_door, door_group or location

Endpoint

POST /access_persons/:access_person_id/accesses

Parameters

Name Description
attributes[accessible_type] required Accessible type: lock, acs_door, door_group or location
attributes[accessible_id] required Accessible id
attributes[access_schedule_id] Access schedule id
attributes[guest_start_time] Access Guest start time override, ISO 8601 24 hour time format
attributes[guest_end_time] Access Guest end time override, ISO 8601 24 hour time format

Request

Route

POST /access_persons/49fa4ed4-a285-4b5a-b459-367bfb4c7e74/accesses

Body

{
  "attributes": {
    "accessible_id": "3fbd7d86-3bf3-4634-9111-86b48bdb6df2",
    "accessible_type": "lock",
    "guest_start_time": "14:00",
    "access_schedule_id": "2d438b81-3119-4a55-9ed5-bf696d243877"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "access_person_access",
    "attributes": {
      "guest_start_time": "14:00:00",
      "guest_end_time": null,
      "devices_count": 0,
      "devices_synced_count": 0,
      "devices_pending_sync_count": 0,
      "devices_failed_sync_count": 0,
      "accessible_type": "lock",
      "created_at": "2018-08-29T18:24:44Z",
      "updated_at": "2018-08-29T18:24:44Z",
      "access_schedule_id": "2d438b81-3119-4a55-9ed5-bf696d243877",
      "access_person_id": "49fa4ed4-a285-4b5a-b459-367bfb4c7e74",
      "access_person_type": "access_guest",
      "accessible_id": "3fbd7d86-3bf3-4634-9111-86b48bdb6df2"
    },
    "id": "196e13c3-0d42-43d7-85ba-46aebd1631de",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/49fa4ed4-a285-4b5a-b459-367bfb4c7e74/accesses/196e13c3-0d42-43d7-85ba-46aebd1631de",
      "access_schedule": "http://api.lockstate.dev/schedules/2d438b81-3119-4a55-9ed5-bf696d243877",
      "access_person": "http://api.lockstate.dev/access_persons/49fa4ed4-a285-4b5a-b459-367bfb4c7e74",
      "accessible": "http://api.lockstate.dev/devices/3fbd7d86-3bf3-4634-9111-86b48bdb6df2"
    }
  }
}

Update an access person's access

Only updating the access schedule is supported. To change the accessible, revoke the access and grant a new one.

Endpoint

PUT /access_persons/:access_person_id/accesses/:id

Parameters

Name Description
attributes[access_schedule_id] Access schedule id

Request

Route

PUT /access_persons/54f99b8e-a325-43b4-b6db-feaaffeb57da/accesses/2728f18e-9ff9-44f5-953d-722787e6ffec

Body

{
  "attributes": {
    "access_schedule_id": "d86280fe-0be3-485c-9dc0-847057c416ff"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "access_person_access",
    "attributes": {
      "guest_start_time": null,
      "guest_end_time": null,
      "devices_count": 1,
      "devices_synced_count": 0,
      "devices_pending_sync_count": 1,
      "devices_failed_sync_count": 0,
      "accessible_type": "lock",
      "created_at": "2018-08-29T18:24:45Z",
      "updated_at": "2018-08-29T18:24:45Z",
      "access_schedule_id": "d86280fe-0be3-485c-9dc0-847057c416ff",
      "access_person_id": "54f99b8e-a325-43b4-b6db-feaaffeb57da",
      "access_person_type": "access_user",
      "accessible_id": "22954752-0a43-40a2-8652-78555c8f5a32"
    },
    "id": "2728f18e-9ff9-44f5-953d-722787e6ffec",
    "links": {
      "self": "http://api.lockstate.dev/access_persons/54f99b8e-a325-43b4-b6db-feaaffeb57da/accesses/2728f18e-9ff9-44f5-953d-722787e6ffec",
      "access_schedule": "http://api.lockstate.dev/schedules/d86280fe-0be3-485c-9dc0-847057c416ff",
      "access_person": "http://api.lockstate.dev/access_persons/54f99b8e-a325-43b4-b6db-feaaffeb57da",
      "accessible": "http://api.lockstate.dev/devices/22954752-0a43-40a2-8652-78555c8f5a32"
    }
  }
}

Revoke an access person's access

Endpoint

DELETE /access_persons/:access_person_id/accesses/:id

Request

Route

DELETE /access_persons/08b1456a-3b2c-4165-8bb3-8bb7101e3ff2/accesses/fae6a01f-048e-4702-a8c0-5db7013ecc65

Response

Status

204

Accounts

Get current account

Endpoint

GET /account

Request

Route

GET /account

Response

Status

200

Body

{
  "data": {
    "type": "account",
    "attributes": {
      "name": "Ashly Roberts II",
      "created_at": "2018-08-29T18:24:48Z",
      "updated_at": "2018-08-29T18:24:48Z",
      "default_guest_start_time": "16:00:00",
      "default_guest_end_time": "11:00:00",
      "rental_guest_time_override": false,
      "primary_owner_id": "7a740fb5-ab9e-402b-8061-46ebf459ea4e",
      "owner_role_id": "4da8e138-8b23-4321-9583-175116ab0348"
    },
    "id": "01200986-29d1-468f-9f9f-7abacd5895a1",
    "links": {
      "self": "http://api.lockstate.dev/account",
      "primary_owner": "http://api.lockstate.dev/user",
      "owner_role": "http://api.lockstate.dev/roles/4da8e138-8b23-4321-9583-175116ab0348"
    }
  }
}

Update current account

Endpoint

PUT /account

Parameters

Name Description
attributes[name] Account Name
attributes[default_guest_start_time] Default Access Guest start time, ISO 8601 24 hour time format, default: "11:00:00"
attributes[default_guest_end_time] Default Access Guest end time, ISO 8601 24 hour time format, default: "23:00:00"

Request

Route

PUT /account

Body

{
  "attributes": {
    "default_guest_start_time": "15:30:00",
    "default_guest_end_time": "02:15:00"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "account",
    "attributes": {
      "name": "Claudia Orn",
      "created_at": "2018-08-29T18:24:48Z",
      "updated_at": "2018-08-29T18:24:48Z",
      "default_guest_start_time": "15:30:00",
      "default_guest_end_time": "02:15:00",
      "rental_guest_time_override": false,
      "primary_owner_id": "9ed96c9b-9f0f-4f5b-bf4f-83d19ed46033",
      "owner_role_id": "5ce31a43-7dd2-415d-b94e-8c932095354e"
    },
    "id": "bed35dde-cb70-46ac-96b8-ecd78265de24",
    "links": {
      "self": "http://api.lockstate.dev/account",
      "primary_owner": "http://api.lockstate.dev/user",
      "owner_role": "http://api.lockstate.dev/roles/5ce31a43-7dd2-415d-b94e-8c932095354e"
    }
  }
}

ACS Doors

Get all ACS doors

Endpoint

GET /acs/doors

Parameters

Name Description
sort Sortable attributes: created_at and name, default: created_at ascending

Request

Route

GET /acs/doors

Response

Status

200

Body

{
  "data": [
    {
      "type": "acs_door",
      "attributes": {
        "name": "Tools",
        "state": "locked",
        "connected": true,
        "created_at": "2018-08-29T18:24:53Z",
        "updated_at": "2018-08-29T18:24:53Z",
        "location_id": "4cefb7a2-bc5b-482d-bd90-7d31b63dde78"
      },
      "id": "eb0cd9e5-39a7-4042-bd45-d1bd5ca18250",
      "links": {
        "self": "http://api.lockstate.dev/acs/doors/eb0cd9e5-39a7-4042-bd45-d1bd5ca18250",
        "location": "http://api.lockstate.dev/locations/4cefb7a2-bc5b-482d-bd90-7d31b63dde78"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 1
  }
}

Get ACS door

Endpoint

GET /acs/doors/:id

Request

Route

GET /acs/doors/f4f46286-0f3a-4c8e-bf3d-8be104861482

Response

Status

200

Body

{
  "data": {
    "type": "acs_door",
    "attributes": {
      "name": "Industrial",
      "state": "unlocked",
      "connected": false,
      "created_at": "2018-08-29T18:24:53Z",
      "updated_at": "2018-08-29T18:24:53Z",
      "location_id": "97fc663a-05f8-4d4f-81f6-4ff1849bbd5b"
    },
    "id": "f4f46286-0f3a-4c8e-bf3d-8be104861482",
    "links": {
      "self": "http://api.lockstate.dev/acs/doors/f4f46286-0f3a-4c8e-bf3d-8be104861482",
      "location": "http://api.lockstate.dev/locations/97fc663a-05f8-4d4f-81f6-4ff1849bbd5b"
    }
  }
}

Lock a door

Endpoint

PUT /acs/doors/:id/lock

Request

Route

PUT /acs/doors/738ef4dc-c02f-4c48-a82f-4f174249186c/lock

Response

Status

200

Body

{
  "data": {
    "type": "acs_door",
    "attributes": {
      "name": "Clothing, Tools & Shoes",
      "state": "locked",
      "connected": false,
      "created_at": "2018-08-29T18:24:54Z",
      "updated_at": "2018-08-29T18:24:54Z",
      "location_id": "cb628417-9dac-4e3f-aa31-036b7350a698"
    },
    "id": "738ef4dc-c02f-4c48-a82f-4f174249186c",
    "links": {
      "self": "http://api.lockstate.dev/acs/doors/738ef4dc-c02f-4c48-a82f-4f174249186c",
      "location": "http://api.lockstate.dev/locations/cb628417-9dac-4e3f-aa31-036b7350a698"
    }
  }
}

Unlock a door

Endpoint

PUT /acs/doors/:id/unlock

Request

Route

PUT /acs/doors/6a49245c-4c76-47b6-9f1e-f64838893347/unlock

Response

Status

200

Body

{
  "data": {
    "type": "acs_door",
    "attributes": {
      "name": "Baby, Electronics & Computers",
      "state": "unlocked",
      "connected": false,
      "created_at": "2018-08-29T18:24:54Z",
      "updated_at": "2018-08-29T18:24:54Z",
      "location_id": "900ede21-f20d-4b21-8f03-6bebe303ea4b"
    },
    "id": "6a49245c-4c76-47b6-9f1e-f64838893347",
    "links": {
      "self": "http://api.lockstate.dev/acs/doors/6a49245c-4c76-47b6-9f1e-f64838893347",
      "location": "http://api.lockstate.dev/locations/900ede21-f20d-4b21-8f03-6bebe303ea4b"
    }
  }
}

Temporary unlock a door

Endpoint

PUT /acs/doors/:id/temporary_unlock

Request

Route

PUT /acs/doors/71c5e909-12b9-4d03-b215-1d681a242729/temporary_unlock

Response

Status

200

Body

{
  "data": {
    "type": "acs_door",
    "attributes": {
      "name": "Sports, Outdoors & Grocery",
      "state": "unlocked",
      "connected": true,
      "created_at": "2018-08-29T18:24:54Z",
      "updated_at": "2018-08-29T18:24:54Z",
      "location_id": "4746906f-623e-4e23-b4f7-5eb026d10416"
    },
    "id": "71c5e909-12b9-4d03-b215-1d681a242729",
    "links": {
      "self": "http://api.lockstate.dev/acs/doors/71c5e909-12b9-4d03-b215-1d681a242729",
      "location": "http://api.lockstate.dev/locations/4746906f-623e-4e23-b4f7-5eb026d10416"
    }
  }
}

Access person accesses of an ACS door

Endpoint

GET /acs/doors/:id/access_person_accesses

Parameters

Name Description
attributes[access_person_type] Filter by type(s). Supported types: access_user and access_guest

Request

Route

GET /acs/doors/a345ea52-e00a-4692-99ba-2b6ae158b22b/access_person_accesses?attributes[access_person_type]=access_user

Query Parameters

attributes={"access_person_type"=>"access_user"}

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "location",
        "created_at": "2018-08-29T18:24:55Z",
        "updated_at": "2018-08-29T18:24:55Z",
        "access_person_id": "d3101d80-5232-460c-bbe7-9eca8ad1dc67",
        "access_person_type": "access_user",
        "accessible_id": "a605607f-a9ff-48e1-9e69-0298b690e618"
      },
      "id": "b59f3b65-7d6a-481f-a30b-f8321a9c1073",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/d3101d80-5232-460c-bbe7-9eca8ad1dc67/accesses/b59f3b65-7d6a-481f-a30b-f8321a9c1073",
        "access_person": "http://api.lockstate.dev/access_persons/d3101d80-5232-460c-bbe7-9eca8ad1dc67",
        "accessible": "http://api.lockstate.dev/locations/a605607f-a9ff-48e1-9e69-0298b690e618"
      }
    },
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "acs_door",
        "created_at": "2018-08-29T18:24:55Z",
        "updated_at": "2018-08-29T18:24:55Z",
        "access_person_id": "30f7fdda-97b1-4d55-83ca-68202e063a66",
        "access_person_type": "access_user",
        "accessible_id": "a345ea52-e00a-4692-99ba-2b6ae158b22b"
      },
      "id": "ebdd1fb7-be73-4595-84a8-36842192d7d2",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/30f7fdda-97b1-4d55-83ca-68202e063a66/accesses/ebdd1fb7-be73-4595-84a8-36842192d7d2",
        "access_person": "http://api.lockstate.dev/access_persons/30f7fdda-97b1-4d55-83ca-68202e063a66",
        "accessible": "http://api.lockstate.dev/acs/doors/a345ea52-e00a-4692-99ba-2b6ae158b22b"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Devices

Get all devices

Returns all device types (homogeneous).

Endpoint

GET /devices

Parameters

Name Description
sort Sortable attributes: created_at and name, default: created_at ascending
type Filter by type(s). Supported types: Lock, PowerPlug, Thermostat, ResortLock, and ACS::Door

Request

Route

GET /devices

Response

Status

200

Body

{
  "data": [
    {
      "type": "lock",
      "attributes": {
        "name": "LS-6i - AC000W005836254",
        "heartbeat_interval": 1200,
        "wifi_level": 0,
        "signal_quality": 3,
        "connected": true,
        "alive": true,
        "power_source": "alkaline_battery",
        "connected_at": "2018-08-29T18:22:17Z",
        "serial_number": "AC000W005836254",
        "wake_wifi": "user_action",
        "muted": false,
        "auto_lock": true,
        "auto_lock_timeout": 20,
        "programming_code": "123456",
        "state": "locked",
        "power_level": 4,
        "created_at": "2018-08-29T18:25:17Z",
        "updated_at": "2018-08-29T18:25:17Z",
        "default_guest_start_time": null,
        "default_guest_end_time": null,
        "local_pins": [
          "1234"
        ],
        "model_id": "b362ae85-f47d-43a9-baab-aac8813ee17b",
        "location_id": "48bd5117-59eb-42dd-a72b-f5a084d01068",
        "lock_action_schedule_id": "b66e136a-da10-43ca-bf1e-b0d8cfea64d9"
      },
      "id": "07339d7d-06b7-47be-89ab-543c5adb588a",
      "links": {
        "self": "http://api.lockstate.dev/devices/07339d7d-06b7-47be-89ab-543c5adb588a",
        "model": "http://api.lockstate.dev/models/b362ae85-f47d-43a9-baab-aac8813ee17b",
        "location": "http://api.lockstate.dev/locations/48bd5117-59eb-42dd-a72b-f5a084d01068",
        "lock_action_schedule": "http://api.lockstate.dev/schedules/b66e136a-da10-43ca-bf1e-b0d8cfea64d9"
      }
    },
    {
      "type": "thermostat",
      "attributes": {
        "name": "LS-60i - 001DC9A0Z06G",
        "heartbeat_interval": 1200,
        "wifi_level": 0,
        "signal_quality": 1,
        "connected": true,
        "alive": true,
        "power_source": "hardwire",
        "connected_at": "2018-08-29T18:22:17Z",
        "serial_number": "001DC9A0Z06G",
        "current_mode": "cool",
        "target_mode": "auto",
        "fan_mode": "auto",
        "hold": false,
        "temperature": 77.0,
        "target_temperature": 75.5,
        "unit": "F",
        "humidity": 45,
        "energy_saver": true,
        "scheduled_target_temperature": 80.0,
        "desired_target_temperature": 75.5,
        "created_at": "2018-08-29T18:25:17Z",
        "updated_at": "2018-08-29T18:25:17Z",
        "model_id": "8bca6dc1-99cd-4725-bf1d-54d0814d60c1",
        "location_id": "48bd5117-59eb-42dd-a72b-f5a084d01068",
        "thermostat_schedule_id": "c903135f-9c50-48f1-b4b0-6682e41c79aa"
      },
      "id": "407028a8-91b5-4d7e-ae6d-25f7c50aefc7",
      "links": {
        "self": "http://api.lockstate.dev/devices/407028a8-91b5-4d7e-ae6d-25f7c50aefc7",
        "model": "http://api.lockstate.dev/models/8bca6dc1-99cd-4725-bf1d-54d0814d60c1",
        "location": "http://api.lockstate.dev/locations/48bd5117-59eb-42dd-a72b-f5a084d01068",
        "thermostat_schedule": "http://api.lockstate.dev/schedules/c903135f-9c50-48f1-b4b0-6682e41c79aa"
      },
      "meta": {
        "restricted_actions": [
          "replace"
        ]
      }
    },
    {
      "type": "lock",
      "attributes": {
        "name": "LS-DB500i - 20F85E00GGO9",
        "heartbeat_interval": 1200,
        "wifi_level": 0,
        "signal_quality": 2,
        "connected": true,
        "alive": true,
        "power_source": "alkaline_battery",
        "connected_at": "2018-08-29T18:22:17Z",
        "serial_number": "20F85E00GGO9",
        "wake_wifi": "user_action",
        "muted": false,
        "auto_lock": true,
        "auto_lock_timeout": 20,
        "programming_code": "123456",
        "state": "locked",
        "power_level": 54,
        "created_at": "2018-08-29T18:25:17Z",
        "updated_at": "2018-08-29T18:25:17Z",
        "default_guest_start_time": null,
        "default_guest_end_time": null,
        "local_pins": [
          "1234"
        ],
        "model_id": "fde05b13-3a7f-4c2f-9047-5aea47d5f9f9",
        "location_id": "48bd5117-59eb-42dd-a72b-f5a084d01068"
      },
      "id": "81a7d378-a282-4915-92fd-b80cc9f9c76b",
      "links": {
        "self": "http://api.lockstate.dev/devices/81a7d378-a282-4915-92fd-b80cc9f9c76b",
        "model": "http://api.lockstate.dev/models/fde05b13-3a7f-4c2f-9047-5aea47d5f9f9",
        "location": "http://api.lockstate.dev/locations/48bd5117-59eb-42dd-a72b-f5a084d01068"
      },
      "meta": {
        "restricted_actions": [
          "replace"
        ]
      }
    },
    {
      "type": "resort_lock",
      "attributes": {
        "name": "RL-4000 - 91K6C7OO0B4FBE01",
        "default_guest_start_time": null,
        "default_guest_end_time": null,
        "created_at": "2018-08-29T18:25:17Z",
        "updated_at": "2018-08-29T18:25:17Z",
        "serial_number": "91K6C7OO0B4FBE01",
        "model_id": "ece1d239-2d93-4f97-8dbd-4b86a88f36f7",
        "location_id": "48bd5117-59eb-42dd-a72b-f5a084d01068"
      },
      "id": "c27d19d0-3cca-4f78-b026-53ffc5495b4a",
      "links": {
        "self": "http://api.lockstate.dev/devices/c27d19d0-3cca-4f78-b026-53ffc5495b4a",
        "model": "http://api.lockstate.dev/models/ece1d239-2d93-4f97-8dbd-4b86a88f36f7",
        "location": "http://api.lockstate.dev/locations/48bd5117-59eb-42dd-a72b-f5a084d01068"
      }
    },
    {
      "type": "power_plug",
      "attributes": {
        "name": "LS-P50i - 20F85EA4V74Q",
        "heartbeat_interval": 1200,
        "wifi_level": 0,
        "signal_quality": 0,
        "connected": true,
        "alive": true,
        "power_source": "hardwire",
        "connected_at": "2018-08-29T18:22:17Z",
        "serial_number": "20F85EA4V74Q",
        "on": true,
        "voltage": 120.0,
        "power": 4.5,
        "power_factor": 0.57,
        "current": 0.06,
        "frequency": 59.95,
        "total_power": 8.75,
        "occupied": true,
        "model_id": "d9c1fb87-749f-4cb2-96f1-0f81a92ff7bc",
        "location_id": "48bd5117-59eb-42dd-a72b-f5a084d01068",
        "power_plug_schedule_id": "1f9fefd1-26d2-47b2-9b7f-40d7fb9ded24"
      },
      "id": "f815e56a-ee36-4163-a5fd-e7ef6e93cc0a",
      "links": {
        "self": "http://api.lockstate.dev/devices/f815e56a-ee36-4163-a5fd-e7ef6e93cc0a",
        "model": "http://api.lockstate.dev/models/d9c1fb87-749f-4cb2-96f1-0f81a92ff7bc",
        "location": "http://api.lockstate.dev/locations/48bd5117-59eb-42dd-a72b-f5a084d01068",
        "power_plug_schedule": "http://api.lockstate.dev/schedules/1f9fefd1-26d2-47b2-9b7f-40d7fb9ded24"
      },
      "meta": {
        "restricted_actions": [
          "replace"
        ]
      }
    },
    {
      "type": "acs_door",
      "attributes": {
        "name": "Jewelry, Games & Movies",
        "state": "unlocked",
        "connected": true,
        "created_at": "2018-08-29T18:25:17Z",
        "updated_at": "2018-08-29T18:25:17Z",
        "location_id": "48bd5117-59eb-42dd-a72b-f5a084d01068"
      },
      "id": "b29d11ab-7435-4425-a758-3709bb7d4e86",
      "links": {
        "self": "http://api.lockstate.dev/acs/doors/b29d11ab-7435-4425-a758-3709bb7d4e86",
        "location": "http://api.lockstate.dev/locations/48bd5117-59eb-42dd-a72b-f5a084d01068"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 6
  }
}

Get a device

Endpoint

GET /devices/:id

Request

Route

GET /devices/bdd03ef5-1106-486f-a545-de06a6fb16b3

Response

Status

200

Body

{
  "data": {
    "type": "lock",
    "attributes": {
      "name": "LS-6i - AC000W003451858",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 3,
      "connected": false,
      "alive": true,
      "power_source": "alkaline_battery",
      "connected_at": "2018-08-29T18:23:21Z",
      "serial_number": "AC000W003451858",
      "wake_wifi": "user_action",
      "muted": false,
      "auto_lock": true,
      "auto_lock_timeout": 20,
      "programming_code": "123456",
      "state": "unlocked",
      "power_level": 7,
      "created_at": "2018-08-29T18:25:21Z",
      "updated_at": "2018-08-29T18:25:21Z",
      "default_guest_start_time": null,
      "default_guest_end_time": null,
      "local_pins": [
        "1234"
      ],
      "model_id": "95eeed33-c794-4d27-b69f-127ba1eaa850",
      "location_id": "aba65658-cac1-4c54-a16f-9665037df1c4",
      "lock_action_schedule_id": "c117ec29-dc76-4508-ab70-54e5868aa7fe"
    },
    "id": "bdd03ef5-1106-486f-a545-de06a6fb16b3",
    "links": {
      "self": "http://api.lockstate.dev/devices/bdd03ef5-1106-486f-a545-de06a6fb16b3",
      "model": "http://api.lockstate.dev/models/95eeed33-c794-4d27-b69f-127ba1eaa850",
      "location": "http://api.lockstate.dev/locations/aba65658-cac1-4c54-a16f-9665037df1c4",
      "lock_action_schedule": "http://api.lockstate.dev/schedules/c117ec29-dc76-4508-ab70-54e5868aa7fe"
    }
  }
}

Deregister a device

Endpoint

DELETE /devices/:id

Request

Route

DELETE /devices/c6ebdbd2-a3cf-478c-b7f0-a633c852b7e1

Response

Status

204

Register a LS-6i lock

Endpoint

POST /devices

Parameters

Name Description
attributes[name] required Name
attributes[serial_number] required Serial number
attributes[model_id] required Model
attributes[location_id] required Location

Request

Route

POST /devices

Body

{
  "attributes": {
    "name": "Home Lock",
    "location_id": "5efd30a7-1480-4d83-8736-2b1d582ffc4a",
    "serial_number": "AC000W000213429",
    "model_id": "30382aaf-56b2-4e37-bcab-447b0cb2647c"
  }
}

Response

Response Fields

Name Description
heartbeat_interval Number of seconds between connections.
connected Is the device connected at this moment?
alive Is the device "heartbeating" regularly?
signal_quality Wi-Fi signal quality, values 0 to 4
power_level Battery power level (percentage)
wake_wifi When the lock is synced with the cloud.
auto_lock Automatically lock after an unlock event.
auto_lock_timeout Number of seconds before relocking.
connected_at Time of last successful connection.

Status

201

Body

{
  "data": {
    "type": "lock",
    "attributes": {
      "name": "Home Lock",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 2,
      "connected": true,
      "alive": true,
      "power_source": "alkaline_battery",
      "connected_at": "2018-08-29T18:21:33Z",
      "serial_number": "AC000W000213429",
      "wake_wifi": "user_action",
      "muted": false,
      "auto_lock": true,
      "auto_lock_timeout": 20,
      "programming_code": "123456",
      "state": "unlocked",
      "power_level": 57,
      "created_at": "2018-08-29T18:25:33Z",
      "updated_at": "2018-08-29T18:25:33Z",
      "default_guest_start_time": null,
      "default_guest_end_time": null,
      "local_pins": [
        "1234"
      ],
      "model_id": "30382aaf-56b2-4e37-bcab-447b0cb2647c",
      "location_id": "5efd30a7-1480-4d83-8736-2b1d582ffc4a"
    },
    "id": "fd6b3115-82f8-4943-9e4b-899e03c9cbd7",
    "links": {
      "self": "http://api.lockstate.dev/devices/fd6b3115-82f8-4943-9e4b-899e03c9cbd7",
      "model": "http://api.lockstate.dev/models/30382aaf-56b2-4e37-bcab-447b0cb2647c",
      "location": "http://api.lockstate.dev/locations/5efd30a7-1480-4d83-8736-2b1d582ffc4a"
    }
  }
}

Register a LS-DB500i lock

Endpoint

POST /devices

Parameters

Name Description
attributes[name] required Name
attributes[serial_number] required Serial number
attributes[model_id] required Model
attributes[location_id] required Location

Request

Route

POST /devices

Body

{
  "attributes": {
    "name": "Home Lock",
    "location_id": "96a94fc0-05f2-4295-a418-d8ecf3f998a3",
    "serial_number": "20F85E0008F2",
    "model_id": "276addef-7e74-4dfc-a842-e49f75a51a66",
    "programming_code": "12345678"
  }
}

Response

Response Fields

Name Description
heartbeat_interval Number of seconds between connections.
connected Is the device connected at this moment?
alive Is the device "heartbeating" regularly?
signal_quality Wi-Fi signal quality, values 0 to 4
power_level Battery power level (percentage)
wake_wifi When the lock is synced with the cloud.
auto_lock Automatically lock after an unlock event.
auto_lock_timeout Number of seconds before relocking.
connected_at Time of last successful connection.

Status

201

Body

{
  "data": {
    "type": "lock",
    "attributes": {
      "name": "Home Lock",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 4,
      "connected": false,
      "alive": true,
      "power_source": "alkaline_battery",
      "connected_at": "2018-08-29T18:23:33Z",
      "serial_number": "20F85E0008F2",
      "wake_wifi": "user_action",
      "muted": false,
      "auto_lock": true,
      "auto_lock_timeout": 20,
      "programming_code": "123456",
      "state": "unlocked",
      "power_level": 89,
      "created_at": "2018-08-29T18:25:33Z",
      "updated_at": "2018-08-29T18:25:33Z",
      "default_guest_start_time": null,
      "default_guest_end_time": null,
      "local_pins": [
        "1234"
      ],
      "model_id": "276addef-7e74-4dfc-a842-e49f75a51a66",
      "location_id": "96a94fc0-05f2-4295-a418-d8ecf3f998a3"
    },
    "id": "6ffffc96-9d9d-4609-88d9-d6ac18574341",
    "links": {
      "self": "http://api.lockstate.dev/devices/6ffffc96-9d9d-4609-88d9-d6ac18574341",
      "model": "http://api.lockstate.dev/models/276addef-7e74-4dfc-a842-e49f75a51a66",
      "location": "http://api.lockstate.dev/locations/96a94fc0-05f2-4295-a418-d8ecf3f998a3"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Update a lock

Your settings changes might be lost if you make this request before the lock wakes up for the first time - which means you should wait until connected_at has a timestamp before making this request. This is because we request the current lock settings whenever it’s registered.

Endpoint

PUT /devices/:id

Parameters

Name Description
attributes[name] Name
attributes[serial_number] Device serial number
attributes[programming_code] Programming code
attributes[heartbeat_interval] Heartbeat interval
attributes[wake_wifi] Controls what events cause the lock to sync with the cloud. Can be `user_action` or `heartbeat_interval`. Additionally, model LS-5i supports `user_action_except_manual`, which excludes interaction with the knob.
attributes[muted] Muted
attributes[auto_lock] Auto-lock
attributes[auto_lock_timeout] Auto-lock timeout
attributes[auto_lock_schedule_id] Auto-lock Schedule
attributes[lock_action_schedule_id] Lock Action Schedule
attributes[location_id] Location
attributes[default_guest_start_time] Default Access Guest start time, ISO 8601 24 hour time format
attributes[default_guest_end_time] Default Access Guest end time, ISO 8601 24 hour time format
attributes[power_source] One of `hardwire`, `alkaline_battery`, or `lithium_battery`. This affects the battery level percentage as well as "low battery" notifications.
attributes[local_pins] Array of PINs programmed via the device keypad. This is a "set" operation. Only PIN removal is supported.

Request

Route

PUT /devices/f00c6368-0d7f-4a13-bbea-0d2752ec80ab

Body

{
  "attributes": {
    "name": "Backdoor Lock",
    "location_id": "e114a824-c9f4-483b-a7e5-2d21fce52d46",
    "default_guest_start_time": "11:15:00",
    "power_source": "alkaline_battery",
    "local_pins": [
      "1234"
    ]
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "lock",
    "attributes": {
      "name": "Backdoor Lock",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 1,
      "connected": true,
      "alive": true,
      "power_source": "alkaline_battery",
      "connected_at": "2018-08-29T18:20:34Z",
      "serial_number": "AC000W003861007",
      "wake_wifi": "user_action",
      "muted": false,
      "auto_lock": true,
      "auto_lock_timeout": 20,
      "programming_code": "123456",
      "state": "unlocked",
      "power_level": 39,
      "created_at": "2018-08-29T18:25:34Z",
      "updated_at": "2018-08-29T18:25:34Z",
      "default_guest_start_time": "11:15:00",
      "default_guest_end_time": null,
      "local_pins": [
        "1234"
      ],
      "model_id": "5c470654-eee4-4d5a-bc0a-6a1020c319fd",
      "location_id": "e114a824-c9f4-483b-a7e5-2d21fce52d46"
    },
    "id": "f00c6368-0d7f-4a13-bbea-0d2752ec80ab",
    "links": {
      "self": "http://api.lockstate.dev/devices/f00c6368-0d7f-4a13-bbea-0d2752ec80ab",
      "model": "http://api.lockstate.dev/models/5c470654-eee4-4d5a-bc0a-6a1020c319fd",
      "location": "http://api.lockstate.dev/locations/e114a824-c9f4-483b-a7e5-2d21fce52d46"
    }
  }
}

Lock a lock

Endpoint

PUT /devices/:id/lock

Request

Route

PUT /devices/10d8ecee-0573-430f-ba09-0031b7a46306/lock

Response

Status

200

Body

{
  "data": {
    "type": "lock",
    "attributes": {
      "name": "LS-6i - AC000W004299664",
      "heartbeat_interval": 0,
      "wifi_level": 0,
      "signal_quality": 0,
      "connected": false,
      "alive": false,
      "power_source": "hardwire",
      "connected_at": null,
      "serial_number": "AC000W004299664",
      "wake_wifi": "user_action",
      "muted": false,
      "auto_lock": true,
      "auto_lock_timeout": 0,
      "programming_code": null,
      "state": "locked",
      "power_level": 0,
      "created_at": "2018-08-29T18:25:35Z",
      "updated_at": "2018-08-29T18:25:35Z",
      "default_guest_start_time": null,
      "default_guest_end_time": null,
      "local_pins": null,
      "model_id": "d02628fe-8b31-4a98-8c33-f752b6458bdc",
      "location_id": "f130fe7a-a897-4cc1-9247-cd40cce55c04"
    },
    "id": "10d8ecee-0573-430f-ba09-0031b7a46306",
    "links": {
      "self": "http://api.lockstate.dev/devices/10d8ecee-0573-430f-ba09-0031b7a46306",
      "model": "http://api.lockstate.dev/models/d02628fe-8b31-4a98-8c33-f752b6458bdc",
      "location": "http://api.lockstate.dev/locations/f130fe7a-a897-4cc1-9247-cd40cce55c04"
    }
  }
}

Unlock a lock

Endpoint

PUT /devices/:id/unlock

Request

Route

PUT /devices/c3a27919-383f-4160-b2f9-fbc34d3a018b/unlock

Response

Status

200

Body

{
  "data": {
    "type": "lock",
    "attributes": {
      "name": "LS-6i - AC000W004223581",
      "heartbeat_interval": 0,
      "wifi_level": 0,
      "signal_quality": 0,
      "connected": false,
      "alive": false,
      "power_source": "hardwire",
      "connected_at": null,
      "serial_number": "AC000W004223581",
      "wake_wifi": "user_action",
      "muted": false,
      "auto_lock": true,
      "auto_lock_timeout": 0,
      "programming_code": null,
      "state": "unlocked",
      "power_level": 0,
      "created_at": "2018-08-29T18:25:35Z",
      "updated_at": "2018-08-29T18:25:35Z",
      "default_guest_start_time": null,
      "default_guest_end_time": null,
      "local_pins": null,
      "model_id": "443d661b-0572-4bef-9d06-62541f160a5e",
      "location_id": "906a9ff8-cf0d-4881-bbf6-7098f9d8fc8a"
    },
    "id": "c3a27919-383f-4160-b2f9-fbc34d3a018b",
    "links": {
      "self": "http://api.lockstate.dev/devices/c3a27919-383f-4160-b2f9-fbc34d3a018b",
      "model": "http://api.lockstate.dev/models/443d661b-0572-4bef-9d06-62541f160a5e",
      "location": "http://api.lockstate.dev/locations/906a9ff8-cf0d-4881-bbf6-7098f9d8fc8a"
    }
  }
}

Access person accesses of a lock

Endpoint

GET /devices/:id/access_person_accesses

Parameters

Name Description
attributes[access_person_type] Filter by type(s). Supported types: access_user and access_guest

Request

Route

GET /devices/b077b474-a63c-4afd-a42e-aba277e2414e/access_person_accesses?attributes[access_person_type]=access_user

Query Parameters

attributes={"access_person_type"=>"access_user"}

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "location",
        "created_at": "2018-08-29T18:25:36Z",
        "updated_at": "2018-08-29T18:25:36Z",
        "access_person_id": "e266f438-2b51-4a62-8db3-b53e6416b5b2",
        "access_person_type": "access_user",
        "accessible_id": "628cfe3f-c424-470b-ad6d-2c7ddc6e9442"
      },
      "id": "08401632-2c03-4026-8ef5-ac2ed29e721f",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/e266f438-2b51-4a62-8db3-b53e6416b5b2/accesses/08401632-2c03-4026-8ef5-ac2ed29e721f",
        "access_person": "http://api.lockstate.dev/access_persons/e266f438-2b51-4a62-8db3-b53e6416b5b2",
        "accessible": "http://api.lockstate.dev/locations/628cfe3f-c424-470b-ad6d-2c7ddc6e9442"
      }
    },
    {
      "type": "access_person_access",
      "attributes": {
        "guest_start_time": null,
        "guest_end_time": null,
        "devices_count": 0,
        "devices_synced_count": 0,
        "devices_pending_sync_count": 0,
        "devices_failed_sync_count": 0,
        "accessible_type": "lock",
        "created_at": "2018-08-29T18:25:36Z",
        "updated_at": "2018-08-29T18:25:36Z",
        "access_person_id": "b8288b92-65e4-4569-8011-e363e8fcdc08",
        "access_person_type": "access_user",
        "accessible_id": "b077b474-a63c-4afd-a42e-aba277e2414e"
      },
      "id": "dbdd9425-c79f-4a39-aa62-127016177d61",
      "links": {
        "self": "http://api.lockstate.dev/access_persons/b8288b92-65e4-4569-8011-e363e8fcdc08/accesses/dbdd9425-c79f-4a39-aa62-127016177d61",
        "access_person": "http://api.lockstate.dev/access_persons/b8288b92-65e4-4569-8011-e363e8fcdc08",
        "accessible": "http://api.lockstate.dev/devices/b077b474-a63c-4afd-a42e-aba277e2414e"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Register an LS-P100mi power_plug

Endpoint

POST /devices

Parameters

Name Description
attributes[name] required Name
attributes[serial_number] required Device serial number
attributes[model_id] required Device model
attributes[location_id] required Location
attributes[heartbeat_interval] Heartbeat interval
attributes[power_plug_schedule_id] PowerPlug Schedule

Request

Route

POST /devices

Body

{
  "attributes": {
    "name": "Test PowerPlug",
    "location_id": "86d628dc-f9e6-488c-88a1-e99c86fa96d7",
    "serial_number": "20F859198358",
    "model_id": "b45e89d0-6bae-43dd-bf6a-1fd2686918a5"
  }
}

Response

Response Fields

Name Description
heartbeat_interval Number of seconds between connections.
connected Is the device connected at this moment?
alive Is the device "heartbeating" regularly?
signal_quality Wi-Fi signal quality, values 0 to 4
current Measurement of Current
frequency Measurement of Frequency
occupied Has the (optional) motion sensor detected motion?
on Is the power currently toggled ON?
power Measurement of Power
power_factor Measurement of Power Factor
total_power Measurement of Total Power
voltage Measurement of Voltage
connected_at Time of last successful connection.

Status

201

Body

{
  "data": {
    "type": "power_plug",
    "attributes": {
      "name": "Test PowerPlug",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 1,
      "connected": false,
      "alive": true,
      "power_source": "hardwire",
      "connected_at": "2018-08-29T18:20:47Z",
      "serial_number": "20F859198358",
      "on": true,
      "voltage": 120.0,
      "power": 4.5,
      "power_factor": 0.57,
      "current": 0.06,
      "frequency": 59.95,
      "total_power": 8.75,
      "occupied": true,
      "model_id": "b45e89d0-6bae-43dd-bf6a-1fd2686918a5",
      "location_id": "86d628dc-f9e6-488c-88a1-e99c86fa96d7"
    },
    "id": "1a04ab97-14b3-4310-a19b-570d319b16aa",
    "links": {
      "self": "http://api.lockstate.dev/devices/1a04ab97-14b3-4310-a19b-570d319b16aa",
      "model": "http://api.lockstate.dev/models/b45e89d0-6bae-43dd-bf6a-1fd2686918a5",
      "location": "http://api.lockstate.dev/locations/86d628dc-f9e6-488c-88a1-e99c86fa96d7"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Update a PowerPlug

Endpoint

PUT /devices/:id

Parameters

Name Description
attributes[name] Name
attributes[location_id] Location
attributes[heartbeat_interval] Heartbeat interval
attributes[power_plug_schedule_id] PowerPlug Schedule

Request

Route

PUT /devices/70a12ff7-40a1-4301-a765-bad952335da9

Body

{
  "attributes": {
    "name": "Another Test PowerPlug"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "power_plug",
    "attributes": {
      "name": "Another Test PowerPlug",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 4,
      "connected": true,
      "alive": true,
      "power_source": "hardwire",
      "connected_at": "2018-08-29T18:20:48Z",
      "serial_number": "20F85EATCP3C",
      "on": true,
      "voltage": 120.0,
      "power": 4.5,
      "power_factor": 0.57,
      "current": 0.06,
      "frequency": 59.95,
      "total_power": 8.75,
      "occupied": true,
      "model_id": "10c88b45-a2c1-4daa-9251-3f34750b58bd",
      "location_id": "6bd9f71d-88fd-40c7-ad6d-3969ac0c2baa",
      "power_plug_schedule_id": "ea3c2d2b-ad84-4833-a0e1-bde5447836dc"
    },
    "id": "70a12ff7-40a1-4301-a765-bad952335da9",
    "links": {
      "self": "http://api.lockstate.dev/devices/70a12ff7-40a1-4301-a765-bad952335da9",
      "model": "http://api.lockstate.dev/models/10c88b45-a2c1-4daa-9251-3f34750b58bd",
      "location": "http://api.lockstate.dev/locations/6bd9f71d-88fd-40c7-ad6d-3969ac0c2baa",
      "power_plug_schedule": "http://api.lockstate.dev/schedules/ea3c2d2b-ad84-4833-a0e1-bde5447836dc"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Power On a PowerPlug

Endpoint

PUT /devices/:id/power_on

Request

Route

PUT /devices/b0f3c355-6593-42df-b38a-f1c21e98d19f/power_on

Response

Status

200

Body

{
  "data": {
    "type": "power_plug",
    "attributes": {
      "name": "LS-P50i - 20F85EAC484C",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 4,
      "connected": true,
      "alive": true,
      "power_source": "hardwire",
      "connected_at": "2018-08-29T18:20:48Z",
      "serial_number": "20F85EAC484C",
      "on": true,
      "voltage": 120.0,
      "power": 4.5,
      "power_factor": 0.57,
      "current": 0.06,
      "frequency": 59.95,
      "total_power": 8.75,
      "occupied": true,
      "model_id": "4c7a4133-2cca-428c-8a24-4d7402a5f6f7",
      "location_id": "ebdb3bc6-b272-4529-8c22-b5f51daf18f0",
      "power_plug_schedule_id": "8e5ab7c5-c925-429b-a790-f6cc0b1f2ea9"
    },
    "id": "b0f3c355-6593-42df-b38a-f1c21e98d19f",
    "links": {
      "self": "http://api.lockstate.dev/devices/b0f3c355-6593-42df-b38a-f1c21e98d19f",
      "model": "http://api.lockstate.dev/models/4c7a4133-2cca-428c-8a24-4d7402a5f6f7",
      "location": "http://api.lockstate.dev/locations/ebdb3bc6-b272-4529-8c22-b5f51daf18f0",
      "power_plug_schedule": "http://api.lockstate.dev/schedules/8e5ab7c5-c925-429b-a790-f6cc0b1f2ea9"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Power Off a PowerPlug

Endpoint

PUT /devices/:id/power_off

Request

Route

PUT /devices/07b6b4e8-8576-4038-b1c9-a93133c0ec6f/power_off

Response

Status

200

Body

{
  "data": {
    "type": "power_plug",
    "attributes": {
      "name": "LS-P50i - 20F85EAVQTNK",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 3,
      "connected": true,
      "alive": true,
      "power_source": "hardwire",
      "connected_at": "2018-08-29T18:20:48Z",
      "serial_number": "20F85EAVQTNK",
      "on": true,
      "voltage": 120.0,
      "power": 4.5,
      "power_factor": 0.57,
      "current": 0.06,
      "frequency": 59.95,
      "total_power": 8.75,
      "occupied": true,
      "model_id": "27225b0b-23d4-4a47-a462-35ca3e9a01d4",
      "location_id": "71b13606-a59b-4da8-885f-b03b1e3aae50",
      "power_plug_schedule_id": "2b11df75-32fe-40dd-9cf9-b68ee085b91f"
    },
    "id": "07b6b4e8-8576-4038-b1c9-a93133c0ec6f",
    "links": {
      "self": "http://api.lockstate.dev/devices/07b6b4e8-8576-4038-b1c9-a93133c0ec6f",
      "model": "http://api.lockstate.dev/models/27225b0b-23d4-4a47-a462-35ca3e9a01d4",
      "location": "http://api.lockstate.dev/locations/71b13606-a59b-4da8-885f-b03b1e3aae50",
      "power_plug_schedule": "http://api.lockstate.dev/schedules/2b11df75-32fe-40dd-9cf9-b68ee085b91f"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Register a ResortLock

Endpoint

POST /devices

Parameters

Name Description
attributes[name] required Name
attributes[serial_number] required Device serial number
attributes[model_id] required Model
attributes[location_id] required Location
attributes[default_guest_start_time] Default Access Guest start time, ISO 8601 24 hour time format
attributes[default_guest_end_time] Default Access Guest end time, ISO 8601 24 hour time format

Request

Route

POST /devices

Body

{
  "attributes": {
    "name": "My Resort Lock",
    "serial_number": "AB57EF010F4FBE01",
    "model_id": "6c5b9d41-5eac-484a-af29-7f4bf6d6f401",
    "location_id": "2db3bb4e-cab9-4fff-9087-b2870348f82d",
    "default_guest_start_time": "11:30:00",
    "default_guest_end_time": "14:15:00"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "resort_lock",
    "attributes": {
      "name": "My Resort Lock",
      "default_guest_start_time": "11:30:00",
      "default_guest_end_time": "14:15:00",
      "created_at": "2018-08-29T18:26:01Z",
      "updated_at": "2018-08-29T18:26:01Z",
      "serial_number": "AB57EF010F4FBE01",
      "model_id": "6c5b9d41-5eac-484a-af29-7f4bf6d6f401",
      "location_id": "2db3bb4e-cab9-4fff-9087-b2870348f82d"
    },
    "id": "72086d3a-b1c0-4c64-9944-108503a6fed3",
    "links": {
      "self": "http://api.lockstate.dev/devices/72086d3a-b1c0-4c64-9944-108503a6fed3",
      "model": "http://api.lockstate.dev/models/6c5b9d41-5eac-484a-af29-7f4bf6d6f401",
      "location": "http://api.lockstate.dev/locations/2db3bb4e-cab9-4fff-9087-b2870348f82d"
    }
  }
}

Update a ResortLock

Endpoint

PUT /devices/:id

Parameters

Name Description
attributes[name] Name
attributes[location_id] Location
attributes[serial_number] Device serial number
attributes[default_guest_start_time] Default Access Guest start time, ISO 8601 24 hour time format
attributes[default_guest_end_time] Default Access Guest end time, ISO 8601 24 hour time format

Request

Route

PUT /devices/6132aa50-ba5e-431f-b2af-0da361a4c31e

Body

{
  "attributes": {
    "name": "Backdoor Resort Lock",
    "default_guest_start_time": "10:00:00"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "resort_lock",
    "attributes": {
      "name": "Backdoor Resort Lock",
      "default_guest_start_time": "10:00:00",
      "default_guest_end_time": null,
      "created_at": "2018-08-29T18:26:01Z",
      "updated_at": "2018-08-29T18:26:01Z",
      "serial_number": "6BZP29JC0B4FBE01",
      "model_id": "0bebccc1-d841-454b-b50c-52c57ed940a1",
      "location_id": "4783feb9-6c02-43a5-9dbe-31983c1ab6d7"
    },
    "id": "6132aa50-ba5e-431f-b2af-0da361a4c31e",
    "links": {
      "self": "http://api.lockstate.dev/devices/6132aa50-ba5e-431f-b2af-0da361a4c31e",
      "model": "http://api.lockstate.dev/models/0bebccc1-d841-454b-b50c-52c57ed940a1",
      "location": "http://api.lockstate.dev/locations/4783feb9-6c02-43a5-9dbe-31983c1ab6d7"
    }
  }
}

Register an LS-90i Thermostat

Endpoint

POST /devices

Parameters

Name Description
attributes[name] required Name
attributes[serial_number] required Device serial number
attributes[model_id] required Device model
attributes[location_id] required Location
attributes[heartbeat_interval] Heartbeat interval
attributes[thermostat_schedule_id] Thermostat Schedule

Request

Route

POST /devices

Body

{
  "attributes": {
    "name": "Test Thermostat",
    "location_id": "0928d491-705c-41d9-891e-5581aa4d7c97",
    "serial_number": "20F85E129479",
    "model_id": "c3ec9559-ff8b-4365-aac9-75bdfae60b15"
  }
}

Response

Response Fields

Name Description
heartbeat_interval Number of seconds between connections.
connected Is the device connected at this moment?
alive Is the device "heartbeating" regularly?
signal_quality Wi-Fi signal quality, values 0 to 4
power_level Battery power level (percentage), if using batteries
current_mode Current operating mode (heating or cooling)
energy_saver Is the thermostat in Energy Saver mode?
fan_mode Current fan mode
hold Is the thermostat in Hold mode?
humidity Current humidity value (percentage)
temperature Current temperature value
target_mode Desired mode (heating or cooling)
target_temperature Desired temperature
connected_at Time of last successful connection.

Status

201

Body

{
  "data": {
    "type": "thermostat",
    "attributes": {
      "name": "Test Thermostat",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 1,
      "connected": true,
      "alive": true,
      "power_source": "hardwire",
      "connected_at": "2018-08-29T18:24:26Z",
      "serial_number": "20F85E129479",
      "current_mode": "cool",
      "target_mode": "auto",
      "fan_mode": "auto",
      "hold": false,
      "temperature": 77.0,
      "target_temperature": 75.5,
      "unit": "F",
      "humidity": 45,
      "energy_saver": true,
      "scheduled_target_temperature": 80.0,
      "desired_target_temperature": 75.5,
      "created_at": "2018-08-29T18:26:26Z",
      "updated_at": "2018-08-29T18:26:26Z",
      "model_id": "c3ec9559-ff8b-4365-aac9-75bdfae60b15",
      "location_id": "0928d491-705c-41d9-891e-5581aa4d7c97"
    },
    "id": "182fa4d9-0c57-4384-983b-14bd2eff7ad6",
    "links": {
      "self": "http://api.lockstate.dev/devices/182fa4d9-0c57-4384-983b-14bd2eff7ad6",
      "model": "http://api.lockstate.dev/models/c3ec9559-ff8b-4365-aac9-75bdfae60b15",
      "location": "http://api.lockstate.dev/locations/0928d491-705c-41d9-891e-5581aa4d7c97"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Update a Thermostat

Endpoint

PUT /devices/:id

Parameters

Name Description Values
attributes[name] Name
attributes[location_id] Location
attributes[heartbeat_interval] Heartbeat interval
attributes[thermostat_schedule_id] Thermostat Schedule
attributes[target_temperature] Desired temperature
attributes[target_mode] Set desired operation mode "heat", "cool", "auto", "off"
attributes[fan_mode] Set Fan mode "auto", "auto_circulate", "on", "off"
attributes[hold] Set Hold mode true, false
attributes[energy_saver] Set Energy Saver mode true, false

Request

Route

PUT /devices/e8edf568-0e1d-4930-9328-9016f23f42c9

Body

{
  "attributes": {
    "name": "Another Test Thermostat"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "thermostat",
    "attributes": {
      "name": "Another Test Thermostat",
      "heartbeat_interval": 1200,
      "wifi_level": 0,
      "signal_quality": 0,
      "connected": false,
      "alive": true,
      "power_source": "hardwire",
      "connected_at": "2018-08-29T18:22:27Z",
      "serial_number": "001DC9A0SX44",
      "current_mode": "cool",
      "target_mode": "auto",
      "fan_mode": "auto",
      "hold": false,
      "temperature": 77.0,
      "target_temperature": 75.5,
      "unit": "F",
      "humidity": 45,
      "energy_saver": true,
      "scheduled_target_temperature": 80.0,
      "desired_target_temperature": 75.5,
      "created_at": "2018-08-29T18:26:27Z",
      "updated_at": "2018-08-29T18:26:27Z",
      "model_id": "b237391c-33aa-4e52-80a8-659ddd71910f",
      "location_id": "10ec5912-dde1-4364-a33f-02df578f624e",
      "thermostat_schedule_id": "d8edf826-9dbd-406a-80ee-fca1fbfb25bc"
    },
    "id": "e8edf568-0e1d-4930-9328-9016f23f42c9",
    "links": {
      "self": "http://api.lockstate.dev/devices/e8edf568-0e1d-4930-9328-9016f23f42c9",
      "model": "http://api.lockstate.dev/models/b237391c-33aa-4e52-80a8-659ddd71910f",
      "location": "http://api.lockstate.dev/locations/10ec5912-dde1-4364-a33f-02df578f624e",
      "thermostat_schedule": "http://api.lockstate.dev/schedules/d8edf826-9dbd-406a-80ee-fca1fbfb25bc"
    },
    "meta": {
      "restricted_actions": [
        "replace"
      ]
    }
  }
}

Events

Get all events

Endpoint

GET /events

Parameters

Name Description
sort Sortable attributes: created_at and occurred_at, default: occurred_at descending

Request

Route

GET /events

Response

Response Fields

Name Description
type unlocked, locked, access_denied, access_person_synced, access_person_sync_failed, access_guest_late_sync, reset, connectivity, power_level_low, battery_replaced, acs_door_opened, acs_door_closed, acs_door_held_open, acs_requested_to_exit, temperature_changed, humidity_changed, relay_enabled, relay_disabled or access_person_used
source user, network or device
status succeeded and failed
associated_resource_name If associated_resource is deleted, this field is populated with associated_resource name

Status

200

Body

{
  "data": [
    {
      "type": "access_person_used_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-28T21:36:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "associated_resource_name": null,
        "status_info": null,
        "method": null,
        "card": null,
        "pin": null,
        "smart_card_serial_number": null,
        "publisher_id": "ce59ad9a-634d-4aad-bf71-a35c107b1315",
        "publisher_type": "access_user",
        "associated_resource_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "associated_resource_type": "lock"
      },
      "id": "2c50a9f8-a094-4045-a8e1-b2cc6a6f3b40",
      "links": {
        "self": "http://api.lockstate.dev/events/2c50a9f8-a094-4045-a8e1-b2cc6a6f3b40",
        "publisher": "http://api.lockstate.dev/access_persons/ce59ad9a-634d-4aad-bf71-a35c107b1315",
        "associated_resource": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2"
      }
    },
    {
      "type": "power_level_low_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-28T11:18:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "power_level": 5,
        "publisher_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "publisher_type": "lock"
      },
      "id": "ae7ca189-c819-42f7-85fe-a5a7673e7c04",
      "links": {
        "self": "http://api.lockstate.dev/events/ae7ca189-c819-42f7-85fe-a5a7673e7c04",
        "publisher": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2"
      }
    },
    {
      "type": "access_person_used_event",
      "attributes": {
        "source": "user",
        "status": "failed",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-28T09:23:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "associated_resource_name": null,
        "status_info": null,
        "method": null,
        "card": null,
        "pin": null,
        "smart_card_serial_number": null,
        "publisher_id": "46ae9492-6638-4717-b78a-d0cd5548ca81",
        "publisher_type": "access_guest",
        "associated_resource_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "associated_resource_type": "lock"
      },
      "id": "9c03ac79-8202-456d-87ca-eb295b9d65f1",
      "links": {
        "self": "http://api.lockstate.dev/events/9c03ac79-8202-456d-87ca-eb295b9d65f1",
        "publisher": "http://api.lockstate.dev/access_persons/46ae9492-6638-4717-b78a-d0cd5548ca81",
        "associated_resource": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2"
      }
    },
    {
      "type": "access_guest_late_sync_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-27T20:15:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "associated_resource_name": null,
        "publisher_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "publisher_type": "lock",
        "associated_resource_id": "21cd5308-106e-4192-983a-e17aeb0409b2",
        "associated_resource_type": "access_guest"
      },
      "id": "b503ca18-6ff6-4bb4-b41b-3ac862054178",
      "links": {
        "self": "http://api.lockstate.dev/events/b503ca18-6ff6-4bb4-b41b-3ac862054178",
        "publisher": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2",
        "associated_resource": "http://api.lockstate.dev/access_persons/21cd5308-106e-4192-983a-e17aeb0409b2"
      }
    },
    {
      "type": "access_person_sync_failed_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-26T19:54:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "associated_resource_name": null,
        "status_info": "timeout",
        "publisher_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "publisher_type": "lock",
        "associated_resource_id": "15c5a514-8e94-4509-8bfa-b977fd5edf15",
        "associated_resource_type": "access_user"
      },
      "id": "90815128-cd2c-4f4c-bcea-765d576957e2",
      "links": {
        "self": "http://api.lockstate.dev/events/90815128-cd2c-4f4c-bcea-765d576957e2",
        "publisher": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2",
        "associated_resource": "http://api.lockstate.dev/access_persons/15c5a514-8e94-4509-8bfa-b977fd5edf15"
      }
    },
    {
      "type": "unlocked_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-26T07:51:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "associated_resource_name": null,
        "status_info": null,
        "method": "pin",
        "card": null,
        "pin": "1234",
        "smart_card_serial_number": null,
        "publisher_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "publisher_type": "lock",
        "associated_resource_id": "641189e8-9a9b-46bd-90de-eb88e300afc2",
        "associated_resource_type": "access_user"
      },
      "id": "66101728-a550-45a4-b8c4-47644d60fed1",
      "links": {
        "self": "http://api.lockstate.dev/events/66101728-a550-45a4-b8c4-47644d60fed1",
        "publisher": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2",
        "associated_resource": "http://api.lockstate.dev/access_persons/641189e8-9a9b-46bd-90de-eb88e300afc2"
      }
    },
    {
      "type": "access_person_synced_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-23T08:20:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "associated_resource_name": null,
        "publisher_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "publisher_type": "lock",
        "associated_resource_id": "339c3ec8-011f-45c2-b381-a70ca2e93b78",
        "associated_resource_type": "access_user"
      },
      "id": "a66014b2-14a5-4848-979e-30edd17eb7fa",
      "links": {
        "self": "http://api.lockstate.dev/events/a66014b2-14a5-4848-979e-30edd17eb7fa",
        "publisher": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2",
        "associated_resource": "http://api.lockstate.dev/access_persons/339c3ec8-011f-45c2-b381-a70ca2e93b78"
      }
    },
    {
      "type": "connectivity_event",
      "attributes": {
        "source": "user",
        "status": "succeeded",
        "time_zone": "America/Denver",
        "occurred_at": "2018-08-22T22:47:22Z",
        "created_at": "2018-08-29T18:25:22Z",
        "updated_at": "2018-08-29T18:25:22Z",
        "connected_at": "2018-08-24T07:23:22Z",
        "publisher_id": "ae05997a-bf33-436a-b033-0102c986adb2",
        "publisher_type": "lock"
      },
      "id": "a8184c9f-3bf2-4e6b-bc3e-919820a9bc0f",
      "links": {
        "self": "http://api.lockstate.dev/events/a8184c9f-3bf2-4e6b-bc3e-919820a9bc0f",
        "publisher": "http://api.lockstate.dev/devices/ae05997a-bf33-436a-b033-0102c986adb2"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 8
  }
}

Get an event

Endpoint

GET /events/:id

Request

Route

GET /events/2b9b4b2c-928e-47e1-973a-338bf6f132ed

Response

Response Fields

Name Description
type unlocked, locked, access_denied, access_person_synced, access_person_sync_failed, access_guest_late_sync, reset, connectivity, power_level_low, battery_replaced, acs_door_opened, acs_door_closed, acs_door_held_open, acs_requested_to_exit, temperature_changed, humidity_changed, relay_enabled, relay_disabled or access_person_used
source user, network or device
status succeeded and failed
associated_resource_name If associated_resource is deleted, this field is populated with associated_resource name

Status

200

Body

{
  "data": {
    "type": "unlocked_event",
    "attributes": {
      "source": "user",
      "status": "succeeded",
      "time_zone": "America/Denver",
      "occurred_at": "2018-08-24T19:19:25Z",
      "created_at": "2018-08-29T18:25:25Z",
      "updated_at": "2018-08-29T18:25:25Z",
      "associated_resource_name": null,
      "status_info": null,
      "method": "pin",
      "card": null,
      "pin": "1234",
      "smart_card_serial_number": null,
      "publisher_id": "90baf0a2-10c3-4d97-bead-35bfe24a8252",
      "publisher_type": "lock",
      "associated_resource_id": "212f7b0e-d6a5-4a19-93df-6967caf7a9a8",
      "associated_resource_type": "access_user"
    },
    "id": "2b9b4b2c-928e-47e1-973a-338bf6f132ed",
    "links": {
      "self": "http://api.lockstate.dev/events/2b9b4b2c-928e-47e1-973a-338bf6f132ed",
      "publisher": "http://api.lockstate.dev/devices/90baf0a2-10c3-4d97-bead-35bfe24a8252",
      "associated_resource": "http://api.lockstate.dev/access_persons/212f7b0e-d6a5-4a19-93df-6967caf7a9a8"
    }
  }
}

Groups

Get all groups

Returns all group types (homogeneous).

Endpoint

GET /groups

Parameters

Name Description
type Filter by type(s). Supported types: door_group
sort Sortable attributes: created_at and name, default: created_at ascending

Request

Route

GET /groups

Response

Status

200

Body

{
  "data": [
    {
      "type": "door_group",
      "attributes": {
        "name": "Indoor Locks",
        "created_at": "2018-08-29T18:25:27Z",
        "updated_at": "2018-08-29T18:25:27Z"
      },
      "id": "a8723060-369e-4144-a6f8-0f7e174ad98b",
      "links": {
        "self": "http://api.lockstate.dev/groups/a8723060-369e-4144-a6f8-0f7e174ad98b"
      }
    },
    {
      "type": "door_group",
      "attributes": {
        "name": "Garden & Industrial",
        "created_at": "2018-08-29T18:25:27Z",
        "updated_at": "2018-08-29T18:25:27Z"
      },
      "id": "1ea00c26-381c-4200-a3ec-df6fe83191de",
      "links": {
        "self": "http://api.lockstate.dev/groups/1ea00c26-381c-4200-a3ec-df6fe83191de"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get a group

Endpoint

GET /groups/:id

Request

Route

GET /groups/7bab904d-9a22-4e51-808d-069ba2b66b2b

Response

Status

200

Body

{
  "data": {
    "type": "door_group",
    "attributes": {
      "name": "Indoor Locks",
      "created_at": "2018-08-29T18:25:28Z",
      "updated_at": "2018-08-29T18:25:28Z"
    },
    "id": "7bab904d-9a22-4e51-808d-069ba2b66b2b",
    "links": {
      "self": "http://api.lockstate.dev/groups/7bab904d-9a22-4e51-808d-069ba2b66b2b"
    }
  }
}

Create a door group

Endpoint

POST /groups

Parameters

Name Description
type required door_group
attributes[name] required Door group name

Request

Route

POST /groups

Body

{
  "type": "door_group",
  "attributes": {
    "name": "Warehouse doors"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "door_group",
    "attributes": {
      "name": "Warehouse doors",
      "created_at": "2018-08-29T18:25:28Z",
      "updated_at": "2018-08-29T18:25:28Z"
    },
    "id": "a6e248e6-2814-4558-a56a-21f0eddb56d6",
    "links": {
      "self": "http://api.lockstate.dev/groups/a6e248e6-2814-4558-a56a-21f0eddb56d6"
    }
  }
}

Update a group

Endpoint

PUT /groups/:id

Parameters

Name Description
attributes[name] Group name

Request

Route

PUT /groups/6c0175b0-cb07-4f51-9533-c6e3f3add4fb

Body

{
  "attributes": {
    "name": "Inner doors"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "door_group",
    "attributes": {
      "name": "Inner doors",
      "created_at": "2018-08-29T18:25:28Z",
      "updated_at": "2018-08-29T18:25:28Z"
    },
    "id": "6c0175b0-cb07-4f51-9533-c6e3f3add4fb",
    "links": {
      "self": "http://api.lockstate.dev/groups/6c0175b0-cb07-4f51-9533-c6e3f3add4fb"
    }
  }
}

Delete a group

Endpoint

DELETE /groups/:id

Request

Route

DELETE /groups/4c73eaeb-7031-4430-82d6-5c9cc64faebf

Response

Status

204

Get all doors in a door group

Endpoint

GET /groups/:group_id/doors

Parameters

Name Description
attributes[door_type] Filter by type(s). Supported types: Lock and ACS::Door
sort Sortable attributes: created_at, default: created_at ascending

Request

Route

GET /groups/e6165949-3dd5-4c40-9757-d366f1523e12/doors?attributes[door_type]=lock

Query Parameters

attributes={"door_type"=>"lock"}

Response

Status

200

Body

{
  "data": [
    {
      "type": "door_group_door",
      "attributes": {
        "created_at": "2018-08-29T18:25:28Z",
        "updated_at": "2018-08-29T18:25:28Z",
        "door_id": "be38348d-f62d-4cea-9495-3e034dcbe910",
        "door_type": "lock",
        "door_group_id": "e6165949-3dd5-4c40-9757-d366f1523e12"
      },
      "id": "398e2d48-d44f-48bf-b73f-14db7be95103",
      "links": {
        "self": "http://api.lockstate.dev/groups/e6165949-3dd5-4c40-9757-d366f1523e12/doors/398e2d48-d44f-48bf-b73f-14db7be95103",
        "door": "http://api.lockstate.dev/devices/be38348d-f62d-4cea-9495-3e034dcbe910",
        "door_group": "http://api.lockstate.dev/groups/e6165949-3dd5-4c40-9757-d366f1523e12"
      }
    },
    {
      "type": "door_group_door",
      "attributes": {
        "created_at": "2018-08-29T18:25:29Z",
        "updated_at": "2018-08-29T18:25:29Z",
        "door_id": "7a6658ec-ea39-4b08-9fa2-f4cdcdbed57d",
        "door_type": "lock",
        "door_group_id": "e6165949-3dd5-4c40-9757-d366f1523e12"
      },
      "id": "b5edfb9f-f772-45ae-aa27-c9f78beaea30",
      "links": {
        "self": "http://api.lockstate.dev/groups/e6165949-3dd5-4c40-9757-d366f1523e12/doors/b5edfb9f-f772-45ae-aa27-c9f78beaea30",
        "door": "http://api.lockstate.dev/devices/7a6658ec-ea39-4b08-9fa2-f4cdcdbed57d",
        "door_group": "http://api.lockstate.dev/groups/e6165949-3dd5-4c40-9757-d366f1523e12"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get a door in a door group

Endpoint

GET /groups/:group_id/doors/:id

Request

Route

GET /groups/c33472cc-bfa1-4e10-95cd-919aeabc2aa8/doors/08bfc012-2788-4474-9c88-54abc695ba13

Response

Status

200

Body

{
  "data": {
    "type": "door_group_door",
    "attributes": {
      "created_at": "2018-08-29T18:25:29Z",
      "updated_at": "2018-08-29T18:25:29Z",
      "door_id": "d0ad9cbd-8f1f-4f3f-b51b-5b7d9bf897ee",
      "door_type": "lock",
      "door_group_id": "c33472cc-bfa1-4e10-95cd-919aeabc2aa8"
    },
    "id": "08bfc012-2788-4474-9c88-54abc695ba13",
    "links": {
      "self": "http://api.lockstate.dev/groups/c33472cc-bfa1-4e10-95cd-919aeabc2aa8/doors/08bfc012-2788-4474-9c88-54abc695ba13",
      "door": "http://api.lockstate.dev/devices/d0ad9cbd-8f1f-4f3f-b51b-5b7d9bf897ee",
      "door_group": "http://api.lockstate.dev/groups/c33472cc-bfa1-4e10-95cd-919aeabc2aa8"
    }
  }
}

Add a door to a door group

Endpoint

POST /groups/:group_id/doors

Parameters

Name Description
attributes[door_id] required Door id
attributes[door_type] required Door type: lock and acs_door

Request

Route

POST /groups/b19ddfc4-4b53-4ab4-84f0-9d69125bce0c/doors

Body

{
  "attributes": {
    "door_id": "683b2c3b-39aa-4500-b02c-fa8520623610",
    "door_type": "lock"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "door_group_door",
    "attributes": {
      "created_at": "2018-08-29T18:25:29Z",
      "updated_at": "2018-08-29T18:25:29Z",
      "door_id": "683b2c3b-39aa-4500-b02c-fa8520623610",
      "door_type": "lock",
      "door_group_id": "b19ddfc4-4b53-4ab4-84f0-9d69125bce0c"
    },
    "id": "91a8567c-4463-4ba1-8280-af1bca9dfb8b",
    "links": {
      "self": "http://api.lockstate.dev/groups/b19ddfc4-4b53-4ab4-84f0-9d69125bce0c/doors/91a8567c-4463-4ba1-8280-af1bca9dfb8b",
      "door": "http://api.lockstate.dev/devices/683b2c3b-39aa-4500-b02c-fa8520623610",
      "door_group": "http://api.lockstate.dev/groups/b19ddfc4-4b53-4ab4-84f0-9d69125bce0c"
    }
  }
}

Remove a door from a door group

Endpoint

DELETE /groups/:group_id/doors/:id

Request

Route

DELETE /groups/f78f3dc3-d816-4499-aebe-7648f54db3c0/doors/f7981e16-e65a-444b-89e0-6278311739c2

Response

Status

204

Locations

Get all locations

Endpoint

GET /locations

Parameters

Name Description
sort Sortable attributes: created_at and name, default: name ascending

Request

Route

GET /locations

Response

Status

200

Body

{
  "data": [
    {
      "type": "location",
      "attributes": {
        "name": "LockState Headquarters",
        "phone": "(877) 254-5625",
        "address": "1325 S. Colorado Blvd",
        "address2": "Suite B400",
        "city": "Denver",
        "state": "CO",
        "postal_code": "80222",
        "country": "US",
        "time_zone": "America/Denver",
        "created_at": "2018-08-29T18:25:31Z",
        "updated_at": "2018-08-29T18:25:31Z"
      },
      "id": "64c9413b-3162-4e88-bba4-6b573937a450",
      "links": {
        "self": "http://api.lockstate.dev/locations/64c9413b-3162-4e88-bba4-6b573937a450"
      }
    },
    {
      "type": "location",
      "attributes": {
        "name": "Multi-tiered clear-thinking knowledge user",
        "phone": null,
        "address": "5907 Leonard Valleys",
        "address2": null,
        "city": null,
        "state": null,
        "postal_code": null,
        "country": null,
        "time_zone": "America/Denver",
        "created_at": "2018-08-29T18:25:31Z",
        "updated_at": "2018-08-29T18:25:31Z"
      },
      "id": "cea56a12-2fa9-411d-84bd-9c3505552e7e",
      "links": {
        "self": "http://api.lockstate.dev/locations/cea56a12-2fa9-411d-84bd-9c3505552e7e"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get a location

Endpoint

GET /locations/:id

Request

Route

GET /locations/436624db-c284-460f-875c-953be54c4e81

Response

Status

200

Body

{
  "data": {
    "type": "location",
    "attributes": {
      "name": "LockState Headquarters",
      "phone": "(877) 254-5625",
      "address": "1325 S. Colorado Blvd",
      "address2": "Suite B400",
      "city": "Denver",
      "state": "CO",
      "postal_code": "80222",
      "country": "US",
      "time_zone": "America/Denver",
      "created_at": "2018-08-29T18:25:31Z",
      "updated_at": "2018-08-29T18:25:31Z"
    },
    "id": "436624db-c284-460f-875c-953be54c4e81",
    "links": {
      "self": "http://api.lockstate.dev/locations/436624db-c284-460f-875c-953be54c4e81"
    }
  }
}

Create a location

Endpoint

POST /locations

Parameters

Name Description
attributes[name] required Attributes name
attributes[phone] Attributes phone
attributes[address] Attributes address
attributes[address_2] Attributes address 2
attributes[city] Attributes city
attributes[state] Attributes state
attributes[postal_code] Attributes postal code
attributes[country] https://en.wikipedia.org/wiki/ISO_3166-1
attributes[time_zone] required https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Request

Route

POST /locations

Body

{
  "attributes": {
    "name": "LockState HQ",
    "phone": "(877) 254-5625",
    "address": "1325 S. Colorado Blvd",
    "address2": "Suite B400",
    "city": "Denver",
    "state": "CO",
    "postal_code": "80222",
    "country": "US",
    "time_zone": "America/Denver"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "location",
    "attributes": {
      "name": "LockState HQ",
      "phone": "(877) 254-5625",
      "address": "1325 S. Colorado Blvd",
      "address2": "Suite B400",
      "city": "Denver",
      "state": "CO",
      "postal_code": "80222",
      "country": "US",
      "time_zone": "America/Denver",
      "created_at": "2018-08-29T18:25:32Z",
      "updated_at": "2018-08-29T18:25:32Z"
    },
    "id": "65e8becf-0e50-4bbf-9e8f-608dd9aebd6d",
    "links": {
      "self": "http://api.lockstate.dev/locations/65e8becf-0e50-4bbf-9e8f-608dd9aebd6d"
    }
  }
}

Update a location

Endpoint

PUT /locations/:id

Request

Route

PUT /locations/f56bebc6-55e7-4a44-a9c6-5e4ec1a97727

Body

{
  "attributes": {
    "name": "LockState HQ"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "location",
    "attributes": {
      "name": "LockState HQ",
      "phone": "(877) 254-5625",
      "address": "1325 S. Colorado Blvd",
      "address2": "Suite B400",
      "city": "Denver",
      "state": "CO",
      "postal_code": "80222",
      "country": "US",
      "time_zone": "America/Denver",
      "created_at": "2018-08-29T18:25:32Z",
      "updated_at": "2018-08-29T18:25:32Z"
    },
    "id": "f56bebc6-55e7-4a44-a9c6-5e4ec1a97727",
    "links": {
      "self": "http://api.lockstate.dev/locations/f56bebc6-55e7-4a44-a9c6-5e4ec1a97727"
    }
  }
}

Delete a location

Endpoint

DELETE /locations/:id

Request

Route

DELETE /locations/92fa75d2-a81f-4782-96c7-506e1a6a5a98

Response

Status

204

Models

Get all models

Endpoint

GET /models

Parameters

Name Description
sort Sortable attributes: number, default: none

Request

Route

GET /models

Response

Status

200

Body

{
  "data": [
    {
      "type": "model",
      "attributes": {
        "number": "RL-4000",
        "type": "resort_lock",
        "capabilities": {
          "connected": false,
          "phone_credential": false,
          "pin_credential": false,
          "registrable": true,
          "replaceable": false,
          "smart_card_credential": false
        }
      },
      "id": "422973fc-c005-4bc6-a486-b2dbf510ea66",
      "links": {
        "self": "http://api.lockstate.dev/models/422973fc-c005-4bc6-a486-b2dbf510ea66"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-P50i",
        "type": "power_plug",
        "capabilities": {
          "connected": true,
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "power_sources": [
            "hardwire"
          ],
          "registrable": true,
          "replaceable": false
        }
      },
      "id": "e45ad90f-68b8-4a35-8d83-a83f39037c32",
      "links": {
        "self": "http://api.lockstate.dev/models/e45ad90f-68b8-4a35-8d83-a83f39037c32"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-3i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": true,
          "auto_lock_schedule": true,
          "auto_lock_timeouts": [
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20
          ],
          "connected": true,
          "guest_deferrable": false,
          "heartbeat_intervals": [
            0,
            300,
            900,
            1200,
            1800,
            3600,
            7200,
            14400,
            28800,
            43200
          ],
          "local_pins": true,
          "lock_action_schedule": true,
          "mute": true,
          "phone_credential": false,
          "pin_credential": true,
          "power_sources": [
            "alkaline_battery",
            "lithium_battery"
          ],
          "programming_code": true,
          "registrable": true,
          "replaceable": true,
          "smart_card_credential": false,
          "wake_wifi": [
            "user_action",
            "heartbeat_interval"
          ]
        }
      },
      "id": "134d7fc2-73f1-4221-a510-7aafc5017773",
      "links": {
        "self": "http://api.lockstate.dev/models/134d7fc2-73f1-4221-a510-7aafc5017773"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-P100mi",
        "type": "power_plug",
        "capabilities": {
          "connected": true,
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "power_sources": [
            "hardwire"
          ],
          "registrable": true,
          "replaceable": false
        }
      },
      "id": "8d089dce-de26-4ebf-833d-6c664bce82ab",
      "links": {
        "self": "http://api.lockstate.dev/models/8d089dce-de26-4ebf-833d-6c664bce82ab"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-5i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": true,
          "auto_lock_schedule": true,
          "auto_lock_timeouts": [
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20
          ],
          "connected": true,
          "guest_deferrable": false,
          "heartbeat_intervals": [
            0,
            300,
            900,
            1200,
            1800,
            3600,
            7200,
            14400,
            28800,
            43200
          ],
          "local_pins": true,
          "lock_action_schedule": true,
          "mute": true,
          "phone_credential": false,
          "pin_credential": true,
          "power_sources": [
            "alkaline_battery",
            "lithium_battery"
          ],
          "programming_code": true,
          "registrable": true,
          "replaceable": true,
          "smart_card_credential": false,
          "wake_wifi": [
            "user_action",
            "heartbeat_interval",
            "user_action_except_manual"
          ]
        }
      },
      "id": "d7251cab-c4f8-40da-8278-be595a88ad25",
      "links": {
        "self": "http://api.lockstate.dev/models/d7251cab-c4f8-40da-8278-be595a88ad25"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-DB500i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": false,
          "auto_lock_schedule": false,
          "auto_lock_timeouts": [

          ],
          "connected": true,
          "guest_deferrable": true,
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "local_pins": true,
          "lock_action_schedule": false,
          "mute": false,
          "phone_credential": false,
          "pin_credential": true,
          "power_sources": [

          ],
          "programming_code": true,
          "registrable": true,
          "replaceable": false,
          "smart_card_credential": false,
          "wake_wifi": [

          ]
        }
      },
      "id": "f36eef55-0e59-4bba-8893-437fef018003",
      "links": {
        "self": "http://api.lockstate.dev/models/f36eef55-0e59-4bba-8893-437fef018003"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-L500i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": false,
          "auto_lock_schedule": true,
          "auto_lock_timeouts": [

          ],
          "connected": true,
          "guest_deferrable": true,
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "local_pins": true,
          "lock_action_schedule": false,
          "mute": false,
          "phone_credential": false,
          "pin_credential": true,
          "power_sources": [

          ],
          "programming_code": true,
          "registrable": true,
          "replaceable": false,
          "smart_card_credential": false,
          "wake_wifi": [

          ]
        }
      },
      "id": "692d7212-2fb8-466d-af5b-26e6d452bdb7",
      "links": {
        "self": "http://api.lockstate.dev/models/692d7212-2fb8-466d-af5b-26e6d452bdb7"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-7i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": true,
          "auto_lock_schedule": true,
          "auto_lock_timeouts": [
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20
          ],
          "connected": true,
          "guest_deferrable": false,
          "heartbeat_intervals": [
            0,
            300,
            900,
            1200,
            1800,
            3600,
            7200,
            14400,
            28800,
            43200
          ],
          "local_pins": true,
          "lock_action_schedule": true,
          "mute": true,
          "phone_credential": false,
          "pin_credential": true,
          "power_sources": [
            "alkaline_battery",
            "lithium_battery"
          ],
          "programming_code": true,
          "registrable": true,
          "replaceable": true,
          "smart_card_credential": false,
          "wake_wifi": [
            "user_action",
            "heartbeat_interval"
          ]
        }
      },
      "id": "4d3be5ed-b314-4cb7-8119-2a75d57734e5",
      "links": {
        "self": "http://api.lockstate.dev/models/4d3be5ed-b314-4cb7-8119-2a75d57734e5"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-90i",
        "type": "thermostat",
        "capabilities": {
          "connected": true,
          "fan_modes": [
            "on",
            "auto",
            "auto_circulate"
          ],
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "modes": [
            "heat",
            "cool",
            "auto",
            "off"
          ],
          "power_sources": [
            "hardwire"
          ],
          "registrable": true,
          "replaceable": false
        }
      },
      "id": "10eacf93-c715-4931-8d71-ae4adb392909",
      "links": {
        "self": "http://api.lockstate.dev/models/10eacf93-c715-4931-8d71-ae4adb392909"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "RL-2000",
        "type": "resort_lock",
        "capabilities": {
          "connected": false,
          "phone_credential": false,
          "pin_credential": false,
          "registrable": true,
          "replaceable": false,
          "smart_card_credential": false
        }
      },
      "id": "945983f6-20ef-4b7a-96c2-44c22da37715",
      "links": {
        "self": "http://api.lockstate.dev/models/945983f6-20ef-4b7a-96c2-44c22da37715"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "August",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": false,
          "auto_lock_schedule": false,
          "auto_lock_timeouts": [

          ],
          "connected": true,
          "guest_deferrable": false,
          "heartbeat_intervals": [

          ],
          "local_pins": true,
          "lock_action_schedule": false,
          "mute": false,
          "phone_credential": true,
          "pin_credential": true,
          "power_sources": [

          ],
          "programming_code": false,
          "registrable": false,
          "replaceable": false,
          "smart_card_credential": false,
          "wake_wifi": [

          ]
        }
      },
      "id": "f86d4270-77b5-4938-b630-5dc42e12be44",
      "links": {
        "self": "http://api.lockstate.dev/models/f86d4270-77b5-4938-b630-5dc42e12be44"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-8i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": true,
          "auto_lock_schedule": true,
          "auto_lock_timeouts": [
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20
          ],
          "connected": true,
          "guest_deferrable": false,
          "heartbeat_intervals": [
            0,
            300,
            900,
            1200,
            1800,
            3600,
            7200,
            14400,
            28800,
            43200
          ],
          "local_pins": false,
          "lock_action_schedule": true,
          "mute": true,
          "phone_credential": false,
          "pin_credential": false,
          "power_sources": [
            "alkaline_battery",
            "lithium_battery"
          ],
          "programming_code": false,
          "registrable": true,
          "replaceable": true,
          "smart_card_credential": true,
          "wake_wifi": [
            "user_action",
            "heartbeat_interval"
          ]
        }
      },
      "id": "9aa8e7c0-c148-4519-a93d-ab721372a4ce",
      "links": {
        "self": "http://api.lockstate.dev/models/9aa8e7c0-c148-4519-a93d-ab721372a4ce"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-60i",
        "type": "thermostat",
        "capabilities": {
          "connected": true,
          "fan_modes": [
            "on",
            "auto"
          ],
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "modes": [
            "heat",
            "cool",
            "off"
          ],
          "power_sources": [
            "battery",
            "hardwire"
          ],
          "registrable": true,
          "replaceable": false
        }
      },
      "id": "0eefd459-7fe4-413b-8dcf-591b4403fcb4",
      "links": {
        "self": "http://api.lockstate.dev/models/0eefd459-7fe4-413b-8dcf-591b4403fcb4"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-6i",
        "type": "lock",
        "capabilities": {
          "auto_lock_enable": true,
          "auto_lock_schedule": true,
          "auto_lock_timeouts": [
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20
          ],
          "connected": true,
          "guest_deferrable": false,
          "heartbeat_intervals": [
            0,
            300,
            900,
            1200,
            1800,
            3600,
            7200,
            14400,
            28800,
            43200
          ],
          "local_pins": true,
          "lock_action_schedule": true,
          "mute": true,
          "phone_credential": false,
          "pin_credential": true,
          "power_sources": [
            "alkaline_battery",
            "lithium_battery"
          ],
          "programming_code": true,
          "registrable": true,
          "replaceable": true,
          "smart_card_credential": false,
          "wake_wifi": [
            "user_action",
            "heartbeat_interval"
          ]
        }
      },
      "id": "7bcd9665-e9a7-4b4e-807f-a3177cf339c1",
      "links": {
        "self": "http://api.lockstate.dev/models/7bcd9665-e9a7-4b4e-807f-a3177cf339c1"
      }
    },
    {
      "type": "model",
      "attributes": {
        "number": "LS-P100i",
        "type": "power_plug",
        "capabilities": {
          "connected": true,
          "heartbeat_intervals": [
            0,
            10,
            60,
            300,
            600,
            900,
            1200,
            1800,
            3600,
            7200,
            10800,
            14400
          ],
          "power_sources": [
            "hardwire"
          ],
          "registrable": true,
          "replaceable": false
        }
      },
      "id": "649848cb-3d67-40f2-a28c-dafa697f427b",
      "links": {
        "self": "http://api.lockstate.dev/models/649848cb-3d67-40f2-a28c-dafa697f427b"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 15
  }
}

Get a model

Endpoint

GET /models/:id

Request

Route

GET /models/004c410e-1c66-4bc5-a2d3-c57d2b546257

Response

Status

200

Body

{
  "data": {
    "type": "model",
    "attributes": {
      "number": "RL-4000",
      "type": "resort_lock",
      "capabilities": {
        "connected": false,
        "phone_credential": false,
        "pin_credential": false,
        "registrable": true,
        "replaceable": false,
        "smart_card_credential": false
      }
    },
    "id": "004c410e-1c66-4bc5-a2d3-c57d2b546257",
    "links": {
      "self": "http://api.lockstate.dev/models/004c410e-1c66-4bc5-a2d3-c57d2b546257"
    }
  }
}

Notification Subscribers

Get all notification subscribers

Returns all notification subscriber types (homogeneous).

Endpoint

GET /notification_subscribers

Parameters

Name Description
type Filter by type(s). Supported types: email_notification_subscriber, text_notification_subscriber, and webhook_notification_subscriber
sort Sortable attributes: created_at and name, default: created_at ascending

Request

Route

GET /notification_subscribers

Response

Status

200

Body

{
  "data": [
    {
      "type": "text_notification_subscriber",
      "attributes": {
        "name": "Ms. Norma Bednar",
        "phone": "(570) 436-4276 x0090",
        "carrier": "sprint",
        "active": true,
        "created_at": "2018-08-29T18:25:37Z",
        "updated_at": "2018-08-29T18:25:37Z"
      },
      "id": "51e89933-605e-442c-b05a-82b05d5d5ea3",
      "links": {
        "self": "http://api.lockstate.dev/notification_subscribers/51e89933-605e-442c-b05a-82b05d5d5ea3"
      }
    },
    {
      "type": "webhook_notification_subscriber",
      "attributes": {
        "name": "Marion Luettgen",
        "url": "https://www.google.com",
        "content_type": "form",
        "secret": "13af9eae05428554fe5e6e66d347b0cb",
        "active": true,
        "created_at": "2018-08-29T18:25:37Z",
        "updated_at": "2018-08-29T18:25:37Z"
      },
      "id": "ba47e9d4-3f65-4ed5-9f33-5c24060cda7d",
      "links": {
        "self": "http://api.lockstate.dev/notification_subscribers/ba47e9d4-3f65-4ed5-9f33-5c24060cda7d"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get a notification subscriber

Endpoint

GET /notification_subscribers/:id

Request

Route

GET /notification_subscribers/cfe749d7-52b7-4b12-bc77-2164c3087147

Response

Status

200

Body

{
  "data": {
    "type": "text_notification_subscriber",
    "attributes": {
      "name": "Alexane McCullough",
      "phone": "(526) 010-8966",
      "carrier": "cricket",
      "active": true,
      "created_at": "2018-08-29T18:25:37Z",
      "updated_at": "2018-08-29T18:25:37Z"
    },
    "id": "cfe749d7-52b7-4b12-bc77-2164c3087147",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscribers/cfe749d7-52b7-4b12-bc77-2164c3087147"
    }
  }
}

Update a notification subscriber

Parameters accepted: all used for create

Endpoint

PUT /notification_subscribers/:id

Request

Route

PUT /notification_subscribers/2d8f18ed-1289-417c-8af8-2546f9ee402d

Body

{
  "attributes": {
    "active": false
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "text_notification_subscriber",
    "attributes": {
      "name": "Miss Roselyn Runte",
      "phone": "1-130-551-3719 x62656",
      "carrier": "tmobile",
      "active": false,
      "created_at": "2018-08-29T18:25:37Z",
      "updated_at": "2018-08-29T18:25:37Z"
    },
    "id": "2d8f18ed-1289-417c-8af8-2546f9ee402d",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscribers/2d8f18ed-1289-417c-8af8-2546f9ee402d"
    }
  }
}

Delete a notification subscriber

Endpoint

DELETE /notification_subscribers/:id

Request

Route

DELETE /notification_subscribers/ce762269-73d3-454e-b4f0-d255671c0e45

Response

Status

204

Create an email notification subscriber

Endpoint

POST /notification_subscribers

Parameters

Name Description
type required email_notification_subscriber
attributes[active] Whether the subscriber is active or not. The subscriber will not receive notifications if set to false. Default: true
attributes[name] required Name
attributes[email] required Email

Request

Route

POST /notification_subscribers

Body

{
  "type": "email_notification_subscriber",
  "attributes": {
    "active": true,
    "name": "Rob Goff",
    "email": "rob@lockstate.com"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "email_notification_subscriber",
    "attributes": {
      "name": "Rob Goff",
      "email": "rob@lockstate.com",
      "active": true,
      "created_at": "2018-08-29T18:25:38Z",
      "updated_at": "2018-08-29T18:25:38Z"
    },
    "id": "54f3c1db-b06a-42ba-abee-599268897ad5",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscribers/54f3c1db-b06a-42ba-abee-599268897ad5"
    }
  }
}

Create a text notification subscriber

Endpoint

POST /notification_subscribers

Parameters

Name Description
type required text_notification_subscriber
attributes[active] Whether the subscriber is active or not. The subscriber will not receive notifications if set to false. Default: true
attributes[name] required Name
attributes[phone] required Phone Number
attributes[carrier] required Carrier

Request

Route

POST /notification_subscribers

Body

{
  "type": "text_notification_subscriber",
  "attributes": {
    "active": true,
    "name": "Rob Goff",
    "phone": "303-317-3422",
    "carrier": "att"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "text_notification_subscriber",
    "attributes": {
      "name": "Rob Goff",
      "phone": "303-317-3422",
      "carrier": "att",
      "active": true,
      "created_at": "2018-08-29T18:25:38Z",
      "updated_at": "2018-08-29T18:25:38Z"
    },
    "id": "07da4ed5-1b2d-426a-b936-6e61934dce8f",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscribers/07da4ed5-1b2d-426a-b936-6e61934dce8f"
    }
  }
}

Create a webhook notification subscriber

Webhooks are HTTP callbacks that you can create to receive events as they happen to avoid polling from the events API endpoint.

Webhook endpoint requirements

  1. Must be secured with HTTPS
  2. Validate request from us using the X-Secret header provided when webhook was created
  3. Process the request within 3 seconds, otherwise the request will timeout and our server will schedule it for retry. To avoid exceeding this deadline, we recommend processing webhook requests outside of the request/response lifecycle
  4. Always respond with 200 range status code, otherwise our server will schedule the request for retry

Retry logic

Whenever your webhook endpoint responds with a non-200 range status code or exceeds the deadline, our server will timeout the request and schedule for retry.

Our server will retry failed requests every hour for the next 72 hours after the first failure. Most of the time, this is enough to fix an issue on the webhook target server.

Webhook deactivation

If any message cannot be acknowledged by the webhook endpoint for 72 hours, our server will automatically deactivate the webhook. When this happens, we send an email notifying about the deactivated webhook.

Recover missed data

The best way to recover data from a deactivated webhook is to fetch from the /events endpoint. A sort by created_at is available for that endpoint and your application can use data from the last received messages via webhook to find the stop point.

A webhook payload has a similar structure to the response of events endpoint. The important difference is that the root JSON key, data, is a single object on a webhook payload, whereas data is an array of objects on the events response.

Make sure the webhook handler is decoupled enough so that it’s easy to use for a data recover scenario from /events.

Endpoint

POST /notification_subscribers

Parameters

Name Description
type required webhook_notification_subscriber
attributes[active] Whether the subscriber is active or not. The subscriber will not receive notifications if set to false. Default: true
attributes[name] required Name
attributes[url] required Secure (HTTPS) URL
attributes[content_type] required Content-Type ("form" or "json"). Default is "form".
attributes[secret] "X-Secret" request header to verify it came from us

Request

Route

POST /notification_subscribers

Body

{
  "type": "webhook_notification_subscriber",
  "attributes": {
    "active": true,
    "name": "Rob's webhook",
    "url": "https://google.com",
    "content_type": "form",
    "secret": "5f7c5b9ccedea8832a46cfca516da134"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "webhook_notification_subscriber",
    "attributes": {
      "name": "Rob's webhook",
      "url": "https://google.com",
      "content_type": "form",
      "secret": "5f7c5b9ccedea8832a46cfca516da134",
      "active": true,
      "created_at": "2018-08-29T18:25:38Z",
      "updated_at": "2018-08-29T18:25:38Z"
    },
    "id": "208b6dd9-c46a-423a-bf11-b0335be30bd1",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscribers/208b6dd9-c46a-423a-bf11-b0335be30bd1"
    }
  }
}

Notification Subscriptions

Get all notification subscriptions

Endpoint

GET /notification_subscriptions

Parameters

Name Description
sort Sortable attributes: created_at, default: created_at ascending

Request

Route

GET /notification_subscriptions

Response

Status

200

Body

{
  "data": [
    {
      "type": "notification_subscription",
      "attributes": {
        "events": [
          {
            "event_type": "access_person_used"
          }
        ],
        "created_at": "2018-08-29T18:25:39Z",
        "updated_at": "2018-08-29T18:25:39Z",
        "subscriber_id": "f7affd66-1a10-44e8-9872-6a58ffcc7e08",
        "subscriber_type": "text_notification_subscriber",
        "publisher_id": "fb7bfe88-8b01-494a-be83-49f509f8bc71",
        "publisher_type": "account"
      },
      "id": "a379bbbc-6e21-4f5f-90f0-00b7550991cd",
      "links": {
        "self": "http://api.lockstate.dev/notification_subscriptions/a379bbbc-6e21-4f5f-90f0-00b7550991cd",
        "subscriber": "http://api.lockstate.dev/notification_subscribers/f7affd66-1a10-44e8-9872-6a58ffcc7e08",
        "publisher": "http://api.lockstate.dev/accounts/fb7bfe88-8b01-494a-be83-49f509f8bc71"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 1
  }
}

Get a notification subscription

Endpoint

GET /notification_subscriptions/:id

Request

Route

GET /notification_subscriptions/cf61ae52-7ed6-48c5-acf5-2c1fd6f3e61c

Response

Status

200

Body

{
  "data": {
    "type": "notification_subscription",
    "attributes": {
      "events": [
        {
          "event_type": "access_person_used"
        }
      ],
      "created_at": "2018-08-29T18:25:39Z",
      "updated_at": "2018-08-29T18:25:39Z",
      "subscriber_id": "e4d406f5-d217-450f-baba-a5ce0fe1cecc",
      "subscriber_type": "text_notification_subscriber",
      "publisher_id": "be546091-fa1e-4e95-bc3d-a9463556fefe",
      "publisher_type": "account"
    },
    "id": "cf61ae52-7ed6-48c5-acf5-2c1fd6f3e61c",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscriptions/cf61ae52-7ed6-48c5-acf5-2c1fd6f3e61c",
      "subscriber": "http://api.lockstate.dev/notification_subscribers/e4d406f5-d217-450f-baba-a5ce0fe1cecc",
      "publisher": "http://api.lockstate.dev/accounts/be546091-fa1e-4e95-bc3d-a9463556fefe"
    }
  }
}

Create a notification subscription

Notification Subscription is the combination of a Publisher, a Subscriber and the events to listen.

The event types contained in events must be compatible with the publisher type. Accounts and Locations can be combined with any event_type, but the others only work with their compatible event JSON Schemas:

  • Lock

    {
      "type": "object",
      "properties": {
        "event_type": {
          "enum": [
            "unlocked",
            "locked",
            "access_denied",
            "access_person_synced",
            "access_person_sync_failed",
            "access_guest_late_sync",
            "reset",
            "connectivity",
            "power_level_low",
            "battery_replaced"
          ]
        }
      },
      "required": [
        "event_type"
      ],
      "additionalProperties": false
    } 
    
  • ACS/Door

    {
      "type": "object",
      "properties": {
        "event_type": {
          "enum": [
            "unlocked",
            "locked",
            "access_denied",
            "access_person_synced",
            "access_person_sync_failed",
            "access_guest_late_sync",
            "reset",
            "acs_door_opened",
            "acs_door_closed",
            "acs_door_held_open",
            "acs_requested_to_exit"
          ]
        }
      },
      "required": [
        "event_type"
      ],
      "additionalProperties": false
    } 
    
  • Thermostat

    {
      "type": "object",
      "properties": {
        "event_type": {
          "enum": [
            "connectivity",
            "power_level_low",
            "temperature_changed",
            "humidity_changed"
          ]
        }
      },
      "required": [
        "event_type"
      ],
      "additionalProperties": false
    } 
    
  • Power Plug

    {
      "type": "object",
      "properties": {
        "event_type": {
          "enum": [
            "connectivity",
            "relay_enabled",
            "relay_disabled"
          ]
        }
      },
      "required": [
        "event_type"
      ],
      "additionalProperties": false
    } 
    
  • ACS/Controller

    {
      "type": "object",
      "properties": {
        "event_type": {
          "enum": [
            "connectivity"
          ]
        }
      },
      "required": [
        "event_type"
      ],
      "additionalProperties": false
    } 
    
  • Access Person

    {
      "type": "object",
      "properties": {
        "event_type": {
          "enum": [
            "access_person_used"
          ]
        },
        "first_access": {
          "type": "boolean"
        },
        "created_by_integration": {
          "type": "boolean"
        }
      },
      "required": [
        "event_type"
      ],
      "additionalProperties": false
    } 
    

Endpoint

POST /notification_subscriptions

Parameters

Name Description
attributes[events] required [{ "event_type": "a supported event type" }, ...]
attributes[publisher_type] required Publisher type: account, location, access_user, access_guest, lock, thermostat, power_plug, acs_door or acs_controller
attributes[publisher_id] required Publisher id
attributes[subscriber_type] required Subscriber type: text_notification_subscriber, email_notification_subscriber or webhook_notification_subscriber
attributes[subscriber_id] required Subscriber id

Request

Route

POST /notification_subscriptions

Body

{
  "attributes": {
    "events": [
      {
        "event_type": "unlocked"
      },
      {
        "event_type": "locked"
      },
      {
        "event_type": "access_denied"
      },
      {
        "event_type": "access_person_synced"
      },
      {
        "event_type": "access_person_sync_failed"
      },
      {
        "event_type": "access_guest_late_sync"
      },
      {
        "event_type": "reset"
      },
      {
        "event_type": "connectivity"
      },
      {
        "event_type": "power_level_low"
      },
      {
        "event_type": "battery_replaced"
      },
      {
        "event_type": "acs_door_opened"
      },
      {
        "event_type": "acs_door_closed"
      },
      {
        "event_type": "acs_door_held_open"
      },
      {
        "event_type": "acs_requested_to_exit"
      },
      {
        "event_type": "temperature_changed"
      },
      {
        "event_type": "humidity_changed"
      },
      {
        "event_type": "relay_enabled"
      },
      {
        "event_type": "relay_disabled"
      },
      {
        "event_type": "access_person_used"
      }
    ],
    "publisher_type": "account",
    "publisher_id": "8f85f048-b56d-4ec8-8ccb-a0cbbd85d205",
    "subscriber_type": "text_notification_subscriber",
    "subscriber_id": "529ff5f4-5269-4117-9e41-2229968f9de0"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "notification_subscription",
    "attributes": {
      "events": [
        {
          "event_type": "unlocked"
        },
        {
          "event_type": "locked"
        },
        {
          "event_type": "access_denied"
        },
        {
          "event_type": "access_person_synced"
        },
        {
          "event_type": "access_person_sync_failed"
        },
        {
          "event_type": "access_guest_late_sync"
        },
        {
          "event_type": "reset"
        },
        {
          "event_type": "connectivity"
        },
        {
          "event_type": "power_level_low"
        },
        {
          "event_type": "battery_replaced"
        },
        {
          "event_type": "acs_door_opened"
        },
        {
          "event_type": "acs_door_closed"
        },
        {
          "event_type": "acs_door_held_open"
        },
        {
          "event_type": "acs_requested_to_exit"
        },
        {
          "event_type": "temperature_changed"
        },
        {
          "event_type": "humidity_changed"
        },
        {
          "event_type": "relay_enabled"
        },
        {
          "event_type": "relay_disabled"
        },
        {
          "event_type": "access_person_used"
        }
      ],
      "created_at": "2018-08-29T18:25:39Z",
      "updated_at": "2018-08-29T18:25:39Z",
      "subscriber_id": "529ff5f4-5269-4117-9e41-2229968f9de0",
      "subscriber_type": "text_notification_subscriber",
      "publisher_id": "8f85f048-b56d-4ec8-8ccb-a0cbbd85d205",
      "publisher_type": "account"
    },
    "id": "c74e9f51-3077-482f-b624-5b858d640d33",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscriptions/c74e9f51-3077-482f-b624-5b858d640d33",
      "subscriber": "http://api.lockstate.dev/notification_subscribers/529ff5f4-5269-4117-9e41-2229968f9de0",
      "publisher": "http://api.lockstate.dev/account"
    }
  }
}

Update a notification subscription

Endpoint

PUT /notification_subscriptions/:id

Parameters

Name Description
attributes[events] [{ "event_type": "a supported event type" }, ...]
attributes[publisher_type] Publisher type: account, location, access_user, access_guest, lock, thermostat, power_plug, acs_door or acs_controller
attributes[publisher_id] Publisher id
attributes[subscriber_type] Subscriber type: text_notification_subscriber, email_notification_subscriber or webhook_notification_subscriber
attributes[subscriber_id] Subscriber id

Request

Route

PUT /notification_subscriptions/1e3e1d44-7658-4b67-99ea-f61d2ea3b0d3

Body

{
  "attributes": {
    "events": [
      {
        "event_type": "access_person_used"
      },
      {
        "event_type": "acs_door_held_open"
      }
    ]
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "notification_subscription",
    "attributes": {
      "events": [
        {
          "event_type": "access_person_used"
        },
        {
          "event_type": "acs_door_held_open"
        }
      ],
      "created_at": "2018-08-29T18:25:40Z",
      "updated_at": "2018-08-29T18:25:40Z",
      "subscriber_id": "bc5d328f-678f-4147-8c07-731f01cdc662",
      "subscriber_type": "text_notification_subscriber",
      "publisher_id": "cdb423d6-1192-4627-80ac-809e15374a24",
      "publisher_type": "account"
    },
    "id": "1e3e1d44-7658-4b67-99ea-f61d2ea3b0d3",
    "links": {
      "self": "http://api.lockstate.dev/notification_subscriptions/1e3e1d44-7658-4b67-99ea-f61d2ea3b0d3",
      "subscriber": "http://api.lockstate.dev/notification_subscribers/bc5d328f-678f-4147-8c07-731f01cdc662",
      "publisher": "http://api.lockstate.dev/accounts/cdb423d6-1192-4627-80ac-809e15374a24"
    }
  }
}

Delete a notification subscription

Endpoint

DELETE /notification_subscriptions/:id

Request

Route

DELETE /notification_subscriptions/a931f8f0-f0d8-4d6d-8947-b1bbea908b73

Response

Status

204

Notifications

Get all notifications

Endpoint

GET /notifications

Request

Route

GET /notifications

Response

Status

200

Body

{
  "data": [
    {
      "type": "notification",
      "attributes": {
        "created_at": "2018-08-29T18:25:40Z",
        "updated_at": "2018-08-29T18:25:40Z",
        "subscriber_id": "9ad97b8b-753c-49c4-a003-c301f95a2606",
        "subscriber_type": "text_notification_subscriber",
        "publisher_id": "1cdb2c20-0516-4daa-98da-a443320ca4c9",
        "publisher_type": "lock",
        "event_id": "c238a4cc-eeda-46d9-9b35-fc0d8633dc32",
        "event_type": "unlocked_event"
      },
      "id": "64cdc745-edfe-4b8a-914f-c10f1d038fe5",
      "links": {
        "self": "http://api.lockstate.dev/notifications/64cdc745-edfe-4b8a-914f-c10f1d038fe5",
        "subscriber": "http://api.lockstate.dev/notification_subscribers/9ad97b8b-753c-49c4-a003-c301f95a2606",
        "publisher": "http://api.lockstate.dev/devices/1cdb2c20-0516-4daa-98da-a443320ca4c9",
        "event": "http://api.lockstate.dev/events/c238a4cc-eeda-46d9-9b35-fc0d8633dc32"
      }
    },
    {
      "type": "notification",
      "attributes": {
        "created_at": "2018-08-29T18:25:40Z",
        "updated_at": "2018-08-29T18:25:40Z",
        "subscriber_id": "3b10f2b2-4f95-46f7-b046-1147ef2225bc",
        "subscriber_type": "email_notification_subscriber",
        "publisher_id": "1cdb2c20-0516-4daa-98da-a443320ca4c9",
        "publisher_type": "lock",
        "event_id": "c238a4cc-eeda-46d9-9b35-fc0d8633dc32",
        "event_type": "unlocked_event"
      },
      "id": "5a10a94f-e8bb-45fc-9cfb-ba8eb1781706",
      "links": {
        "self": "http://api.lockstate.dev/notifications/5a10a94f-e8bb-45fc-9cfb-ba8eb1781706",
        "subscriber": "http://api.lockstate.dev/notification_subscribers/3b10f2b2-4f95-46f7-b046-1147ef2225bc",
        "publisher": "http://api.lockstate.dev/devices/1cdb2c20-0516-4daa-98da-a443320ca4c9",
        "event": "http://api.lockstate.dev/events/c238a4cc-eeda-46d9-9b35-fc0d8633dc32"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Resort Lock Guests

Get all resort lock guests

Endpoint

GET /resort_lock_guests

Parameters

Name Description
sort Sortable attributes: created_at, name, starts_at, and ends_at, default: created_at ascending

Request

Route

GET /resort_lock_guests

Response

Status

200

Body

{
  "data": [
    {
      "type": "resort_lock_guest",
      "attributes": {
        "name": "John Doe",
        "email": "john.doe@email.com",
        "pin": "1234567890",
        "starts_at": "2020-01-02T16:00:00",
        "ends_at": "2020-03-02T16:00:00",
        "one_time_access": false,
        "rental_source": null,
        "created_at": "2018-08-29T18:25:58Z",
        "updated_at": "2018-08-29T18:25:58Z",
        "resort_lock_id": "063c0373-1210-471b-9b65-bd1ea51fe024"
      },
      "id": "2a40e441-bd98-4eb0-abbe-a4a51506e906",
      "links": {
        "self": "http://api.lockstate.dev/resort_lock_guests/2a40e441-bd98-4eb0-abbe-a4a51506e906",
        "resort_lock": "http://api.lockstate.dev/devices/063c0373-1210-471b-9b65-bd1ea51fe024"
      }
    },
    {
      "type": "resort_lock_guest",
      "attributes": {
        "name": "Serena Keeling",
        "email": "eloise.harber@schuppehomenick.net",
        "pin": "1305737467",
        "starts_at": "2018-08-29T18:00:00",
        "ends_at": "2018-08-31T18:00:00",
        "one_time_access": false,
        "rental_source": null,
        "created_at": "2018-08-29T18:25:58Z",
        "updated_at": "2018-08-29T18:25:58Z",
        "resort_lock_id": "063c0373-1210-471b-9b65-bd1ea51fe024"
      },
      "id": "e3e5f6ec-38bb-4908-b1ed-0c138972eafe",
      "links": {
        "self": "http://api.lockstate.dev/resort_lock_guests/e3e5f6ec-38bb-4908-b1ed-0c138972eafe",
        "resort_lock": "http://api.lockstate.dev/devices/063c0373-1210-471b-9b65-bd1ea51fe024"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get a resort lock guest

Endpoint

GET /resort_lock_guests/:id

Request

Route

GET /resort_lock_guests/f6626f0a-b9a8-4bb2-a4f1-49810ff6688b

Response

Status

200

Body

{
  "data": {
    "type": "resort_lock_guest",
    "attributes": {
      "name": "John Doe",
      "email": "john.doe@email.com",
      "pin": "1234567890",
      "starts_at": "2020-01-02T16:00:00",
      "ends_at": "2020-03-02T16:00:00",
      "one_time_access": false,
      "rental_source": null,
      "created_at": "2018-08-29T18:25:59Z",
      "updated_at": "2018-08-29T18:25:59Z",
      "resort_lock_id": "f77d756b-6e5e-4466-bb14-6b93f48ff505"
    },
    "id": "f6626f0a-b9a8-4bb2-a4f1-49810ff6688b",
    "links": {
      "self": "http://api.lockstate.dev/resort_lock_guests/f6626f0a-b9a8-4bb2-a4f1-49810ff6688b",
      "resort_lock": "http://api.lockstate.dev/devices/f77d756b-6e5e-4466-bb14-6b93f48ff505"
    }
  }
}

Create a resort lock guest

‘Resort lock guest’ has temporary location access limited by ‘starts_at’ and ‘ends_at’ parameters.

Endpoint

POST /resort_lock_guests

Parameters

Name Description
attributes[resort_lock_id] required Resort Lock
attributes[name] required Name
attributes[starts_at] required Starts at ISO 8601 timestamp without time zone. Only hours are supported (minutes and seconds will be converted to zeros).
attributes[ends_at] required Ends at ISO 8601 timestamp without time zone. Only hours are supported (minutes and seconds will be converted to zeros).
attributes[email] Email
attributes[one_time_access] This PIN is only valid for a *single* entry between `starts_at` and `ends_at`. Default is `false`.

Request

Route

POST /resort_lock_guests

Body

{
  "attributes": {
    "resort_lock_id": "707d7404-fa30-4754-b880-2316cf34f325",
    "name": "Ann Smith",
    "starts_at": "2020-01-02T13:00:00",
    "ends_at": "2021-01-02T16:00:00",
    "email": "june.harber@harris.net"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "resort_lock_guest",
    "attributes": {
      "name": "Ann Smith",
      "email": "june.harber@harris.net",
      "pin": "1342005721",
      "starts_at": "2020-01-02T13:00:00",
      "ends_at": "2021-01-02T16:00:00",
      "one_time_access": false,
      "rental_source": null,
      "created_at": "2018-08-29T18:25:59Z",
      "updated_at": "2018-08-29T18:25:59Z",
      "resort_lock_id": "707d7404-fa30-4754-b880-2316cf34f325"
    },
    "id": "a9d7add0-9bb7-4c5c-b457-d85b2bfabd9c",
    "links": {
      "self": "http://api.lockstate.dev/resort_lock_guests/a9d7add0-9bb7-4c5c-b457-d85b2bfabd9c",
      "resort_lock": "http://api.lockstate.dev/devices/707d7404-fa30-4754-b880-2316cf34f325"
    }
  }
}

Update a resort lock guest

Endpoint

PUT /resort_lock_guests/:id

Parameters

Name Description
attributes[name] Name
attributes[email] Email

Request

Route

PUT /resort_lock_guests/fb56e278-2070-4f28-a0f4-cbe15ebeb944

Body

{
  "attributes": {
    "name": "Jonatan Doery"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "resort_lock_guest",
    "attributes": {
      "name": "Jonatan Doery",
      "email": "john.doe@email.com",
      "pin": "1234567890",
      "starts_at": "2020-01-02T16:00:00",
      "ends_at": "2020-03-02T16:00:00",
      "one_time_access": false,
      "rental_source": null,
      "created_at": "2018-08-29T18:26:00Z",
      "updated_at": "2018-08-29T18:26:00Z",
      "resort_lock_id": "7609169d-0dd7-4648-8b5b-59f22c1d584b"
    },
    "id": "fb56e278-2070-4f28-a0f4-cbe15ebeb944",
    "links": {
      "self": "http://api.lockstate.dev/resort_lock_guests/fb56e278-2070-4f28-a0f4-cbe15ebeb944",
      "resort_lock": "http://api.lockstate.dev/devices/7609169d-0dd7-4648-8b5b-59f22c1d584b"
    }
  }
}

Delete a resort lock guest

Endpoint

DELETE /resort_lock_guests/:id

Request

Route

DELETE /resort_lock_guests/31cb94c2-b841-441f-ba95-9f80d9511b05

Response

Status

204

Send access instructions email to resort lock guest

Endpoint

POST /resort_lock_guests/:id/email/notify

Request

Route

POST /resort_lock_guests/d12ce003-24d9-4c47-ab92-70edba2122de/email/notify

Response

Status

200

Preview resort lock guest access instructions email

Endpoint

GET /resort_lock_guests/:id/email/preview

Request

Route

GET /resort_lock_guests/37a36be3-3a17-44de-8ee2-cf0c73000e26/email/preview

Response

Status

200

Body

{
  "data": {
    "type": "access_instruction_guest_email_template",
    "attributes": {
      "subject": "Access instructions",
      "body": "<p>Dear John Doe,</p>\n\n<p>Here is your access code for your upcoming stay with us. Our property is equipped with a keyless entry door lock for your convenience.</p>\n\n<p>Access Code: 123-456-7890</p>\n\n<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" id=\"access-instructions\">\n  \n    <tr>\n      <td colspan=\"3\" width=\"100%\" align=\"left\" valign=\"top\">\n        Versatile intermediate infrastructure\n        (72709 Vance Course)\n      </td>\n    </tr>\n\n    \n      <tr>\n        <td width=\"3%\" align=\"left\" valign=\"top\"></td>\n        <td colspan=\"2\" width=\"97%\" align=\"left\" valign=\"top\">\n          <b>RL-4000 - WU7BAGZ80B4FBE01</b>\n        </td>\n      </tr>\n      <tr>\n        <td width=\"3%\" align=\"left\" valign=\"top\"></td>\n        <td width=\"3%\" align=\"left\" valign=\"top\"></td>\n        <td width=\"94%\" align=\"left\" valign=\"top\">\n          \n            Access times:\n            January 2, 2020  4:00 PM to March 2, 2020  4:00 PM\n            <br/>\n          \n          Access instruction:\n          <p><strong>Lock Instructions:</strong><br>\nThere are two methods to opening the lock on your vacation rental. One is to simply enter the 10 (or 12 if provided) digit Access Code above, followed by the &#39;#&#39; key. The other is to create your own shorter code for use during your stay.</p>\n\n<p>Method 1: Use Default Access Code Enter the following on the lock’s keypad: Access Code, # (Door will unlock)</p>\n\n<p>Method 2: Create Your Own Code (Can be 3 – 5 Digits)<br>\nStep 1: Hold the * key until green light is solid (About 2 seconds), then release.<br>\nStep 2: While green light is lit, enter Access Code, #, Your Own Code, #<br>\nNow you have programmed your own code into the lock. Next step is to unlock the door using the code you just created.<br>\nStep 3: Enter Your Code, # (Door will unlock)</p>\n\n        </td>\n      </tr>\n    \n  \n</table>\n\n<p>If you have any questions, please feel free to call us at (Phone not provided) or email at <a href=\"mailto:torey@cronahermiston.name\">torey@cronahermiston.name</a>.</p>\n\n<p>Regards,</p>\n\n<p>Madeline Kassulke III</p>\n",
      "from_name": "Madeline Kassulke III",
      "reply_to": "torey@cronahermiston.name",
      "cc": null,
      "bcc": null
    },
    "links": {
      "self": "http://api.lockstate.dev/access_instruction_guest_email_template/preview"
    }
  }
}

Schedules

Get all schedule types (homogeneous)

Endpoint

GET /schedules

Parameters

Name Description
type Filter by type(s). Supported types: auto_lock_schedule, lock_action_schedule, access_schedule, power_plug_schedule, and thermostat_schedule
sort Sortable attributes: created_at and name, default: created_at ascending

Request

Route

GET /schedules

Response

Status

200

Body

{
  "data": [
    {
      "type": "access_schedule",
      "attributes": {
        "name": "Eius officia dolorum eos consectetur.",
        "mon": [
          {
            "start_time": "09:00",
            "end_time": "17:00"
          }
        ],
        "tue": [
          {
            "start_time": "09:00",
            "end_time": "17:00"
          }
        ],
        "wed": [
          {
            "start_time": "09:00",
            "end_time": "17:00"
          }
        ],
        "thu": [
          {
            "start_time": "09:00",
            "end_time": "17:00"
          }
        ],
        "fri": [
          {
            "start_time": "09:00",
            "end_time": "15:00"
          }
        ],
        "sat": [
          {
            "start_time": "09:00",
            "end_time": "15:00"
          }
        ],
        "sun": [
          {
            "start_time": "09:00",
            "end_time": "15:00"
          }
        ],
        "created_at": "2018-08-29T18:26:03Z",
        "updated_at": "2018-08-29T18:26:03Z"
      },
      "id": "25fd0772-33d7-4744-b28c-4d39612d1fbe",
      "links": {
        "self": "http://api.lockstate.dev/schedules/25fd0772-33d7-4744-b28c-4d39612d1fbe"
      }
    },
    {
      "type": "auto_lock_schedule",
      "attributes": {
        "name": "A dolor fugit cupiditate reprehenderit molestiae non.",
        "mon": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "17:00",
            "enable": true
          }
        ],
        "tue": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "17:00",
            "enable": true
          }
        ],
        "wed": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "17:00",
            "enable": true
          }
        ],
        "thu": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "17:00",
            "enable": true
          }
        ],
        "fri": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "15:00",
            "enable": true
          }
        ],
        "sat": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "15:00",
            "enable": true
          }
        ],
        "sun": [
          {
            "time": "09:00",
            "enable": false
          },
          {
            "time": "15:00",
            "enable": true
          }
        ],
        "created_at": "2018-08-29T18:26:03Z",
        "updated_at": "2018-08-29T18:26:03Z"
      },
      "id": "09e636b6-4aff-4931-85c7-cdd744347792",
      "links": {
        "self": "http://api.lockstate.dev/schedules/09e636b6-4aff-4931-85c7-cdd744347792"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 2
  }
}

Get a schedule

Endpoint

GET /schedules/:id

Request

Route

GET /schedules/9c5fdd3e-754c-465c-bb80-505a5baf0c96

Response

Status

200

Body

{
  "data": {
    "type": "access_schedule",
    "attributes": {
      "name": "Ea repudiandae harum voluptatem.",
      "mon": [
        {
          "start_time": "09:00",
          "end_time": "17:00"
        }
      ],
      "tue": [
        {
          "start_time": "09:00",
          "end_time": "17:00"
        }
      ],
      "wed": [
        {
          "start_time": "09:00",
          "end_time": "17:00"
        }
      ],
      "thu": [
        {
          "start_time": "09:00",
          "end_time": "17:00"
        }
      ],
      "fri": [
        {
          "start_time": "09:00",
          "end_time": "15:00"
        }
      ],
      "sat": [
        {
          "start_time": "09:00",
          "end_time": "15:00"
        }
      ],
      "sun": [
        {
          "start_time": "09:00",
          "end_time": "15:00"
        }
      ],
      "created_at": "2018-08-29T18:26:03Z",
      "updated_at": "2018-08-29T18:26:03Z"
    },
    "id": "9c5fdd3e-754c-465c-bb80-505a5baf0c96",
    "links": {
      "self": "http://api.lockstate.dev/schedules/9c5fdd3e-754c-465c-bb80-505a5baf0c96"
    }
  }
}

Update a schedule

Parameters accepted: all used for create

Endpoint

PUT /schedules/:id

Request

Route

PUT /schedules/86019024-99ba-4e68-9b34-4b254667a445

Body

{
  "attributes": {
    "name": "New schedule name"
  }
}

Response

Status

200

Body

{
  "data": {
    "type": "access_schedule",
    "attributes": {
      "name": "New schedule name",
      "mon": [

      ],
      "tue": [

      ],
      "wed": [

      ],
      "thu": [

      ],
      "fri": [

      ],
      "sat": [

      ],
      "sun": [

      ],
      "created_at": "2018-08-29T18:26:04Z",
      "updated_at": "2018-08-29T18:26:04Z"
    },
    "id": "86019024-99ba-4e68-9b34-4b254667a445",
    "links": {
      "self": "http://api.lockstate.dev/schedules/86019024-99ba-4e68-9b34-4b254667a445"
    }
  }
}

Delete a schedule

Endpoint

DELETE /schedules/:id

Request

Route

DELETE /schedules/e5b5e859-07a8-4c0f-bb4a-811b5bf3d785

Response

Status

204

Create an access schedule

Endpoint

POST /schedules

Parameters

Name Description
type required access_schedule
attributes[name] required Schedule name
attributes[mon] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[tue] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[wed] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[thu] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[fri] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[sat] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[sun] [{ "start_time": "08:00", "end_time": "12:00" }, ...] or []
attributes[access_exception_id] Access Exception

Request

Route

POST /schedules

Body

{
  "type": "access_schedule",
  "attributes": {
    "name": "Work access schedule",
    "mon": [
      {
        "start_time": "08:00",
        "end_time": "12:00"
      },
      {
        "start_time": "13:00",
        "end_time": "18:00"
      }
    ],
    "wed": [
      {
        "start_time": "08:00",
        "end_time": "12:00"
      },
      {
        "start_time": "13:00",
        "end_time": "18:00"
      }
    ],
    "fri": [
      {
        "start_time": "08:00",
        "end_time": "12:00"
      },
      {
        "start_time": "13:00",
        "end_time": "18:00"
      }
    ],
    "access_exception_id": "61a09a76-39c6-4269-a3d3-acab14bf667e"
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "access_schedule",
    "attributes": {
      "name": "Work access schedule",
      "mon": [
        {
          "start_time": "08:00",
          "end_time": "12:00"
        },
        {
          "start_time": "13:00",
          "end_time": "18:00"
        }
      ],
      "tue": [

      ],
      "wed": [
        {
          "start_time": "08:00",
          "end_time": "12:00"
        },
        {
          "start_time": "13:00",
          "end_time": "18:00"
        }
      ],
      "thu": [

      ],
      "fri": [
        {
          "start_time": "08:00",
          "end_time": "12:00"
        },
        {
          "start_time": "13:00",
          "end_time": "18:00"
        }
      ],
      "sat": [

      ],
      "sun": [

      ],
      "created_at": "2018-08-29T18:26:04Z",
      "updated_at": "2018-08-29T18:26:04Z"
    },
    "id": "dc04d6c2-7a8a-402a-8ffc-4a3cf3c72db7",
    "links": {
      "self": "http://api.lockstate.dev/schedules/dc04d6c2-7a8a-402a-8ffc-4a3cf3c72db7"
    }
  }
}

Create an auto lock schedule

Endpoint

POST /schedules

Parameters

Name Description
type required auto_lock_schedule
attributes[name] required Schedule name
attributes[mon] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []
attributes[tue] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []
attributes[wed] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []
attributes[thu] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []
attributes[fri] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []
attributes[sat] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []
attributes[sun] [{ "time": "08:00", enable: false }, { "time": "18:00", enable: true }, ...] or []

Request

Route

POST /schedules

Body

{
  "type": "auto_lock_schedule",
  "attributes": {
    "name": "Switch auto-lock mode in working period",
    "mon": [
      {
        "time": "08:00",
        "enable": false
      },
      {
        "time": "18:00",
        "enable": true
      }
    ],
    "wed": [
      {
        "time": "08:00",
        "enable": false
      },
      {
        "time": "18:00",
        "enable": true
      }
    ],
    "fri": [
      {
        "time": "08:00",
        "enable": false
      },
      {
        "time": "18:00",
        "enable": true
      }
    ]
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "auto_lock_schedule",
    "attributes": {
      "name": "Switch auto-lock mode in working period",
      "mon": [
        {
          "time": "08:00",
          "enable": false
        },
        {
          "time": "18:00",
          "enable": true
        }
      ],
      "tue": [

      ],
      "wed": [
        {
          "time": "08:00",
          "enable": false
        },
        {
          "time": "18:00",
          "enable": true
        }
      ],
      "thu": [

      ],
      "fri": [
        {
          "time": "08:00",
          "enable": false
        },
        {
          "time": "18:00",
          "enable": true
        }
      ],
      "sat": [

      ],
      "sun": [

      ],
      "created_at": "2018-08-29T18:26:04Z",
      "updated_at": "2018-08-29T18:26:04Z"
    },
    "id": "2a733349-784e-467f-ad9f-addd46e66762",
    "links": {
      "self": "http://api.lockstate.dev/schedules/2a733349-784e-467f-ad9f-addd46e66762"
    }
  }
}

Create a lock action schedule

Endpoint

POST /schedules

Parameters

Name Description
type required lock_action_schedule
attributes[name] required Schedule name
attributes[mon] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []
attributes[tue] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []
attributes[wed] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []
attributes[thu] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []
attributes[fri] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []
attributes[sat] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []
attributes[sun] [{ "time": "08:00", action: "unlock" }, { "time": "18:00", action: "lock" }, ...] or []

Request

Route

POST /schedules

Body

{
  "type": "lock_action_schedule",
  "attributes": {
    "name": "Automatically unlock and lock",
    "mon": [
      {
        "time": "08:00",
        "action": "unlock"
      },
      {
        "time": "18:00",
        "action": "lock"
      }
    ],
    "wed": [
      {
        "time": "08:00",
        "action": "unlock"
      },
      {
        "time": "18:00",
        "action": "lock"
      }
    ],
    "fri": [
      {
        "time": "08:00",
        "action": "unlock"
      },
      {
        "time": "18:00",
        "action": "lock"
      }
    ]
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "lock_action_schedule",
    "attributes": {
      "name": "Automatically unlock and lock",
      "mon": [
        {
          "time": "08:00",
          "action": "unlock"
        },
        {
          "time": "18:00",
          "action": "lock"
        }
      ],
      "tue": [

      ],
      "wed": [
        {
          "time": "08:00",
          "action": "unlock"
        },
        {
          "time": "18:00",
          "action": "lock"
        }
      ],
      "thu": [

      ],
      "fri": [
        {
          "time": "08:00",
          "action": "unlock"
        },
        {
          "time": "18:00",
          "action": "lock"
        }
      ],
      "sat": [

      ],
      "sun": [

      ],
      "created_at": "2018-08-29T18:26:04Z",
      "updated_at": "2018-08-29T18:26:04Z"
    },
    "id": "37fc5382-b7ab-431d-b0fd-6cf88b1a7bf9",
    "links": {
      "self": "http://api.lockstate.dev/schedules/37fc5382-b7ab-431d-b0fd-6cf88b1a7bf9"
    }
  }
}

Create a power plug schedule

Endpoint

POST /schedules

Parameters

Name Description
type required power_plug_schedule
attributes[name] required Schedule name
attributes[mon] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []
attributes[tue] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []
attributes[wed] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []
attributes[thu] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []
attributes[fri] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []
attributes[sat] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []
attributes[sun] [{ "time": "08:00", action: "on" }, { "time": "18:00", action: "off" }, ...] or []

Request

Route

POST /schedules

Body

{
  "type": "power_plug_schedule",
  "attributes": {
    "name": "Automatically turn on and off",
    "mon": [
      {
        "time": "08:00",
        "action": "on"
      },
      {
        "time": "18:00",
        "action": "off"
      }
    ],
    "wed": [
      {
        "time": "08:00",
        "action": "on"
      },
      {
        "time": "18:00",
        "action": "off"
      }
    ],
    "fri": [
      {
        "time": "08:00",
        "action": "on"
      },
      {
        "time": "18:00",
        "action": "off"
      }
    ]
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "power_plug_schedule",
    "attributes": {
      "name": "Automatically turn on and off",
      "mon": [
        {
          "time": "08:00",
          "action": "on"
        },
        {
          "time": "18:00",
          "action": "off"
        }
      ],
      "tue": [

      ],
      "wed": [
        {
          "time": "08:00",
          "action": "on"
        },
        {
          "time": "18:00",
          "action": "off"
        }
      ],
      "thu": [

      ],
      "fri": [
        {
          "time": "08:00",
          "action": "on"
        },
        {
          "time": "18:00",
          "action": "off"
        }
      ],
      "sat": [

      ],
      "sun": [

      ],
      "created_at": "2018-08-29T18:26:05Z",
      "updated_at": "2018-08-29T18:26:05Z"
    },
    "id": "de961c54-939f-4dab-b866-b6ffa12837fb",
    "links": {
      "self": "http://api.lockstate.dev/schedules/de961c54-939f-4dab-b866-b6ffa12837fb"
    }
  }
}

Create a thermostat schedule

Endpoint

POST /schedules

Parameters

Name Description
type required thermostat_schedule
attributes[name] required Schedule name
attributes[mon] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]
attributes[tue] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]
attributes[wed] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]
attributes[thu] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]
attributes[fri] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]
attributes[sat] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]
attributes[sun] [{ "time": "08:00", "cool": 40, "heat": 80 }, ...]

Request

Route

POST /schedules

Body

{
  "type": "thermostat_schedule",
  "attributes": {
    "name": "Changes thermostat cool/heat temperatures",
    "mon": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ],
    "tue": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ],
    "wed": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ],
    "thu": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ],
    "fri": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ],
    "sat": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ],
    "sun": [
      {
        "time": "08:00",
        "cool": 60,
        "heat": 70
      },
      {
        "time": "18:00",
        "cool": 40,
        "heat": 80
      }
    ]
  }
}

Response

Status

201

Body

{
  "data": {
    "type": "thermostat_schedule",
    "attributes": {
      "name": "Changes thermostat cool/heat temperatures",
      "mon": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "tue": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "wed": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "thu": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "fri": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "sat": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "sun": [
        {
          "time": "08:00",
          "cool": 60,
          "heat": 70
        },
        {
          "time": "18:00",
          "cool": 40,
          "heat": 80
        }
      ],
      "created_at": "2018-08-29T18:26:05Z",
      "updated_at": "2018-08-29T18:26:05Z"
    },
    "id": "2193ef06-fc54-448e-bdb9-4f0728e0adb5",
    "links": {
      "self": "http://api.lockstate.dev/schedules/2193ef06-fc54-448e-bdb9-4f0728e0adb5"
    }
  }
}

Users

Get signed in user

Endpoint

GET /user

Request

Route

GET /user

Response

Status

200

Body

{
  "data": {
    "type": "user",
    "attributes": {
      "name": "Abigail Metz",
      "email": "eve_schmeler@abbottabshire.io",
      "handle": "eve_schmeler",
      "created_at": "2018-08-29T18:26:39Z",
      "updated_at": "2018-08-29T18:26:39Z",
      "primary_account_id": "a73c66c7-4961-4139-a8c0-4222a4e4f7e2",
      "default_account_id": "a73c66c7-4961-4139-a8c0-4222a4e4f7e2"
    },
    "id": "f2bc8a20-46ea-4a9f-bc09-593f6c6bb912",
    "links": {
      "self": "http://api.lockstate.dev/user",
      "primary_account": "http://api.lockstate.dev/account",
      "default_account": "http://api.lockstate.dev/account"
    }
  }
}