Skip to main content

Mason Platform APIs Docs (1.0)

Download OpenAPI specification:Download

The Mason Platform API is a series of REST routes that enable customers to perform operations against their fleet of devices and artifacts.

Endpoints

All endpoints are hosted on https://api.bymason.com/v1.

Authentication

All endpoints require authentication. Authentication is specified using API Keys. To use an API Key, set the Authorization header in your request to basic <api-key>. The full header should look as follows:

Authorization: basic <api-key>

To use an API Key against an endpoint, it needs to have the proper scope.

Scopes

Every user and API key has an associated list of scopes. A scope enables a level of access to APIs for the request send by the user or API key. Each endpoint will validate the incoming request has the required scope before processing the request. The scope hierarchy is shown below with a description of each scope. See the support article about Mason Scopes for more details.

  • account:owner: Full permissions for the account
    • fleet:admin: Grants administrator control over devices and groups
      • fleet:manager: Grants control over devices and groups
        • fleet:deploy: Grants control over deploying to groups
        • fleet:move: Grants control over moving devices between groups
        • fleet:read: Grants read access on devices and groups
      • fleet:locate: Grants access to devices location data
      • notify:all: Grants send notifications for all notification types
        • notify:refresh: Grants send notifications to heartbeat
        • notify:check: Grants send notifications to check for updates
        • notify:reboot: Grants send notifications to reboot devices
        • notify:shutdown: Grants send notifications to shutdown devices
        • notify:wipe: Grants send notifications to wipe devices
        • notify:application: Grants send notifications to user-applications on devices
        • notify:refurbish: Grants send notifications to refurbish devices
    • xray:admin: Grants full use of Xray features
    • user:admin: Grants administrator control over users
      • user:read: Grants read access to users
    • registry:admin: Grants administrator control over the artifact registry
      • registry:read: Grants read access to the artifact registry
    • connect:admin: Grants administrator control over SIMs
      • connect:read: Grants read access to SIMs

Pagination

Many of the platform APIs contain paginated results. All pagination follow a standard token-based pattern. Results are always stored in the data value as a list. If there is a next page, the token is stored in the nextPage value. If there is a previous page, the token is stored in the prevPage value.

To request the next or previous page, send a subsequent request with the next or previous token as the after or before query parameter.

Below is a sample JSON response from the paginated devices endpoint:

https://api.bymason.com/device
{
  "data": [{...}],
  "prevPage": "cHJldmlvdXMgcGFnaW5hdGlvbiB0b2tlbgo=",
  "nextPage": "bmV4dCBwYWdpbmF0aW9uIHRva2VuCg=="
}

Given the above response, you can query the next page by setting the after query parameter with the nextPage token:

https://api.bymason.com/device?after=bmV4dCBwYWdpbmF0aW9uIHRva2VuCg==
{
  "data": [{...}],
  "prevPage": "cHJldmlvdXMgcGFnaW5hdGlvbiB0b2tlbgo=",
  "nextPage": "bmV4dCBwYWdpbmF0aW9uIHRva2VuCg=="
}

Status Codes

The Mason API will return one of the following status codes for each request.

Status Code Description
200 The request succeeded.
400 The request was malformed. Details will be in the error context.
401 The request had an invalid or missing API key.
403 The API key does not have the proper scope for the endpoint.
404 The requested resource does not exist.
500 Internal server error.

Errors

The Mason API uses a standard JSON body for all non-2XX status codes to represent errors. The body of the error response will follow the format:

{
  "type": "<error-type-category>",
  "context": "<error-message>"
}

An example error message for an Unauthorized error will look like:

{
  "type": "forbidden",
  "context": "The user does not have permission to take the desired action"
}

Timestamps

All timestamps used in the platform APIs are formatted using RFC3339, unless specified otherwise.

Devices

The Devices API endpoints enable you to monitor your fleet of devices.

List devices

Fetches a page of devices registered with your account.

Authorizations:
APIKeyAuth
query Parameters
limit
integer >= 1
Default: 100

Limits the number of items in a page of results

before
string

Request the previous page of results

after
string

Request the next page of results

orderByCol
string
Enum: "createdAt" "lastHeartbeat"

Column to sort the results

orderDir
string
Default: "asc"
Enum: "asc" "desc"

Direction to order the results (i.e., ascending or descending)

searchType
string
Enum: "partial" "exact"

Type of search to perform. If not provided, the search parameters will be ignored and all results returned.

searchQuery
string

Query to use for search

type
string
Enum: "all" "imei" "serial" "name"

Field to apply the search query to

deviceGroup
string

Filter results based on the Deployment Group name

appsUpdated
boolean
Enum: true false

Filter results based on whether the device's apps are updated

osUpdated
boolean
Enum: true false

Filter results based on whether the device's OS is updated

projectUpdated
boolean
Enum: true false

Filter results based on whether the device's project is updated

maxBatteryPercent
number

Filter results based on the max, last known, battery percentage of the device

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "nextPage": "eyJwIjoiZXlKelkyRnVTVzVrWlhoR2IzSjNZWEprSWpwdWRXeHNMQ0pzWVhOMFJYWmhiSFZoZEdWa1MyVjVJanB1ZFd4c0xDSnNhVzFwZENJNmJuVnNiSDBLIiwibCI6MTAwfQ==",
  • "prevPage": "eyJuIjoiZXlKUVlXZHBibUYwYVc5dUlqcDdJbXhwYldsMElqb3hMQ0p2Wm1aelpYUWlPakY5ZlFvPSIsImwiOjF9"
}

Read device

Fetches a device registered with your account by its unique id.

Authorizations:
APIKeyAuth
path Parameters
id
required
string <uuid>

Device ID

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Update device

Updates device attributes

Authorizations:
APIKeyAuth
path Parameters
id
required
string <uuid>

Device ID

Request Body schema: application/json
name
string

Device name

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "self": "string",
  • "name": "Store 123 Device #2",
  • "imei": "615022756680303",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "family": "D03",
  • "lastcheckin": "2019-08-24T14:15:22Z",
  • "group": {
    },
  • "battery": {
    },
  • "serialnumber": "21BC01CF8DFF",
  • "connection": {
    },
  • "os": {
    },
  • "apps": [
    ]
}

Move Devices

Move devices from one group to another. If the new group has artifacts deployed to it, the device will automatically update to install the new artifacts. If the new group has a different config or the same config on a lower version, the device will perform a Wipe Action.

The move will only succeed if every device listed is of the same device type + API level and the target group is locked to the same device type + API level. A group will be locked to a device type and API level once a project is deployed or a device is moved into the group.

Authorizations:
APIKeyAuth
path Parameters
name
required
string

Group name

query Parameters
validateonly
boolean

Validate whether the move can be done or not, but do not perform the move

Responses

Response samples

Content type
application/json
{
  • "willUpdate": true,
  • "willWipe": true,
  • "emptyGroup": true,
  • "newProject": "string",
  • "newVersion": "string"
}

Device Actions

The Actions API endpoints enable you to send commands to your fleet of devices. Each action is queued to the device. The device processes it's queue of actions when it is online and has an internet connection. If the device is online when the action is sent, it will process the action immediately.

Send a Broadcast Action

Sends a Broadcast Action to a list of devices. A Broadcast is a mechanism to deliver a command to your Android application.

As a best practice, you should never send sensitive data over a broadcast. If you have sensitive data, it's best to send an identifier to your storage over the broadcast, or to encrypt the data.

Authorizations:
APIKeyAuth
Request Body schema: application/json
devices
Array of strings <= 500 items

List of device ids to send the Command to

targetApps
Array of arrays

List of applications to receive the Command on you devices

command
string

Command to send to the applications

args
Array of strings

A list of arguments to send with the Command

Responses

Request samples

Content type
application/json
{
  • "devices": [
    ],
  • "targetApps": [ ],
  • "command": "string",
  • "args": [
    ]
}

Response samples

Content type
application/json
{
  • "type": "string",
  • "context": "string"
}

Send a Refresh Action

Sends a Refresh Action to a list of devices. A Refresh Action tells the device to report it's latest state to the platform. The state includes installed artifacts, networked devices, etc.

Authorizations:
APIKeyAuth
Request Body schema: application/json
devices
Array of strings <= 500 items

List of device ids to send an Action to

Responses

Request samples

Content type
application/json
{
  • "devices": [
    ]
}

Response samples

Content type
application/json
{
  • "type": "string",
  • "context": "string"
}

Send an Update Check Action

Sends an Update Check Action to a list of devices. An Update Check Action tells the device to check in to the platform to get any updates. Updates are any artifacts deployed to the devices group, including Mason OS, project builds, and apps. If the device is out of date for any artifact, it will install the latest deployed version.

Authorizations:
APIKeyAuth
Request Body schema: application/json
devices
Array of strings <= 500 items

List of device ids to send an Action to

Responses

Request samples

Content type
application/json
{
  • "devices": [
    ]
}

Response samples

Content type
application/json
{
  • "type": "string",
  • "context": "string"
}

Send a Reboot Action

Sends a Reboot Action to a list of devices. A Reboot Action will power off and then power on the device.

Authorizations:
APIKeyAuth
Request Body schema: application/json
devices
Array of strings <= 500 items

List of device ids to send an Action to

Responses

Request samples

Content type
application/json
{
  • "devices": [
    ]
}

Response samples

Content type
application/json
{
  • "type": "string",
  • "context": "string"
}

Send a Shutdown Action

Sends a Shutdown Action to a list of devices. A Shutdown Action will power off the device.

Authorizations:
APIKeyAuth
Request Body schema: application/json
devices
Array of strings <= 500 items

List of device ids to send an Action to

Responses

Request samples

Content type
application/json
{
  • "devices": [
    ]
}

Response samples

Content type
application/json
{
  • "type": "string",
  • "context": "string"
}

Send a Wipe Action

Sends a Wipe Action to a list of devices. A Wipe Action will perform a factory reset on the device. A factory reset will delete app-specific data and settings on the device, but will preserve the deployed project and configuration.

Authorizations:
APIKeyAuth
Request Body schema: application/json
devices
Array of strings <= 500 items

List of device ids to send an Action to

Responses

Request samples

Content type
application/json
{
  • "devices": [
    ]
}

Response samples

Content type
application/json
{
  • "type": "string",
  • "context": "string"
}

Projects

The Project API endpoints enable you to view and manage your Mason projects. A Project is a collection of apps and configuration that can be deployed to a device.

List projects

Fetches a list of projects.

Authorizations:
APIKeyAuth
query Parameters
name
string

Project Name

before
string

Request the previous page of results

after
string

Request the next page of results

limit
integer >= 1
Default: 100

Limits the number of items in a page of results

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "nextPage": "eyJwIjoiZXlKelkyRnVTVzVrWlhoR2IzSjNZWEprSWpwdWRXeHNMQ0pzWVhOMFJYWmhiSFZoZEdWa1MyVjVJanB1ZFd4c0xDSnNhVzFwZENJNmJuVnNiSDBLIiwibCI6MTAwfQ==",
  • "prevPage": "eyJuIjoiZXlKUVlXZHBibUYwYVc5dUlqcDdJbXhwYldsMElqb3hMQ0p2Wm1aelpYUWlPakY5ZlFvPSIsImwiOjF9"
}

Create project

Creates a project.

Authorizations:
APIKeyAuth
Request Body schema: application/json
name
string [ 1 .. 500 ] characters ^[a-zA-Z0-9_\-]+$

Unique name of project

description
string [ 1 .. 10000 ] characters

Description of project

deviceFamily
string (DeviceFamily)
Enum: "D03" "F07" "D450" "D450A" "D450A1" "D450B" "C210" "F210" "F450" "G430" "G450" "I3399A" "A4100" "D215"
apiLevel
integer (APILevel)
Enum: 23 25 27 30

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "createdAt": "string",
  • "updatedAt": "string"
}

Read project

Fetches project details.

Authorizations:
APIKeyAuth
path Parameters
id
required
string <uuid>

Project ID

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "createdAt": "string",
  • "updatedAt": "string"
}

Update project

Updates project details.

Authorizations:
APIKeyAuth
path Parameters
id
required
string <uuid>

Project ID

Request Body schema: application/json
description
string [ 1 .. 10000 ] characters

Description of project

Responses

Request samples

Content type
application/json
{
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "createdAt": "string",
  • "updatedAt": "string"
}

Deployment Groups

The Deployment Groups API endpoints enable you to view and manage your groups of devices. A Deployment Group is a mechanism to deploy artifacts in bulk to devices. Each Group is locked to a specific Android API level and Mason device type. This allows you to move devices into a Deployment Group that should have the same Mason OS, Project, and Apps. Devices will auto-update their artifacts based on the Deployment Group they are in and the artifacts deployed to that group.

List deployment groups

Fetches a page of groups in your account.

Authorizations:
APIKeyAuth
query Parameters
limit
integer >= 1
Default: 100

Limits the number of items in a page of results

before
string

Request the previous page of results

after
string

Request the next page of results

name
string

Group name

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "nextPage": "eyJwIjoiZXlKelkyRnVTVzVrWlhoR2IzSjNZWEprSWpwdWRXeHNMQ0pzWVhOMFJYWmhiSFZoZEdWa1MyVjVJanB1ZFd4c0xDSnNhVzFwZENJNmJuVnNiSDBLIiwibCI6MTAwfQ==",
  • "prevPage": "eyJuIjoiZXlKUVlXZHBibUYwYVc5dUlqcDdJbXhwYldsMElqb3hMQ0p2Wm1aelpYUWlPakY5ZlFvPSIsImwiOjF9"
}

Create deployment group

Creates a deployment group

Authorizations:
APIKeyAuth

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "deviceCount": 100,
  • "devicesUpToDateCount": 86,
  • "apps": [
    ],
  • "config": {
    },
  • "os": {
    }
}

Read deployment group

Fetches a deployment group by its unique name.

Authorizations:
APIKeyAuth
path Parameters
group-id
required
string <uuid>

Group id

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "deviceCount": 100,
  • "devicesUpToDateCount": 86,
  • "apps": [
    ],
  • "config": {
    },
  • "os": {
    }
}

Update deployment group

Updates a deployment group.

Authorizations:
APIKeyAuth
path Parameters
group-id
required
string <uuid>

Group id

Request Body schema: application/json
description
string (GroupDescription) [ 1 .. 300 ] characters

Description for the Deployment Group.

Responses

Request samples

Content type
application/json
{
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "deviceCount": 100,
  • "devicesUpToDateCount": 86,
  • "apps": [
    ],
  • "config": {
    },
  • "os": {
    }
}

Delete deployment group

Deletes a deployment group. This operation is not allowed when there are any devices in the group. The group named unassigned is a special group that can not be deleted.

Authorizations:
APIKeyAuth
path Parameters
group-id
required
string <uuid>

Group id

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}

Deployments

The Deployment API endpoints enable you to view and manage the artifacts deployed to your Deployment Groups. An artifact is either a Mason OS version, project build, or an app.

Create a deployment

Creates a new deployment.

Authorizations:
APIKeyAuth
Request Body schema: application/json
groupId
required
string

The unique id for the deployment group receiving the deployment.

name
required
string

The name of the artifact being deployed.

version
required
string

The version of the artifact being deployed.

type
required
string (ArtifactDeploymentType)
Enum: "ota" "config" "apk"
push
boolean
Default: false

If true, all devices in your deployment group will be notified of an update. Once the device is notified, it will apply the update. If false, the device will apply the update over the next 24 hours.

deployInsecure
boolean
Default: false

If true, the device will download the deployment over http. If false, the device will download the deployment over https.

Responses

Request samples

Content type
application/json
{
  • "groupId": "string",
  • "name": "string",
  • "version": "string",
  • "type": "ota",
  • "push": false,
  • "deployInsecure": false
}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "artifact": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "groupId": "eb54e96e-21b8-4f54-9cd4-80fccbd06f55",
  • "deployInsecure": false,
  • "isActive": true
}

List deployments

Fetches a page of deployments.

Authorizations:
APIKeyAuth
query Parameters
limit
integer >= 1
Default: 100

Limits the number of items in a page of results

before
string

Request the previous page of results

after
string

Request the next page of results

name
string

The name of the deployed artifact

type
string (ArtifactDeploymentType)
Enum: "ota" "config" "apk"

The type of the deployed artifact

version
string

The version of the deployed artifact

groupId
string

The group id of the deployed artifact

isActive
boolean

Whether the deployment is active or not

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "nextPage": "eyJwIjoiZXlKelkyRnVTVzVrWlhoR2IzSjNZWEprSWpwdWRXeHNMQ0pzWVhOMFJYWmhiSFZoZEdWa1MyVjVJanB1ZFd4c0xDSnNhVzFwZENJNmJuVnNiSDBLIiwibCI6MTAwfQ==",
  • "prevPage": "eyJuIjoiZXlKUVlXZHBibUYwYVc5dUlqcDdJbXhwYldsMElqb3hMQ0p2Wm1aelpYUWlPakY5ZlFvPSIsImwiOjF9"
}

Read deployment

Fetches a deployment by its unique id.

Authorizations:
APIKeyAuth
path Parameters
deployment-id
required
string

Deployment id

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "artifact": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "groupId": "eb54e96e-21b8-4f54-9cd4-80fccbd06f55",
  • "deployInsecure": false,
  • "isActive": true
}

Device

A Device is any Android based phone or tablet running Mason OS.

id
string <uuid>

Unique identifier for the device

self
string

Reference to this device

name
string

Device name

imei
string

International mobile equipment identity

createdAt
string <date-time>

Date device was added to the Mason account

family
string (DeviceFamily)
Enum: "D03" "F07" "D450" "D450A" "D450A1" "D450B" "C210" "F210" "F450" "G430" "G450" "I3399A" "A4100" "D215"
lastcheckin
string <date-time>

Timestamp for the last time the device reported a heartbeat to the platform

object

Device group the device currently belongs to

object

Battery properties

serialnumber
string

Serial number of the device

object (Connection)

Information on networked devices

object

Version codes describing which Mason OS is running

Array of objects (DeviceApps)

Apps deployed to the device via a Deployment Group

{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "self": "string",
  • "name": "Store 123 Device #2",
  • "imei": "615022756680303",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "family": "D03",
  • "lastcheckin": "2019-08-24T14:15:22Z",
  • "group": {
    },
  • "battery": {
    },
  • "serialnumber": "21BC01CF8DFF",
  • "connection": {
    },
  • "os": {
    },
  • "apps": [
    ]
}

Project

A Project is a collection of apps and configuration that can be deployed to a device.

id
string

Unique ID of project

name
string

Name of project

description
string

Description of project

deviceFamily
string (DeviceFamily)
Enum: "D03" "F07" "D450" "D450A" "D450A1" "D450B" "C210" "F210" "F450" "G430" "G450" "I3399A" "A4100" "D215"
apiLevel
integer (APILevel)
Enum: 23 25 27 30
createdAt
string <RFC3339>

Timestamp of when the project was created

updatedAt
string <RFC3339>

Timestamp of when the project was last updated

{
  • "id": "string",
  • "name": "string",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "createdAt": "string",
  • "updatedAt": "string"
}

Deployment Group

A Deployment Group is a group of devices configured to run specific artifacts. Each Deployment Group has deployed artifacts which it propogates to every device that belongs in the group. An artifact is either a Mason OS version, project configuration, or an app.

id
required
string <uuid>

unique ID for the group

name
required
string

Group name

createdAt
required
string <date-time>

Date group was created

updatedAt
required
string <date-time>

Date group was last updated

description
string

Description of the group

deviceFamily
string (DeviceFamily)
Enum: "D03" "F07" "D450" "D450A" "D450A1" "D450B" "C210" "F210" "F450" "G430" "G450" "I3399A" "A4100" "D215"
apiLevel
integer (APILevel)
Enum: 23 25 27 30
deviceCount
required
integer

Number of devices currently in the group

devicesUpToDateCount
integer

Of the devices in the group, indicates how many are running all the desired deployment versions

Array of objects

Details of each app (APK) deployed to the group

object

Details of the configuration deployed to the group

object

Details of the OS deployed to the group

{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "description": "string",
  • "deviceFamily": "D03",
  • "apiLevel": 23,
  • "deviceCount": 100,
  • "devicesUpToDateCount": 86,
  • "apps": [
    ],
  • "config": {
    },
  • "os": {
    }
}

Deployment

id
string <uuid>

Unique identifier for the deployment

object (DeployedArtifact)

The artifact deployed to a group

createdAt
string <date-time>

Timestamp for when the deployment was created

updatedAt
string <date-time>

Timestamp for when the deployment was created

groupId
string <uuid>

The group id the deployment belongs to

deployInsecure
boolean
Default: false

Set to true for devices to download the update over http

isActive
boolean

Whether the deployment is active or not

{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "artifact": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z",
  • "groupId": "eb54e96e-21b8-4f54-9cd4-80fccbd06f55",
  • "deployInsecure": false,
  • "isActive": true
}