Schemas

API Token

Schema for a single API Token

API Token Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "apiTokenId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "ownerId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "ownerType": {
      "type": "string",
      "enum": [
        "application"
      ]
    },
    "creatorId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creatorType": {
      "type": "string",
      "enum": [
        "apiToken",
        "user",
        "flow"
      ]
    },
    "creatorName": {
      "type": "string",
      "maxLength": 1024
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "expirationDate": {
      "type": "string",
      "format": "date-time"
    },
    "scope": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1024
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    },
    "token": {
      "type": "string",
      "minLength": 1
    }
  }
}

API Token Example

{
  "id": "575ec7417ae143cd83dc4a95",
  "apiTokenId": "575ec7417ae143cd83dc4a95",
  "creatorId": "575ed70c7ae143cd83dc4aa9",
  "creatorType": "user",
  "ownerId": "575ec8687ae143cd83dc4a97",
  "ownerType": "application",
  "name": "My API Token",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "expirationDate": "2017-06-13T04:00:00.000Z",
  "scope": [
    "all.Application"
  ],
  "status": "active",
  "token": "the_actual_token_string"
}

API Token Patch

Schema for the body of an API Token modification request

API Token Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    }
  },
  "additionalProperties": false
}

API Token Patch Example

{
  "name": "My Updated API Token",
  "status": "inactive"
}

API Tokens

Schema for a collection of API Tokens

API Tokens Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "API Token",
        "description": "Schema for a single API Token",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "apiTokenId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "ownerId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "application"
            ]
          },
          "creatorId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creatorType": {
            "type": "string",
            "enum": [
              "apiToken",
              "user",
              "flow"
            ]
          },
          "creatorName": {
            "type": "string",
            "maxLength": 1024
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastUpdated": {
            "type": "string",
            "format": "date-time"
          },
          "expirationDate": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ]
          },
          "token": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "filter": {
      "type": "string"
    },
    "filterField": {
      "type": "string"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "ownerId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "ownerType": {
      "type": "string",
      "enum": [
        "application"
      ]
    }
  }
}

API Tokens Example

{
  "items": [
    {
      "id": "575ec7417ae143cd83dc4a95",
      "apiTokenId": "575ec7417ae143cd83dc4a95",
      "creatorId": "575ed70c7ae143cd83dc4aa9",
      "creatorType": "user",
      "ownerId": "575ec8687ae143cd83dc4a97",
      "ownerType": "application",
      "name": "My API Token",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "expirationDate": "2017-06-13T04:00:00.000Z",
      "scope": [
        "all.Application"
      ],
      "status": "active",
      "token": "the_actual_token_string"
    }
  ],
  "count": 1,
  "totalCount": 4,
  "perPage": 1,
  "page": 0,
  "sortField": "name",
  "sortDirection": "asc",
  "ownerId": "575ec8687ae143cd83dc4a97",
  "ownerType": "application"
}

Application

Schema for a single Application

Application Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "ownerId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "ownerType": {
      "type": "string",
      "enum": [
        "user",
        "organization"
      ]
    },
    "organizationName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "organizationIconColor": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "endpointSlug": {
      "type": "string",
      "minLength": 4,
      "maxLength": 63,
      "pattern": "^[0-9a-z-]*$"
    },
    "expUserTokenCutoff": {
      "type": "string",
      "format": "date-time"
    },
    "endpointDefaultCors": {
      "type": "boolean"
    },
    "globals": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "json": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32767
          },
          "cloudOnly": {
            "type": "boolean",
            "default": false
          }
        },
        "additionalProperties": false,
        "required": [
          "key",
          "json"
        ]
      }
    },
    "summary": {
      "type": "object",
      "properties": {
        "apiTokenCount": {
          "type": "number"
        },
        "dataTableCount": {
          "type": "number"
        },
        "deviceCount": {
          "type": "number"
        },
        "deviceRecipeCount": {
          "type": "number"
        },
        "eventCount": {
          "type": "number"
        },
        "experienceDomainCount": {
          "type": "number"
        },
        "experienceEndpointCount": {
          "type": "number"
        },
        "experienceGroupCount": {
          "type": "number"
        },
        "experienceSlugCount": {
          "type": "number"
        },
        "experienceUserCount": {
          "type": "number"
        },
        "experienceVersionCount": {
          "type": "number"
        },
        "experienceViewCount": {
          "type": "number"
        },
        "fileCount": {
          "type": "number"
        },
        "flowCount": {
          "type": "number"
        },
        "integrationCount": {
          "type": "number"
        },
        "keyCount": {
          "type": "number"
        },
        "storageStats": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "size": {
              "type": "number"
            }
          }
        },
        "webhookCount": {
          "type": "number"
        }
      }
    },
    "ftueTracking": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "version": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "skipped",
              "completed"
            ]
          }
        },
        "required": [
          "name",
          "version",
          "status"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "archiveConfig": {
      "type": "object",
      "properties": {
        "directory": {
          "type": "string",
          "max": 255
        },
        "mode": {
          "type": "string",
          "enum": [
            "all",
            "whitelist",
            "blacklist"
          ]
        },
        "deviceIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "maxItems": 1000
        },
        "deviceTags": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "pattern": "^[0-9a-zA-Z_-]{1,255}$"
              },
              "value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            },
            "additionalProperties": false
          },
          "maxItems": 100
        },
        "s3": {
          "type": "object",
          "properties": {
            "bucket": {
              "type": "string",
              "max": 255
            },
            "accessKeyId": {
              "type": "string",
              "min": 16,
              "max": 128
            },
            "secretAccessKey": {
              "type": "string",
              "min": 16,
              "max": 128
            },
            "region": {
              "type": "string",
              "max": 128
            }
          },
          "required": [
            "bucket",
            "accessKeyId",
            "secretAccessKey",
            "region"
          ],
          "additionalProperties": false
        },
        "gcs": {
          "type": "object",
          "properties": {
            "projectId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "keyJson": {
              "type": "string",
              "maxLength": 32767,
              "minLength": 50
            },
            "bucket": {
              "type": "string",
              "max": 255
            }
          },
          "required": [
            "projectId",
            "keyJson",
            "bucket"
          ],
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  }
}

Application Example

{
  "id": "575ec8687ae143cd83dc4a97",
  "applicationId": "575ec8687ae143cd83dc4a97",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "ownerId": "575ed70c7ae143cd83dc4aa9",
  "ownerType": "user",
  "name": "My Application",
  "description": "The is the best application description",
  "summary": {
    "deviceCount": 5,
    "flowCount": 2,
    "webhookCount": 0,
    "eventCount": 0,
    "keyCount": 1,
    "deviceRecipeCount": 0
  },
  "archiveConfig": {
    "s3": {
      "bucket": "bucketName",
      "accessKeyId": "awsAccessKey",
      "accessSecretKey": "awsSecretKey",
      "region": "us-west-1"
    },
    "mode": "all",
    "deviceIds": [
      "575ec8687ae143cd83dc4a95",
      "575ec8687ae143cd83dc4a91"
    ]
  }
}

Application API Token Post

Schema for the body of an Application API Token creation request

Application API Token Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "expirationDate": {
      "type": "string",
      "format": "date-time"
    },
    "scope": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "all.Application",
          "all.Application.read",
          "all.Device",
          "all.Device.read",
          "application.*",
          "applicationApiToken.*",
          "applicationApiTokens.*",
          "applicationKey.*",
          "applicationKeys.*",
          "data.*",
          "dataTable.*",
          "dataTables.*",
          "dataTableRow.*",
          "dataTableRows.*",
          "device.*",
          "deviceRecipe.*",
          "deviceRecipes.*",
          "devices.*",
          "edgeDeployments.*",
          "event.*",
          "events.*",
          "experience.*",
          "experienceDomain.*",
          "experienceDomains.*",
          "experienceEndpoint.*",
          "experienceEndpoints.*",
          "experienceGroup.*",
          "experienceGroups.*",
          "experienceSlug.*",
          "experienceSlugs.*",
          "experienceUser.*",
          "experienceUsers.*",
          "experienceVersion.*",
          "experienceVersions.*",
          "experienceView.*",
          "experienceViews.*",
          "integration.*",
          "integrations.*",
          "file.*",
          "files.*",
          "flow.*",
          "flows.*",
          "flowVersion.*",
          "flowVersions.*",
          "notebook.*",
          "notebooks.*",
          "webhook.*",
          "webhooks.*",
          "application.archiveData",
          "application.backfillArchiveData",
          "application.debug",
          "application.delete",
          "application.get",
          "application.mqttPublishMessage",
          "application.mqttSubscriptionStream",
          "application.patch",
          "application.payloadCounts",
          "application.search",
          "applicationApiToken.delete",
          "applicationApiToken.get",
          "applicationApiToken.patch",
          "applicationApiTokens.get",
          "applicationApiTokens.post",
          "applicationKey.delete",
          "applicationKey.get",
          "applicationKey.patch",
          "applicationKeys.get",
          "applicationKeys.post",
          "data.export",
          "data.lastValueQuery",
          "data.timeSeriesQuery",
          "dataTable.addColumn",
          "dataTable.delete",
          "dataTable.get",
          "dataTable.patch",
          "dataTable.removeColumn",
          "dataTableRow.delete",
          "dataTableRow.get",
          "dataTableRow.patch",
          "dataTableRows.get",
          "dataTableRows.post",
          "dataTableRows.query",
          "dataTableRows.export",
          "dataTableRows.delete",
          "dataTableRows.truncate",
          "dataTables.get",
          "dataTables.post",
          "device.commandStream",
          "device.debug",
          "device.delete",
          "device.export",
          "device.get",
          "device.getCommand",
          "device.getCompositeState",
          "device.getLogEntries",
          "device.getState",
          "device.patch",
          "device.removeData",
          "device.sendCommand",
          "device.sendState",
          "device.setConnectionStatus",
          "device.stateStream",
          "deviceRecipe.bulkCreate",
          "deviceRecipe.delete",
          "deviceRecipe.get",
          "deviceRecipe.patch",
          "deviceRecipes.get",
          "deviceRecipes.post",
          "devices.detailedSummary",
          "devices.export",
          "devices.get",
          "devices.post",
          "devices.sendCommand",
          "edgeDeployments.get",
          "edgeDeployments.release",
          "edgeDeployments.remove",
          "edgeDeployments.replace",
          "event.delete",
          "event.get",
          "event.patch",
          "events.get",
          "events.mostRecentBySeverity",
          "events.patch",
          "events.post",
          "experience.delete",
          "experience.bootstrap",
          "experienceDomain.delete",
          "experienceDomain.get",
          "experienceDomain.patch",
          "experienceDomains.get",
          "experienceDomains.post",
          "experienceEndpoint.delete",
          "experienceEndpoint.get",
          "experienceEndpoint.patch",
          "experienceEndpoints.get",
          "experienceEndpoints.post",
          "experienceEndpoints.stats",
          "experienceGroup.delete",
          "experienceGroup.get",
          "experienceGroup.patch",
          "experienceGroups.detailedSummary",
          "experienceGroups.get",
          "experienceGroups.post",
          "experienceSlug.delete",
          "experienceSlug.get",
          "experienceSlug.patch",
          "experienceSlugs.get",
          "experienceSlugs.post",
          "experienceUser.delete",
          "experienceUser.get",
          "experienceUser.patch",
          "experienceUsers.detailedSummary",
          "experienceUsers.get",
          "experienceUsers.post",
          "experienceVersion.delete",
          "experienceVersion.get",
          "experienceVersion.patch",
          "experienceVersions.get",
          "experienceVersions.post",
          "experienceView.debug",
          "experienceView.delete",
          "experienceView.get",
          "experienceView.patch",
          "experienceViews.debug",
          "experienceViews.detailedSummary",
          "experienceViews.get",
          "experienceViews.post",
          "file.get",
          "file.patch",
          "file.move",
          "file.delete",
          "files.get",
          "files.post",
          "flow.debug",
          "flow.delete",
          "flow.clearStorageEntries",
          "flow.get",
          "flow.getStorageEntries",
          "flow.log",
          "flow.patch",
          "flow.pressVirtualButton",
          "flow.setStorageEntry",
          "flows.get",
          "flows.getByVersion",
          "flows.import",
          "flows.post",
          "flowVersion.delete",
          "flowVersion.get",
          "flowVersion.log",
          "flowVersion.patch",
          "flowVersions.get",
          "flowVersions.post",
          "integration.delete",
          "integration.get",
          "integration.patch",
          "integrations.get",
          "integrations.post",
          "notebook.delete",
          "notebook.execute",
          "notebook.get",
          "notebook.logs",
          "notebook.patch",
          "notebook.requestInputDataExport",
          "notebook.upload",
          "notebooks.get",
          "notebooks.post",
          "webhook.delete",
          "webhook.get",
          "webhook.patch",
          "webhooks.get",
          "webhooks.post"
        ]
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Application API Token Post Example

{
  "name": "My New API Token",
  "expirationDate": "2017-06-13T04:00:00.000Z",
  "scope": [
    "all.Application"
  ],
  "status": "active"
}

Application Key

Schema for a single Application Key

Application Key Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationKeyId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "key": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    },
    "deviceIds": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Fa-f\\d]{24}$"
      },
      "maxItems": 1000
    },
    "deviceTags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    }
  }
}

Application Key Example

{
  "id": "575ec76c7ae143cd83dc4a96",
  "applicationKeyId": "575ec76c7ae143cd83dc4a96",
  "applicationId": "575ec8687ae143cd83dc4a97",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "key": "this_would_be_the_key",
  "status": "active",
  "description": "An example key description"
}

Application Key Patch

Schema for the body of an Application Key modification request

Application Key Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    }
  },
  "additionalProperties": false
}

Application Key Patch Example

{
  "status": "active",
  "description": "An example updated key description"
}

Application Key Post

Schema for the body of an Application Key creation request

Application Key Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "deviceIds": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Fa-f\\d]{24}$"
      },
      "maxItems": 1000
    },
    "deviceTags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    }
  },
  "additionalProperties": false
}

Application Key Post Example

{
  "description": "An example new key description"
}

Application Key Post Response

Schema for a response of Application Key creation

Application Key Post Response Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationKeyId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "key": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ]
    },
    "secret": {
      "type": "string"
    },
    "deviceIds": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Fa-f\\d]{24}$"
      },
      "maxItems": 1000
    },
    "deviceTags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    }
  }
}

Application Key Post Response Example

{
  "id": "575ec76c7ae143cd83dc4a96",
  "applicationKeyId": "575ec76c7ae143cd83dc4a96",
  "applicationId": "575ec8687ae143cd83dc4a97",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "key": "this_would_be_the_key",
  "status": "active",
  "secret": "shhhSecret",
  "description": "An example key description"
}

Application Keys

Schema for a collection of Application Keys

Application Keys Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Application Key",
        "description": "Schema for a single Application Key",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "applicationKeyId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastUpdated": {
            "type": "string",
            "format": "date-time"
          },
          "key": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ]
          },
          "deviceIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Fa-f\\d]{24}$"
            },
            "maxItems": 1000
          },
          "deviceTags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255
                }
              },
              "additionalProperties": false
            },
            "maxItems": 100
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "filter": {
      "type": "string"
    },
    "filterField": {
      "type": "string"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Application Keys Example

{
  "items": [
    {
      "id": "575ec76c7ae143cd83dc4a96",
      "applicationKeyId": "575ec76c7ae143cd83dc4a96",
      "applicationId": "575ec8687ae143cd83dc4a97",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "key": "this_would_be_the_key",
      "status": "active",
      "description": "An example key description"
    }
  ],
  "count": 1,
  "totalCount": 4,
  "perPage": 1,
  "page": 0,
  "sortField": "key",
  "sortDirection": "asc",
  "applicationId": "575ec8687ae143cd83dc4a97"
}

Application Patch

Schema for the body of an Application modification request

Application Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "endpointSlug": {
      "type": "string",
      "minLength": 4,
      "maxLength": 63,
      "pattern": "^[0-9a-z-]*$"
    },
    "expUserTokenCutoff": {
      "type": "string",
      "format": "date-time"
    },
    "endpointDefaultCors": {
      "type": "boolean"
    },
    "globals": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "json": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32767
          },
          "cloudOnly": {
            "type": "boolean",
            "default": false
          }
        },
        "additionalProperties": false,
        "required": [
          "key",
          "json"
        ]
      }
    },
    "ftueTracking": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "version": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "skipped",
              "completed"
            ]
          }
        },
        "required": [
          "name",
          "version",
          "status"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "archiveConfig": {
      "type": "object",
      "properties": {
        "directory": {
          "type": "string",
          "max": 255
        },
        "mode": {
          "type": "string",
          "enum": [
            "all",
            "whitelist",
            "blacklist"
          ]
        },
        "deviceIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "maxItems": 1000
        },
        "deviceTags": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "pattern": "^[0-9a-zA-Z_-]{1,255}$"
              },
              "value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            },
            "additionalProperties": false
          },
          "maxItems": 100
        },
        "s3": {
          "type": "object",
          "properties": {
            "bucket": {
              "type": "string",
              "max": 255
            },
            "accessKeyId": {
              "type": "string",
              "min": 16,
              "max": 128
            },
            "secretAccessKey": {
              "type": "string",
              "min": 16,
              "max": 128
            },
            "region": {
              "type": "string",
              "max": 128
            }
          },
          "required": [
            "bucket",
            "accessKeyId",
            "secretAccessKey",
            "region"
          ],
          "additionalProperties": false
        },
        "gcs": {
          "type": "object",
          "properties": {
            "projectId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "keyJson": {
              "type": "string",
              "maxLength": 32767,
              "minLength": 50
            },
            "bucket": {
              "type": "string",
              "max": 255
            }
          },
          "required": [
            "projectId",
            "keyJson",
            "bucket"
          ],
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}

Application Patch Example

{
  "name": "My Updated Application",
  "description": "Description of my updated application"
}

Application Post

Schema for the body of an Application creation request

Application Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "orgId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "endpointSlug": {
      "type": "string",
      "minLength": 4,
      "maxLength": 63,
      "pattern": "^[0-9a-z-]*$"
    },
    "expUserTokenCutoff": {
      "type": "string",
      "format": "date-time"
    },
    "endpointDefaultCors": {
      "type": "boolean"
    },
    "globals": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "json": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32767
          },
          "cloudOnly": {
            "type": "boolean",
            "default": false
          }
        },
        "additionalProperties": false,
        "required": [
          "key",
          "json"
        ]
      }
    },
    "archiveConfig": {
      "type": "object",
      "properties": {
        "directory": {
          "type": "string",
          "max": 255
        },
        "mode": {
          "type": "string",
          "enum": [
            "all",
            "whitelist",
            "blacklist"
          ]
        },
        "deviceIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "maxItems": 1000
        },
        "deviceTags": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "pattern": "^[0-9a-zA-Z_-]{1,255}$"
              },
              "value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            },
            "additionalProperties": false
          },
          "maxItems": 100
        },
        "s3": {
          "type": "object",
          "properties": {
            "bucket": {
              "type": "string",
              "max": 255
            },
            "accessKeyId": {
              "type": "string",
              "min": 16,
              "max": 128
            },
            "secretAccessKey": {
              "type": "string",
              "min": 16,
              "max": 128
            },
            "region": {
              "type": "string",
              "max": 128
            }
          },
          "required": [
            "bucket",
            "accessKeyId",
            "secretAccessKey",
            "region"
          ],
          "additionalProperties": false
        },
        "gcs": {
          "type": "object",
          "properties": {
            "projectId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "keyJson": {
              "type": "string",
              "maxLength": 32767,
              "minLength": 50
            },
            "bucket": {
              "type": "string",
              "max": 255
            }
          },
          "required": [
            "projectId",
            "keyJson",
            "bucket"
          ],
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Application Post Example

{
  "name": "My New Application",
  "description": "Description of my new application"
}

Application Search Result

Results of a search of an application’s resources

Application Search Result Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "pattern": "^[A-Fa-f\\d]{24}$"
      },
      "name": {
        "type": "string"
      },
      "metadata": {
        "type": "object"
      },
      "viewType": {
        "type": "string"
      },
      "version": {
        "type": "string"
      },
      "_type": {
        "type": "string",
        "enum": [
          "applicationApiToken",
          "dashboard",
          "dataTable",
          "deviceRecipe",
          "device",
          "experienceDomain",
          "event",
          "experienceEndpoint",
          "experienceGroup",
          "experienceSlug",
          "experienceUser",
          "experienceVersion",
          "experienceView",
          "file",
          "flow",
          "integration",
          "webhook"
        ]
      }
    },
    "required": [
      "id",
      "name",
      "_type"
    ]
  }
}

Application Search Result Example

[
  {
    "type": "device",
    "name": "My Device #1",
    "metadata": {
      "descriptor": "a basic description of device #1"
    },
    "id": "575ec8687ae143cd83dc4a97"
  }
]

Applications

Schema for a collection of Applications

Applications Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Application",
        "description": "Schema for a single Application",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastUpdated": {
            "type": "string",
            "format": "date-time"
          },
          "ownerId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "user",
              "organization"
            ]
          },
          "organizationName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "organizationIconColor": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "endpointSlug": {
            "type": "string",
            "minLength": 4,
            "maxLength": 63,
            "pattern": "^[0-9a-z-]*$"
          },
          "expUserTokenCutoff": {
            "type": "string",
            "format": "date-time"
          },
          "endpointDefaultCors": {
            "type": "boolean"
          },
          "globals": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "json": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32767
                },
                "cloudOnly": {
                  "type": "boolean",
                  "default": false
                }
              },
              "additionalProperties": false,
              "required": [
                "key",
                "json"
              ]
            }
          },
          "summary": {
            "type": "object",
            "properties": {
              "apiTokenCount": {
                "type": "number"
              },
              "dataTableCount": {
                "type": "number"
              },
              "deviceCount": {
                "type": "number"
              },
              "deviceRecipeCount": {
                "type": "number"
              },
              "eventCount": {
                "type": "number"
              },
              "experienceDomainCount": {
                "type": "number"
              },
              "experienceEndpointCount": {
                "type": "number"
              },
              "experienceGroupCount": {
                "type": "number"
              },
              "experienceSlugCount": {
                "type": "number"
              },
              "experienceUserCount": {
                "type": "number"
              },
              "experienceVersionCount": {
                "type": "number"
              },
              "experienceViewCount": {
                "type": "number"
              },
              "fileCount": {
                "type": "number"
              },
              "flowCount": {
                "type": "number"
              },
              "integrationCount": {
                "type": "number"
              },
              "keyCount": {
                "type": "number"
              },
              "storageStats": {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "number"
                  },
                  "size": {
                    "type": "number"
                  }
                }
              },
              "webhookCount": {
                "type": "number"
              }
            }
          },
          "ftueTracking": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "version": {
                  "type": "number"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "skipped",
                    "completed"
                  ]
                }
              },
              "required": [
                "name",
                "version",
                "status"
              ],
              "additionalProperties": false
            },
            "maxItems": 100
          },
          "archiveConfig": {
            "type": "object",
            "properties": {
              "directory": {
                "type": "string",
                "max": 255
              },
              "mode": {
                "type": "string",
                "enum": [
                  "all",
                  "whitelist",
                  "blacklist"
                ]
              },
              "deviceIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Fa-f\\d]{24}$"
                },
                "maxItems": 1000
              },
              "deviceTags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    }
                  },
                  "additionalProperties": false
                },
                "maxItems": 100
              },
              "s3": {
                "type": "object",
                "properties": {
                  "bucket": {
                    "type": "string",
                    "max": 255
                  },
                  "accessKeyId": {
                    "type": "string",
                    "min": 16,
                    "max": 128
                  },
                  "secretAccessKey": {
                    "type": "string",
                    "min": 16,
                    "max": 128
                  },
                  "region": {
                    "type": "string",
                    "max": 128
                  }
                },
                "required": [
                  "bucket",
                  "accessKeyId",
                  "secretAccessKey",
                  "region"
                ],
                "additionalProperties": false
              },
              "gcs": {
                "type": "object",
                "properties": {
                  "projectId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "keyJson": {
                    "type": "string",
                    "maxLength": 32767,
                    "minLength": 50
                  },
                  "bucket": {
                    "type": "string",
                    "max": 255
                  }
                },
                "required": [
                  "projectId",
                  "keyJson",
                  "bucket"
                ],
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "filter": {
      "type": "string"
    },
    "filterField": {
      "type": "string"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    }
  }
}

Applications Example

{
  "items": [
    {
      "id": "575ec8687ae143cd83dc4a97",
      "applicationId": "575ec8687ae143cd83dc4a97",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "ownerId": "575ed70c7ae143cd83dc4aa9",
      "ownerType": "user",
      "name": "My Application",
      "description": "The is the best application description",
      "summary": {
        "deviceCount": 5,
        "flowCount": 2,
        "webhookCount": 0,
        "eventCount": 0,
        "keyCount": 1,
        "deviceRecipeCount": 0
      },
      "archiveConfig": {
        "s3": {
          "bucket": "bucketName",
          "accessKeyId": "awsAccessKey",
          "accessSecretKey": "awsSecretKey",
          "region": "us-west-1"
        },
        "mode": "all",
        "deviceIds": [
          "575ec8687ae143cd83dc4a95",
          "575ec8687ae143cd83dc4a91"
        ]
      }
    }
  ],
  "count": 1,
  "totalCount": 8,
  "perPage": 1,
  "page": 0,
  "sortField": "name",
  "sortDirection": "asc"
}

Audit Log

Schema for a single Audit Log entry

Audit Log Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "auditLogId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "orgId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "primaryTargetId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "primaryTargetType": {
      "type": "string",
      "enum": [
        "Application",
        "Dashboard",
        "Solution",
        "OrgInvite"
      ]
    },
    "primaryTargetName": {
      "type": "string",
      "maxLength": 1024
    },
    "secondaryTargetId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "secondaryTargetType": {
      "type": "string",
      "enum": [
        "ApiToken",
        "ApplicationKey",
        "DataTable",
        "Device",
        "DeviceRecipe",
        "Event",
        "ExperienceDomain",
        "ExperienceEndpoint",
        "ExperienceGroup",
        "ExperienceSlug",
        "ExperienceUser",
        "ExperienceVersion",
        "ExperienceView",
        "File",
        "Flow",
        "SolutionUser",
        "Integration",
        "Webhook"
      ]
    },
    "secondaryTargetName": {
      "type": "string",
      "maxLength": 1024
    },
    "actorId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "actorType": {
      "type": "string",
      "enum": [
        "Application",
        "Device",
        "Flow",
        "SolutionUser",
        "User",
        "ApiToken"
      ]
    },
    "actorName": {
      "type": "string",
      "maxLength": 1024
    },
    "requestResource": {
      "type": "string",
      "maxLength": 1024
    },
    "requestAction": {
      "type": "string",
      "maxLength": 1024
    },
    "requestQueryParams": {
      "type": "object"
    },
    "requestBody": {
      "type": "object"
    },
    "requestPathParams": {
      "type": "object"
    },
    "responseBody": {
      "type": "object"
    },
    "responseStatus": {
      "type": "integer",
      "minimum": 100,
      "maximum": 599
    }
  }
}

Audit Log Example

{
  "id": "586e9d5151265cb9d72f6ec6",
  "auditLogId": "586e9d5151265cb9d72f6ec6",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "orgId": "575ed6e87ae143cd83dc4aa8",
  "primaryTargetId": "575ec8687ae143cd83dc4a97",
  "primaryTargetType": "Application",
  "primaryTargetName": "My Application",
  "actorId": "575ed70c7ae143cd83dc4aa9",
  "actorType": "User",
  "actorName": "example@losant.com",
  "requestResource": "application",
  "requestAction": "delete",
  "requestQueryParams": {},
  "requestBody": {},
  "requestPathParams": {
    "applicationId": "575ec8687ae143cd83dc4a97"
  },
  "responseBody": {
    "success": true
  },
  "responseStatus": 200
}

Audit Log Filter

Schema for the filter of an audit log query

Audit Log Filter Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "primaryTarget": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "Application",
              "Dashboard",
              "Solution",
              "OrgInvite"
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "additionalProperties": false
      }
    },
    "secondaryTarget": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "ApiToken",
              "ApplicationKey",
              "DataTable",
              "Device",
              "DeviceRecipe",
              "Event",
              "ExperienceDomain",
              "ExperienceEndpoint",
              "ExperienceGroup",
              "ExperienceSlug",
              "ExperienceUser",
              "ExperienceVersion",
              "ExperienceView",
              "File",
              "Flow",
              "SolutionUser",
              "Integration",
              "Webhook"
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "additionalProperties": false
      }
    },
    "actor": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "Application",
              "Device",
              "Flow",
              "SolutionUser",
              "User",
              "ApiToken"
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "additionalProperties": false
      }
    },
    "request": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "resource": {
            "type": "string",
            "maxLength": 1024
          },
          "action": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "additionalProperties": false
      }
    },
    "responseCode": {
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 100,
        "maximum": 599
      }
    }
  },
  "additionalProperties": false
}

Audit Log Filter Example

{
  "primaryTarget": [
    {
      "type": "Dashboard"
    },
    {
      "type": "Application",
      "id": "575ec8687ae143cd83dc4a97"
    }
  ],
  "actor": [
    {
      "type": "User",
      "id": "575ed70c7ae143cd83dc4aa9"
    }
  ]
}

Audit Logs

Schema for a collection of Audit Logs

Audit Logs Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Audit Log",
        "description": "Schema for a single Audit Log entry",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "auditLogId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "orgId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "primaryTargetId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "primaryTargetType": {
            "type": "string",
            "enum": [
              "Application",
              "Dashboard",
              "Solution",
              "OrgInvite"
            ]
          },
          "primaryTargetName": {
            "type": "string",
            "maxLength": 1024
          },
          "secondaryTargetId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "secondaryTargetType": {
            "type": "string",
            "enum": [
              "ApiToken",
              "ApplicationKey",
              "DataTable",
              "Device",
              "DeviceRecipe",
              "Event",
              "ExperienceDomain",
              "ExperienceEndpoint",
              "ExperienceGroup",
              "ExperienceSlug",
              "ExperienceUser",
              "ExperienceVersion",
              "ExperienceView",
              "File",
              "Flow",
              "SolutionUser",
              "Integration",
              "Webhook"
            ]
          },
          "secondaryTargetName": {
            "type": "string",
            "maxLength": 1024
          },
          "actorId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "actorType": {
            "type": "string",
            "enum": [
              "Application",
              "Device",
              "Flow",
              "SolutionUser",
              "User",
              "ApiToken"
            ]
          },
          "actorName": {
            "type": "string",
            "maxLength": 1024
          },
          "requestResource": {
            "type": "string",
            "maxLength": 1024
          },
          "requestAction": {
            "type": "string",
            "maxLength": 1024
          },
          "requestQueryParams": {
            "type": "object"
          },
          "requestBody": {
            "type": "object"
          },
          "requestPathParams": {
            "type": "object"
          },
          "responseBody": {
            "type": "object"
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "orgId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Audit Logs Example

{
  "items": [
    {
      "id": "586e9d5151265cb9d72f6ec6",
      "auditLogId": "586e9d5151265cb9d72f6ec6",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "orgId": "575ed6e87ae143cd83dc4aa8",
      "primaryTargetId": "575ec8687ae143cd83dc4a97",
      "primaryTargetType": "Application",
      "primaryTargetName": "My Application",
      "actorId": "575ed70c7ae143cd83dc4aa9",
      "actorType": "User",
      "actorName": "example@losant.com",
      "requestResource": "application",
      "requestAction": "delete",
      "requestQueryParams": {},
      "requestBody": {},
      "requestPathParams": {
        "applicationId": "575ec8687ae143cd83dc4a97"
      },
      "responseBody": {
        "success": true
      },
      "responseStatus": 200
    }
  ],
  "count": 1,
  "totalCount": 4,
  "perPage": 1,
  "page": 0,
  "sortField": "creationDate",
  "sortDirection": "desc",
  "orgId": "575ed6e87ae143cd83dc4aa8"
}

Authenticated Device

Schema for the successful response when authenticating a Device

Authenticated Device Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "deviceId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "token": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "applicationId",
    "deviceId",
    "deviceClass",
    "token"
  ]
}

Authenticated Device Example

{
  "applicationId": "575ec8687ae143cd83dc4a97",
  "deviceId": "575ecf887ae143cd83dc4aa2",
  "deviceClass": "standalone",
  "token": "token_to_use_for_authenticating_subsequent_requests"
}

Authenticated Solution User

Schema for the successful response when authenticating a Solution User

Authenticated Solution User Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "solutionUserId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "token": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "solutionUserId",
    "token"
  ]
}

Authenticated Solution User Example

{
  "solutionUserId": "566116085df4b701000258e3",
  "token": "token_to_use_for_authenticating_subsequent_requests"
}

Authenticated User

Schema for the successful response when authenticating a User

Authenticated User Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "userId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "token": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "userId",
    "token"
  ]
}

Authenticated User Example

{
  "userId": "575ed70c7ae143cd83dc4aa9",
  "token": "token_to_use_for_authenticating_subsequent_requests"
}

Change Password

Schema for the body of a request to change the current user’s password

Change Password Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "twoFactorCode": {
      "type": "string",
      "maxLength": 2048
    },
    "password": {
      "type": "string",
      "minLength": 8,
      "maxLength": 2048
    },
    "newPassword": {
      "type": "string",
      "minLength": 8,
      "maxLength": 2048,
      "pattern": "^(?=.*[A-Z])(?=.*[^A-z0-9])(?=.*[0-9])(?=.*[a-z]).{8,}$"
    },
    "invalidateExistingTokens": {
      "type": "boolean"
    },
    "tokenTTL": {
      "type": "integer",
      "minimum": 0
    }
  },
  "required": [
    "password",
    "newPassword"
  ],
  "additionalProperties": false
}

Change Password Example

{
  "newPassword": "yourNewPassword",
  "password": "yourCurrentPassword",
  "invalidateExistingTokens": true
}

Composite Device State

Schema for a composite Device state

Composite Device State Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "patternProperties": {
    "^[0-9a-zA-Z_-]{1,255}$": {
      "type": "object",
      "properties": {
        "value": {
          "type": [
            "number",
            "string",
            "boolean"
          ]
        },
        "time": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "object",
              "properties": {
                "$date": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "$date"
              ]
            }
          ]
        }
      }
    }
  },
  "additionalProperties": false
}

Composite Device State Example

{
  "voltage": {
    "time": "2016-06-13T04:00:00.000Z",
    "value": 22.4
  },
  "loaded": {
    "time": "2016-06-13T03:00:00.000Z",
    "value": false
  }
}

Dashboard

Schema for a single Dashboard

Dashboard Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "dashboardId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "ownerId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "ownerType": {
      "type": "string",
      "enum": [
        "user",
        "organization"
      ]
    },
    "organizationName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "organizationIconColor": {
      "type": "string"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "refreshRate": {
      "type": "number",
      "minimum": 5,
      "maximum": 600
    },
    "defaultTheme": {
      "type": "string",
      "enum": [
        "dark",
        "light"
      ]
    },
    "isPasswordProtected": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean"
    },
    "reportConfigs": {
      "type": "array",
      "max": 10,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cron",
          "toEmail"
        ],
        "properties": {
          "id": {
            "type": "string",
            "max": 14
          },
          "cron": {
            "type": "string",
            "max": 255
          },
          "toEmail": {
            "type": "array",
            "min": 1,
            "max": 10,
            "items": {
              "type": "string",
              "format": "email",
              "maxLength": 1024
            }
          },
          "subject": {
            "type": "string",
            "max": 255
          },
          "message": {
            "type": "string",
            "max": 32767
          },
          "theme": {
            "type": "string",
            "enum": [
              "dark",
              "light"
            ]
          },
          "timezone": {
            "type": "string",
            "max": 255
          }
        }
      }
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 255
          },
          "blockType": {
            "type": "string",
            "enum": [
              "application-list",
              "bar",
              "custom-chart",
              "dashboard-list",
              "data-table",
              "device-list",
              "device-log",
              "device-state-table",
              "event-list",
              "gauge",
              "graph",
              "heatmap",
              "iframe",
              "image",
              "indicator",
              "input",
              "map",
              "open-event-indicator",
              "pie",
              "position-chart",
              "section-header",
              "workflow-list"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "startX": {
            "type": "number"
          },
          "startY": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "config": {
            "type": "object"
          }
        },
        "required": [
          "blockType",
          "startX",
          "startY",
          "width",
          "height"
        ],
        "additionalProperties": false
      }
    },
    "contextConfiguration": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "deviceAttribute",
              "deviceId",
              "deviceTag",
              "number",
              "string"
            ]
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "defaultValue": {
            "oneOf": [
              {
                "type": "string",
                "maxLength": 32767
              },
              {
                "type": "number"
              },
              {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "validationEnabled": {
            "type": "boolean"
          },
          "validationConfig": {
            "type": "object",
            "properties": {
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "regExp": {
                "type": "string",
                "maxLength": 1024
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "maxItems": 100
              },
              "deviceIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Fa-f\\d]{24}$"
                },
                "maxItems": 1000
              },
              "deviceTags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    }
                  },
                  "additionalProperties": false
                },
                "maxItems": 100
              },
              "includeFullDevice": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "type",
          "defaultValue"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    }
  }
}

Dashboard Example

{
  "id": "575ece2b7ae143cd83dc4a9b",
  "dashboardId": "575ece2b7ae143cd83dc4a9b",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "organizationName": "Losant",
  "organizationIconColor": "#284fff",
  "ownerType": "organization",
  "ownerId": "58238ff2fe7b4b01009a0554",
  "name": "My Dashboard",
  "description": "The best dashboard description",
  "refreshRate": 60,
  "public": false,
  "isPasswordProtected": false,
  "defaultTheme": "light",
  "blocks": [],
  "_currentRole": "admin",
  "reportConfigs": [
    {
      "toEmail": [
        "test@email.com"
      ],
      "cron": "0 0 12 * * MON-FRI *",
      "theme": "dark",
      "subject": "Daily Dashboard Report"
    }
  ],
  "contextConfiguration": [
    {
      "validationEnabled": true,
      "validationConfig": {
        "deviceIds": [
          "589de9bca1975a00017b2293"
        ],
        "deviceTags": [
          {
            "key": "type",
            "value": "Weather Station"
          }
        ],
        "includeFullDevice": true
      },
      "name": "deviceId-withIdAndTagValidationAndIncludeFullDevice",
      "type": "deviceId",
      "applicationId": "589de7d2a1975a00017b227f",
      "defaultValue": "589de9bca1975a00017b2295"
    },
    {
      "validationEnabled": false,
      "validationConfig": {
        "includeFullDevice": false
      },
      "name": "deviceId-noValidationNoFullDevice",
      "type": "deviceId",
      "applicationId": "589de7d2a1975a00017b227f",
      "defaultValue": "589de9bca1975a00017b2295"
    },
    {
      "validationEnabled": true,
      "validationConfig": {
        "attributes": [
          "dew-point",
          "feels-like",
          "humidity",
          "location",
          "pressure",
          "temp",
          "visibility",
          "wind-speed"
        ]
      },
      "name": "attr",
      "type": "deviceAttribute",
      "applicationId": "589de7d2a1975a00017b227f",
      "defaultValue": "temp"
    },
    {
      "validationEnabled": true,
      "validationConfig": {
        "deviceTags": [
          {
            "key": "DeviceRecipe",
            "value": "Weather Station"
          },
          {
            "key": "region"
          }
        ]
      },
      "name": "deviceTag-withValidation",
      "type": "deviceTag",
      "applicationId": "589de7d2a1975a00017b227f",
      "defaultValue": {
        "key": "DeviceRecipe",
        "value": "Weather Station"
      }
    },
    {
      "validationEnabled": false,
      "validationConfig": {},
      "name": "deviceTag-noValidation",
      "type": "deviceTag",
      "applicationId": "589de7d2a1975a00017b227f",
      "defaultValue": {
        "key": "DeviceRecipe",
        "value": "Weather Station"
      }
    }
  ]
}

Dashboard Context Instance

Schema for a dashboard context instance

Dashboard Context Instance Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "patternProperties": {
    "^[0-9a-zA-Z_-]{1,255}$": {
      "oneOf": [
        {
          "type": "string",
          "maxLength": 32767
        },
        {
          "type": "number"
        },
        {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "pattern": "^[0-9a-zA-Z_-]{1,255}$"
            },
            "value": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          "additionalProperties": false
        }
      ]
    }
  },
  "additionalProperties": false
}

Dashboard Context Instance Example

{
  "myContextVariable": "myValue",
  "myOtherVariable": "575ecf887ae143cd83dc4aa2"
}

Dashboard Patch

Schema for the body of a Dashboard modification request

Dashboard Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 255
          },
          "blockType": {
            "type": "string",
            "enum": [
              "application-list",
              "bar",
              "custom-chart",
              "dashboard-list",
              "data-table",
              "device-list",
              "device-log",
              "device-state-table",
              "event-list",
              "gauge",
              "graph",
              "heatmap",
              "iframe",
              "image",
              "indicator",
              "input",
              "map",
              "open-event-indicator",
              "pie",
              "position-chart",
              "section-header",
              "workflow-list"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "startX": {
            "type": "number"
          },
          "startY": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "config": {
            "type": "object"
          }
        },
        "required": [
          "blockType",
          "startX",
          "startY",
          "width",
          "height"
        ],
        "additionalProperties": false
      }
    },
    "reportConfigs": {
      "type": "array",
      "max": 10,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cron",
          "toEmail"
        ],
        "properties": {
          "id": {
            "type": "string",
            "max": 14
          },
          "cron": {
            "type": "string",
            "max": 255
          },
          "toEmail": {
            "type": "array",
            "min": 1,
            "max": 10,
            "items": {
              "type": "string",
              "format": "email",
              "maxLength": 1024
            }
          },
          "subject": {
            "type": "string",
            "max": 255
          },
          "message": {
            "type": "string",
            "max": 32767
          },
          "theme": {
            "type": "string",
            "enum": [
              "dark",
              "light"
            ]
          },
          "timezone": {
            "type": "string",
            "max": 255
          }
        }
      }
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "refreshRate": {
      "type": "number",
      "minimum": 5,
      "maximum": 600
    },
    "defaultTheme": {
      "type": "string",
      "enum": [
        "dark",
        "light"
      ]
    },
    "public": {
      "type": "boolean"
    },
    "password": {
      "type": [
        "string",
        "null"
      ]
    },
    "contextConfiguration": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "deviceAttribute",
              "deviceId",
              "deviceTag",
              "number",
              "string"
            ]
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "defaultValue": {
            "oneOf": [
              {
                "type": "string",
                "maxLength": 32767
              },
              {
                "type": "number"
              },
              {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "validationEnabled": {
            "type": "boolean"
          },
          "validationConfig": {
            "type": "object",
            "properties": {
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "regExp": {
                "type": "string",
                "maxLength": 1024
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "maxItems": 100
              },
              "deviceIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Fa-f\\d]{24}$"
                },
                "maxItems": 1000
              },
              "deviceTags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    }
                  },
                  "additionalProperties": false
                },
                "maxItems": 100
              },
              "includeFullDevice": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "type",
          "defaultValue"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    }
  },
  "additionalProperties": false
}

Dashboard Patch Example

{
  "name": "My Updated Dashboard",
  "description": "Description of my updated dashboard",
  "refreshRate": 300,
  "public": true
}

Dashboard Post

Schema for the body of a Dashboard creation request

Dashboard Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "orgId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 255
          },
          "blockType": {
            "type": "string",
            "enum": [
              "application-list",
              "bar",
              "custom-chart",
              "dashboard-list",
              "data-table",
              "device-list",
              "device-log",
              "device-state-table",
              "event-list",
              "gauge",
              "graph",
              "heatmap",
              "iframe",
              "image",
              "indicator",
              "input",
              "map",
              "open-event-indicator",
              "pie",
              "position-chart",
              "section-header",
              "workflow-list"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "startX": {
            "type": "number"
          },
          "startY": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "config": {
            "type": "object"
          }
        },
        "required": [
          "blockType",
          "startX",
          "startY",
          "width",
          "height"
        ],
        "additionalProperties": false
      }
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "refreshRate": {
      "type": "number",
      "minimum": 5,
      "maximum": 600
    },
    "defaultTheme": {
      "type": "string",
      "enum": [
        "dark",
        "light"
      ]
    },
    "reportConfigs": {
      "type": "array",
      "max": 10,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cron",
          "toEmail"
        ],
        "properties": {
          "id": {
            "type": "string",
            "max": 14
          },
          "cron": {
            "type": "string",
            "max": 255
          },
          "toEmail": {
            "type": "array",
            "min": 1,
            "max": 10,
            "items": {
              "type": "string",
              "format": "email",
              "maxLength": 1024
            }
          },
          "subject": {
            "type": "string",
            "max": 255
          },
          "message": {
            "type": "string",
            "max": 32767
          },
          "theme": {
            "type": "string",
            "enum": [
              "dark",
              "light"
            ]
          },
          "timezone": {
            "type": "string",
            "max": 255
          }
        }
      }
    },
    "public": {
      "type": "boolean"
    },
    "password": {
      "type": [
        "string",
        "null"
      ]
    },
    "contextConfiguration": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "deviceAttribute",
              "deviceId",
              "deviceTag",
              "number",
              "string"
            ]
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "defaultValue": {
            "oneOf": [
              {
                "type": "string",
                "maxLength": 32767
              },
              {
                "type": "number"
              },
              {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "validationEnabled": {
            "type": "boolean"
          },
          "validationConfig": {
            "type": "object",
            "properties": {
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "regExp": {
                "type": "string",
                "maxLength": 1024
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "maxItems": 100
              },
              "deviceIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Fa-f\\d]{24}$"
                },
                "maxItems": 1000
              },
              "deviceTags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    }
                  },
                  "additionalProperties": false
                },
                "maxItems": 100
              },
              "includeFullDevice": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "type",
          "defaultValue"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Dashboard Post Example

{
  "name": "My New Dashboard",
  "public": false
}

Dashboard Send Report

Schema for the body of a Dashboard report request

Dashboard Send Report Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "required": [
    "toEmail"
  ],
  "properties": {
    "toEmail": {
      "type": "array",
      "min": 1,
      "max": 10,
      "items": {
        "type": "string",
        "format": "email",
        "maxLength": 1024
      }
    },
    "subject": {
      "type": "string",
      "max": 255
    },
    "message": {
      "type": "string",
      "max": 32767
    },
    "theme": {
      "type": "string",
      "enum": [
        "dark",
        "light"
      ]
    },
    "time": {
      "type": "number"
    }
  },
  "additionalProperties": false
}

Dashboard Send Report Example

{
  "toEmail": [
    "test@email.com"
  ],
  "subject": "Dashboard Report",
  "message": "Lookit",
  "time": 1551887386704,
  "theme": "dark"
}

Dashboards

Schema for a collection of Dashboards

Dashboards Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Dashboard",
        "description": "Schema for a single Dashboard",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "dashboardId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastUpdated": {
            "type": "string",
            "format": "date-time"
          },
          "ownerId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "user",
              "organization"
            ]
          },
          "organizationName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "organizationIconColor": {
            "type": "string"
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "applicationName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "refreshRate": {
            "type": "number",
            "minimum": 5,
            "maximum": 600
          },
          "defaultTheme": {
            "type": "string",
            "enum": [
              "dark",
              "light"
            ]
          },
          "isPasswordProtected": {
            "type": "boolean"
          },
          "public": {
            "type": "boolean"
          },
          "reportConfigs": {
            "type": "array",
            "max": 10,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "cron",
                "toEmail"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "max": 14
                },
                "cron": {
                  "type": "string",
                  "max": 255
                },
                "toEmail": {
                  "type": "array",
                  "min": 1,
                  "max": 10,
                  "items": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 1024
                  }
                },
                "subject": {
                  "type": "string",
                  "max": 255
                },
                "message": {
                  "type": "string",
                  "max": 32767
                },
                "theme": {
                  "type": "string",
                  "enum": [
                    "dark",
                    "light"
                  ]
                },
                "timezone": {
                  "type": "string",
                  "max": 255
                }
              }
            }
          },
          "blocks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "maxLength": 255
                },
                "blockType": {
                  "type": "string",
                  "enum": [
                    "application-list",
                    "bar",
                    "custom-chart",
                    "dashboard-list",
                    "data-table",
                    "device-list",
                    "device-log",
                    "device-state-table",
                    "event-list",
                    "gauge",
                    "graph",
                    "heatmap",
                    "iframe",
                    "image",
                    "indicator",
                    "input",
                    "map",
                    "open-event-indicator",
                    "pie",
                    "position-chart",
                    "section-header",
                    "workflow-list"
                  ]
                },
                "title": {
                  "type": "string",
                  "maxLength": 255
                },
                "description": {
                  "type": "string",
                  "maxLength": 32767
                },
                "applicationId": {
                  "type": "string",
                  "pattern": "^[A-Fa-f\\d]{24}$"
                },
                "startX": {
                  "type": "number"
                },
                "startY": {
                  "type": "number"
                },
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                },
                "config": {
                  "type": "object"
                }
              },
              "required": [
                "blockType",
                "startX",
                "startY",
                "width",
                "height"
              ],
              "additionalProperties": false
            }
          },
          "contextConfiguration": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "deviceAttribute",
                    "deviceId",
                    "deviceTag",
                    "number",
                    "string"
                  ]
                },
                "applicationId": {
                  "type": "string",
                  "pattern": "^[A-Fa-f\\d]{24}$"
                },
                "defaultValue": {
                  "oneOf": [
                    {
                      "type": "string",
                      "maxLength": 32767
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                        },
                        "value": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "validationEnabled": {
                  "type": "boolean"
                },
                "validationConfig": {
                  "type": "object",
                  "properties": {
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "regExp": {
                      "type": "string",
                      "maxLength": 1024
                    },
                    "attributes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                      },
                      "maxItems": 100
                    },
                    "deviceIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                      },
                      "maxItems": 1000
                    },
                    "deviceTags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                          },
                          "value": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          }
                        },
                        "additionalProperties": false
                      },
                      "maxItems": 100
                    },
                    "includeFullDevice": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "required": [
                "name",
                "type",
                "defaultValue"
              ],
              "additionalProperties": false
            },
            "maxItems": 100
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "filter": {
      "type": "string"
    },
    "filterField": {
      "type": "string"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "orgId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Dashboards Example

{
  "items": [
    {
      "id": "575ece2b7ae143cd83dc4a9b",
      "dashboardId": "575ece2b7ae143cd83dc4a9b",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "organizationName": "Losant",
      "organizationIconColor": "#284fff",
      "ownerType": "organization",
      "ownerId": "58238ff2fe7b4b01009a0554",
      "name": "My Dashboard",
      "description": "The best dashboard description",
      "refreshRate": 60,
      "public": false,
      "isPasswordProtected": false,
      "defaultTheme": "light",
      "blocks": [],
      "_currentRole": "admin",
      "reportConfigs": [
        {
          "toEmail": [
            "test@email.com"
          ],
          "cron": "0 0 12 * * MON-FRI *",
          "theme": "dark",
          "subject": "Daily Dashboard Report"
        }
      ],
      "contextConfiguration": [
        {
          "validationEnabled": true,
          "validationConfig": {
            "deviceIds": [
              "589de9bca1975a00017b2293"
            ],
            "deviceTags": [
              {
                "key": "type",
                "value": "Weather Station"
              }
            ],
            "includeFullDevice": true
          },
          "name": "deviceId-withIdAndTagValidationAndIncludeFullDevice",
          "type": "deviceId",
          "applicationId": "589de7d2a1975a00017b227f",
          "defaultValue": "589de9bca1975a00017b2295"
        },
        {
          "validationEnabled": false,
          "validationConfig": {
            "includeFullDevice": false
          },
          "name": "deviceId-noValidationNoFullDevice",
          "type": "deviceId",
          "applicationId": "589de7d2a1975a00017b227f",
          "defaultValue": "589de9bca1975a00017b2295"
        },
        {
          "validationEnabled": true,
          "validationConfig": {
            "attributes": [
              "dew-point",
              "feels-like",
              "humidity",
              "location",
              "pressure",
              "temp",
              "visibility",
              "wind-speed"
            ]
          },
          "name": "attr",
          "type": "deviceAttribute",
          "applicationId": "589de7d2a1975a00017b227f",
          "defaultValue": "temp"
        },
        {
          "validationEnabled": true,
          "validationConfig": {
            "deviceTags": [
              {
                "key": "DeviceRecipe",
                "value": "Weather Station"
              },
              {
                "key": "region"
              }
            ]
          },
          "name": "deviceTag-withValidation",
          "type": "deviceTag",
          "applicationId": "589de7d2a1975a00017b227f",
          "defaultValue": {
            "key": "DeviceRecipe",
            "value": "Weather Station"
          }
        },
        {
          "validationEnabled": false,
          "validationConfig": {},
          "name": "deviceTag-noValidation",
          "type": "deviceTag",
          "applicationId": "589de7d2a1975a00017b227f",
          "defaultValue": {
            "key": "DeviceRecipe",
            "value": "Weather Station"
          }
        }
      ]
    }
  ],
  "count": 1,
  "totalCount": 5,
  "perPage": 1,
  "page": 0,
  "sortField": "name",
  "sortDirection": "asc"
}

Data Export

Schema for exporting data devices query

Data Export Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "format": "email",
      "maxLength": 1024
    },
    "deviceIds": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Fa-f\\d]{24}$"
      },
      "maxItems": 1000
    },
    "deviceTags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[0-9a-zA-Z_-]{1,255}$"
      }
    },
    "start": {
      "type": "number"
    },
    "end": {
      "type": "number"
    },
    "options": {
      "type": "object",
      "properties": {
        "includeDate": {
          "type": "boolean",
          "default": true
        },
        "includeID": {
          "type": "boolean",
          "default": true
        }
      }
    }
  },
  "additionalProperties": false
}

Data Export Example

{
  "email": "example@losant.com",
  "deviceIds": [
    "575ecf887ae143cd83dc4aa2",
    "575ef5c97ae143cd83dc4aac"
  ],
  "attributes": [
    "voltage"
  ],
  "end": 0,
  "options": {
    "includeDate": false,
    "includeID": true
  }
}

Data Table

Schema for a single Data Table

Data Table Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "dataTableId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "columns": {
      "type": "array",
      "items": {
        "title": "Data Table Column",
        "description": "Schema for a single Data Table Column",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "boolean"
            ]
          },
          "constraint": {
            "type": "string",
            "enum": [
              "unique",
              "required",
              "optional"
            ]
          },
          "defaultValue": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType",
          "constraint"
        ],
        "additionalProperties": false
      },
      "maxItems": 50
    }
  }
}

Data Table Example

{
  "id": "596e6ce831761df4231708f1",
  "dataTableId": "596e6ce831761df4231708f1",
  "applicationId": "575ec8687ae143cd83dc4a97",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "name": "My Data Table",
  "columns": [
    {
      "name": "myColumn1",
      "dataType": "string",
      "constraint": "unique"
    },
    {
      "name": "myColumn2",
      "dataType": "number",
      "constraint": "optional"
    }
  ]
}

Data Table Column

Schema for a single Data Table Column

Data Table Column Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[0-9a-zA-Z_-]{1,255}$"
    },
    "dataType": {
      "type": "string",
      "enum": [
        "string",
        "number",
        "boolean"
      ]
    },
    "constraint": {
      "type": "string",
      "enum": [
        "unique",
        "required",
        "optional"
      ]
    },
    "defaultValue": {
      "type": [
        "string",
        "number",
        "boolean"
      ]
    }
  },
  "required": [
    "name",
    "dataType",
    "constraint"
  ],
  "additionalProperties": false
}

Data Table Column Example

{
  "name": "myColumn3",
  "dataType": "string",
  "constraint": "optional",
  "defaultValue": "aDefault"
}

Data Table Patch

Schema for the body of a Data Table modification request

Data Table Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    }
  },
  "additionalProperties": false
}

Data Table Patch Example

{
  "name": "My Updated Data Table"
}

Data Table Post

Schema for the body of a Data Table creation request

Data Table Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "columns": {
      "type": "array",
      "items": {
        "title": "Data Table Column",
        "description": "Schema for a single Data Table Column",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "boolean"
            ]
          },
          "constraint": {
            "type": "string",
            "enum": [
              "unique",
              "required",
              "optional"
            ]
          },
          "defaultValue": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType",
          "constraint"
        ],
        "additionalProperties": false
      },
      "maxItems": 50
    }
  },
  "required": [
    "name"
  ],
  "additionalProperties": false
}

Data Table Post Example

{
  "name": "My Data Table",
  "columns": [
    {
      "name": "myColumn1",
      "dataType": "string",
      "constraint": "unique"
    },
    {
      "name": "myColumn2",
      "dataType": "number",
      "constraint": "optional"
    }
  ]
}

Data Table Query

Schema for a data table query

Data Table Query Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "$and": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/dataTableQuery"
      }
    },
    "$or": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/dataTableQuery"
      }
    }
  },
  "patternProperties": {
    "^[0-9a-zA-Z_-]{1,255}$": {
      "oneOf": [
        {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        },
        {
          "type": "object",
          "properties": {
            "$eq": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            "$ne": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            "$gt": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            "$lt": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            "$gte": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            "$lte": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        }
      ]
    }
  },
  "additionalProperties": false
}

Data Table Query Example

{
  "$or": [
    {
      "myColumn1": {
        "$ne": "myValue"
      }
    },
    {
      "myColumn2": 5
    }
  ]
}

Data Table Row

Schema for a single Data Table Row

Data Table Row Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "patternProperties": {
    "^[0-9a-zA-Z_-]{1,255}$": {
      "type": [
        "string",
        "number",
        "boolean",
        "null"
      ]
    }
  }
}

Data Table Row Example

{
  "id": "596fbb703fc088453872e609",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "myColumn1": "myValue",
  "myColumn2": 5
}

Data Table Row Insert Multiple

Schema for inserting data table rows

Data Table Row Insert Multiple Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array",
  "items": {
    "title": "Data Table Row Insert Update",
    "description": "Schema for inserting or updating a data table row",
    "type": "object",
    "patternProperties": {
      "^[0-9a-zA-Z_-]{1,255}$": {
        "type": [
          "string",
          "number",
          "boolean",
          "null"
        ]
      }
    },
    "additionalProperties": false
  }
}

Data Table Row Insert Multiple Example

[
  {
    "myColumn1": "myValue"
  },
  {
    "myColumn1": "myValue"
  }
]

Data Table Row Insert

Schema for inserting a data table row or rows

Data Table Row Insert Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "oneOf": [
    {
      "title": "Data Table Row Insert Update",
      "description": "Schema for inserting or updating a data table row",
      "type": "object",
      "patternProperties": {
        "^[0-9a-zA-Z_-]{1,255}$": {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    {
      "title": "Data Table Row Insert Multiple",
      "description": "Schema for inserting data table rows",
      "type": "array",
      "items": {
        "title": "Data Table Row Insert Update",
        "description": "Schema for inserting or updating a data table row",
        "type": "object",
        "patternProperties": {
          "^[0-9a-zA-Z_-]{1,255}$": {
            "type": [
              "string",
              "number",
              "boolean",
              "null"
            ]
          }
        },
        "additionalProperties": false
      }
    }
  ]
}

Data Table Row Insert Example

{
  "myColumn1": "myValue"
}

Data Table Row Insert Result

Schema for a the result of a single or multiple row insert

Data Table Row Insert Result Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "oneOf": [
    {
      "title": "Data Table Row",
      "description": "Schema for a single Data Table Row",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "patternProperties": {
        "^[0-9a-zA-Z_-]{1,255}$": {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        }
      }
    },
    {
      "type": "object",
      "properties": {
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "count": {
          "type": "number"
        },
        "rowIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "maxItems": 1000
        }
      }
    }
  ]
}

Data Table Row Insert Result Example

{
  "id": "596fbb703fc088453872e609",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "myColumn1": "myValue",
  "myColumn2": 5
}

Data Table Row Insert Update

Schema for inserting or updating a data table row

Data Table Row Insert Update Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "patternProperties": {
    "^[0-9a-zA-Z_-]{1,255}$": {
      "type": [
        "string",
        "number",
        "boolean",
        "null"
      ]
    }
  },
  "additionalProperties": false
}

Data Table Row Insert Update Example

{
  "myColumn1": "myValue"
}

Data Table Rows

Schema for a collection of Data Table Rows

Data Table Rows Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Data Table Row",
        "description": "Schema for a single Data Table Row",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "patternProperties": {
          "^[0-9a-zA-Z_-]{1,255}$": {
            "type": [
              "string",
              "number",
              "boolean",
              "null"
            ]
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "limit": {
      "type": "integer"
    },
    "offset": {
      "type": "integer"
    },
    "sortColumn": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "dataTableId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Data Table Rows Example

{
  "items": [
    {
      "id": "596fbb703fc088453872e609",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "myColumn1": "myValue",
      "myColumn2": 5
    }
  ],
  "count": 1,
  "totalCount": 4,
  "offset": 0,
  "limit": 1,
  "sortColumn": "myColumn1",
  "sortDirection": "asc",
  "dataTableId": "596e6ce831761df4231708f1",
  "applicationId": "575ec8687ae143cd83dc4a97"
}

Data Table Rows Delete

Schema for response to data table rows removal

Data Table Rows Delete Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "removed": {
      "type": "Number"
    }
  }
}

Data Table Rows Delete Example

{
  "removed": 100
}

Data Table Rows Export

Schema for the body of a data table export

Data Table Rows Export Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "format": "email",
      "maxLength": 1024
    },
    "query": {
      "title": "Data Table Query",
      "description": "Schema for a data table query",
      "type": "object",
      "properties": {
        "$and": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/dataTableQuery"
          }
        },
        "$or": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/dataTableQuery"
          }
        }
      },
      "patternProperties": {
        "^[0-9a-zA-Z_-]{1,255}$": {
          "oneOf": [
            {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            },
            {
              "type": "object",
              "properties": {
                "$eq": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "$ne": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "$gt": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "$lt": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "$gte": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "$lte": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                }
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "queryOptions": {
      "type": "object",
      "properties": {
        "sortDirection": {
          "type": "string",
          "enum": [
            "desc",
            "asc"
          ]
        },
        "limit": {
          "type": "number"
        },
        "sortColumn": {
          "type": "string"
        },
        "offset": {
          "type": "number"
        }
      }
    }
  },
  "additionalProperties": false
}

Data Table Rows Export Example

{
  "email": "email@example.com",
  "query": {
    "$or": [
      {
        "myColumn1": {
          "$ne": "myValue"
        }
      },
      {
        "myColumn2": 5
      }
    ]
  },
  "queryOptions": {
    "limit": 10000
  }
}

Data Tables

Schema for a collection of Data Tables

Data Tables Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Data Table",
        "description": "Schema for a single Data Table",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "dataTableId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastUpdated": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "columns": {
            "type": "array",
            "items": {
              "title": "Data Table Column",
              "description": "Schema for a single Data Table Column",
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "dataType": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                },
                "constraint": {
                  "type": "string",
                  "enum": [
                    "unique",
                    "required",
                    "optional"
                  ]
                },
                "defaultValue": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "required": [
                "name",
                "dataType",
                "constraint"
              ],
              "additionalProperties": false
            },
            "maxItems": 50
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "filter": {
      "type": "string"
    },
    "filterField": {
      "type": "string"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Data Tables Example

{
  "items": [
    {
      "id": "596e6ce831761df4231708f1",
      "dataTableId": "596e6ce831761df4231708f1",
      "applicationId": "575ec8687ae143cd83dc4a97",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "name": "My Data Table",
      "columns": [
        {
          "name": "myColumn1",
          "dataType": "string",
          "constraint": "unique"
        },
        {
          "name": "myColumn2",
          "dataType": "number",
          "constraint": "optional"
        }
      ]
    }
  ],
  "count": 1,
  "totalCount": 4,
  "perPage": 1,
  "page": 0,
  "sortField": "name",
  "sortDirection": "asc",
  "applicationId": "575ec8687ae143cd83dc4a97"
}

Device

Schema for a single Device

Device Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "deviceId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "gps",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "maxItems": 256
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "gatewayId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "edgeAgentVersion": {
      "type": "string",
      "pattern": "^(0|([1-9]\\d*))\\.(0|([1-9]\\d*))\\.(0|([1-9]\\d*))$"
    },
    "connectionInfo": {
      "type": "object",
      "properties": {
        "time": {
          "type": "string",
          "format": "date-time"
        },
        "connected": {
          "enum": [
            1,
            0,
            null
          ]
        }
      }
    }
  }
}

Device Example

{
  "id": "575ecf887ae143cd83dc4aa2",
  "deviceId": "575ecf887ae143cd83dc4aa2",
  "applicationId": "575ec8687ae143cd83dc4a97",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "name": "My Device",
  "description": "A device description",
  "tags": [
    {
      "key": "TagKey",
      "value": "TagValue"
    },
    {
      "key": "floor",
      "value": "8"
    }
  ],
  "attributes": [
    {
      "name": "voltage",
      "dataType": "number"
    }
  ],
  "deviceClass": "standalone",
  "connectionInfo": {
    "time": "2016-06-14T08:15:00.000Z",
    "connected": 1
  }
}

Device Command

Schema for a command for a single Device

Device Command Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "time": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "object",
          "properties": {
            "$date": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "$date"
          ]
        }
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "payload": {}
  },
  "required": [
    "name"
  ],
  "additionalProperties": false
}

Device Command Example

{
  "time": "2016-06-13T04:00:00.000Z",
  "name": "myCommand",
  "payload": [
    1,
    1,
    2,
    3,
    5
  ]
}

Device Commands

Schema for an array of Device Commands

Device Commands Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array",
  "items": {
    "title": "Device Command",
    "description": "Schema for a command for a single Device",
    "type": "object",
    "properties": {
      "time": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "object",
            "properties": {
              "$date": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "required": [
              "$date"
            ]
          }
        ]
      },
      "name": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255
      },
      "payload": {}
    },
    "required": [
      "name"
    ],
    "additionalProperties": false
  }
}

Device Commands Example

[
  {
    "time": "2016-06-13T04:00:00.000Z",
    "name": "myCommand",
    "payload": [
      1,
      1,
      2,
      3,
      5
    ]
  },
  {
    "time": "2016-06-13T04:00:00.000Z",
    "name": "myCommand",
    "payload": [
      1,
      1,
      2,
      3,
      5
    ]
  }
]

Device Connection Status

Schema for the body of a request to set a device’s connection status

Device Connection Status Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "oneOf": [
    {
      "title": "Device Connected",
      "description": "Schema for marking a device as connected",
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "connected"
          ]
        },
        "connectedAt": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "object",
              "properties": {
                "$date": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "$date"
              ]
            }
          ]
        }
      },
      "required": [
        "status"
      ],
      "additionalProperties": false
    },
    {
      "title": "Device Disconnected",
      "description": "Schema for marking a device as disconnected",
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "disconnected"
          ]
        },
        "connectedAt": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "object",
              "properties": {
                "$date": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "$date"
              ]
            }
          ]
        },
        "disconnectedAt": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "object",
              "properties": {
                "$date": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "$date"
              ]
            }
          ]
        },
        "disconnectReason": {
          "type": "string",
          "maxLength": 1024
        },
        "messagesFromClient": {
          "type": "number"
        },
        "messagesToClient": {
          "type": "number"
        }
      },
      "required": [
        "status"
      ],
      "additionalProperties": false
    }
  ]
}

Device Connection Status Example

{
  "status": "connected"
}

Device Credentials

Schema for the body of a Device authentication request

Device Credentials Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "deviceId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "key": {
      "type": "string"
    },
    "secret": {
      "type": "string"
    },
    "tokenTTL": {
      "type": "integer",
      "minimum": 0
    },
    "requestedScopes": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "all.Device",
          "all.Device.read",
          "data.export",
          "data.timeSeriesQuery",
          "data.lastValueQuery",
          "device.commandStream",
          "device.get",
          "device.getCompositeState",
          "device.getState",
          "device.stateStream",
          "device.getLogEntries",
          "device.getCommand",
          "device.debug",
          "device.sendState",
          "device.sendCommand",
          "device.setConnectionStatus",
          "devices.get",
          "devices.sendCommand"
        ]
      }
    }
  },
  "required": [
    "deviceId",
    "key",
    "secret"
  ],
  "additionalProperties": false
}

Device Credentials Example

{
  "deviceId": "575ecf887ae143cd83dc4aa2",
  "key": "this_would_be_the_key",
  "secret": "this_would_be_the_secret"
}

Device Log

Log of connection information for a Device

Device Log Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "connected": {
        "enum": [
          1,
          0
        ]
      },
      "time": {
        "type": "string",
        "format": "date-time"
      },
      "disconnectReason": {
        "type": "string"
      },
      "messagesFromClient": {
        "type": "number"
      },
      "messagesToClient": {
        "type": "number"
      }
    }
  }
}

Device Log Example

[
  {
    "connected": 1,
    "time": "2016-06-03T00:56:22.447Z"
  },
  {
    "connected": 0,
    "disconnectReason": "Connection Lost",
    "messagesFromClient": 2548,
    "messagesToClient": 0,
    "time": "2016-06-03T00:56:21.028Z"
  },
  {
    "connected": 1,
    "time": "2016-06-01T06:24:39.190Z"
  },
  {
    "connected": 0,
    "disconnectReason": "Connection Lost",
    "messagesFromClient": 479,
    "messagesToClient": 0,
    "time": "2016-06-01T06:24:37.925Z"
  },
  {
    "connected": 1,
    "time": "2016-05-31T22:24:48.777Z"
  }
]

Device Patch

Schema for the body of a Device modification request

Device Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "gps",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "maxItems": 256
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "gatewayId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  },
  "additionalProperties": false
}

Device Patch Example

{
  "name": "My Updated Device",
  "description": "Description of my updated device",
  "tags": [
    {
      "key": "TagKey",
      "value": "TagValue"
    }
  ],
  "attributes": [
    {
      "name": "voltage",
      "dataType": "number"
    }
  ],
  "deviceClass": "standalone"
}

Device Post

Schema for the body of a Device creation request

Device Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "gps",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "maxItems": 256
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "gatewayId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Device Post Example

{
  "name": "My New Device",
  "description": "Description of my new device",
  "tags": [
    {
      "key": "TagKey",
      "value": "TagValue"
    }
  ],
  "attributes": [
    {
      "name": "voltage",
      "dataType": "number"
    }
  ],
  "deviceClass": "standalone"
}

Device Recipe

Schema for a single Device Recipe

Device Recipe Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "deviceRecipeId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time"
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "deviceName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "deviceDescription": {
      "type": "string",
      "maxLength": 32767
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "gps",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "maxItems": 256
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "gatewayId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Device Recipe Example

{
  "id": "575ecec57ae143cd83dc4a9f",
  "deviceRecipeId": "575ecec57ae143cd83dc4a9f",
  "applicationId": "575ec8687ae143cd83dc4a97",
  "creationDate": "2016-06-13T04:00:00.000Z",
  "lastUpdated": "2016-06-13T04:00:00.000Z",
  "name": "Actual recipe name",
  "deviceName": "Future device name",
  "description": "My recipe description",
  "deviceDescription": "Future device description",
  "tags": [
    {
      "key": "TagKey",
      "value": "TagValue"
    }
  ],
  "attributes": [
    {
      "name": "voltage",
      "dataType": "number"
    }
  ],
  "deviceClass": "standalone"
}

Device Recipe Bulk Create

Schema for the result of a bulk Device creation request

Device Recipe Bulk Create Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "created": {
      "type": "number"
    },
    "failed": {
      "type": "number"
    },
    "csvResult": {
      "type": "string"
    }
  }
}

Device Recipe Bulk Create Example

{
  "created": 10,
  "failed": 0,
  "csvResult": "a,comma,separated,string,of,results"
}

Device Recipe Bulk Create Enqueue

Schema for the result of a bulk Device creation request when creating more than 750 devices

Device Recipe Bulk Create Enqueue Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jobQueued": {
      "type": "boolean"
    }
  }
}

Device Recipe Bulk Create Enqueue Example

{
  "jobQueued": true
}

Device Recipe Bulk Create Post

Schema for the body of a bulk Device creation request

Device Recipe Bulk Create Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "nameColumn": {
      "type": "string"
    },
    "descriptionColumn": {
      "type": "string"
    },
    "csv": {
      "type": "string"
    },
    "makeUniqueKeySecret": {
      "type": "boolean"
    },
    "email": {
      "type": "string",
      "format": "email",
      "maxLength": 1024
    }
  },
  "additionalProperties": false,
  "required": [
    "csv"
  ]
}

Device Recipe Bulk Create Post Example

{
  "nameColumn": "myNameColumn",
  "descriptionColumn": "column2",
  "csv": "a,comma,separated,string,of,input,data"
}

Device Recipe Patch

Schema for the body of a Device Recipe modification request

Device Recipe Patch Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "deviceName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "deviceDescription": {
      "type": "string",
      "maxLength": 32767
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "gps",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "maxItems": 256
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "gatewayId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  },
  "additionalProperties": false
}

Device Recipe Patch Example

{
  "name": "My Updated Device Recipe",
  "deviceName": "Future device name",
  "description": "Description of my updated device recipe",
  "deviceDescription": "Future device description",
  "tags": [
    {
      "key": "TagKey",
      "value": "TagValue"
    }
  ],
  "attributes": [
    {
      "name": "voltage",
      "dataType": "number"
    }
  ],
  "deviceClass": "standalone"
}

Device Recipe Post

Schema for the body of a Device Recipe creation request

Device Recipe Post Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "deviceName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "maxLength": 32767
    },
    "deviceDescription": {
      "type": "string",
      "maxLength": 32767
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[0-9a-zA-Z_-]{1,255}$"
          },
          "dataType": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "gps",
              "boolean"
            ]
          }
        },
        "required": [
          "name",
          "dataType"
        ],
        "additionalProperties": false
      },
      "maxItems": 256
    },
    "deviceClass": {
      "type": "string",
      "enum": [
        "standalone",
        "gateway",
        "peripheral",
        "floating",
        "edgeCompute"
      ]
    },
    "gatewayId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}

Device Recipe Post Example

{
  "name": "My New Device Recipe",
  "deviceName": "Future device name",
  "description": "Description of my new device recipe",
  "deviceDescription": "Future device description",
  "tags": [
    {
      "key": "TagKey",
      "value": "TagValue"
    }
  ],
  "attributes": [
    {
      "name": "voltage",
      "dataType": "number"
    }
  ],
  "deviceClass": "standalone"
}

Device Recipes

Schema for a collection of Device Recipes

Device Recipes Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "title": "Device Recipe",
        "description": "Schema for a single Device Recipe",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "deviceRecipeId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastUpdated": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "deviceName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 32767
          },
          "deviceDescription": {
            "type": "string",
            "maxLength": 32767
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255
                }
              },
              "required": [
                "key",
                "value"
              ],
              "additionalProperties": false
            },
            "maxItems": 100
          },
          "attributes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                },
                "dataType": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "gps",
                    "boolean"
                  ]
                }
              },
              "required": [
                "name",
                "dataType"
              ],
              "additionalProperties": false
            },
            "maxItems": 256
          },
          "deviceClass": {
            "type": "string",
            "enum": [
              "standalone",
              "gateway",
              "peripheral",
              "floating",
              "edgeCompute"
            ]
          },
          "gatewayId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
          }
        }
      }
    },
    "count": {
      "type": "integer"
    },
    "totalCount": {
      "type": "integer"
    },
    "perPage": {
      "type": "integer"
    },
    "page": {
      "type": "integer"
    },
    "filter": {
      "type": "string"
    },
    "filterField": {
      "type": "string"
    },
    "sortField": {
      "type": "string"
    },
    "sortDirection": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "applicationId": {
      "type": "string",
      "pattern": "^[A-Fa-f\\d]{24}$"
    }
  }
}

Device Recipes Example

{
  "items": [
    {
      "id": "575ecec57ae143cd83dc4a9f",
      "deviceRecipeId": "575ecec57ae143cd83dc4a9f",
      "applicationId": "575ec8687ae143cd83dc4a97",
      "creationDate": "2016-06-13T04:00:00.000Z",
      "lastUpdated": "2016-06-13T04:00:00.000Z",
      "name": "Actual recipe name",
      "deviceName": "Future device name",
      "description": "My recipe description",
      "deviceDescription": "Future device description",
      "tags": [
        {
          "key": "TagKey",
          "value": "TagValue"
        }
      ],
      "attributes": [
        {
          "name": "voltage",
          "dataType": "number"
        }
      ],
      "deviceClass": "standalone"
    }
  ],
  "count": 1,
  "totalCount": 4,
  "perPage": 1,
  "page": 0,
  "sortField": "name",
  "sortDirection": "asc",
  "applicationId": "575ec8687ae143cd83dc4a97"
}

Device State

Schema for a single Device state

Device State Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "time": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "object",
          "properties": {
            "$date": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "$date"
          ]
        }
      ]
    },
    "meta": {},
    "data": {
      "type": "object",
      "patternProperties": {
        "^[0-9a-zA-Z_-]{1,255}$": {
          "type": [
            "number",
            "string",
            "boolean"
          ]
        }
      },
      "additionalProperties": false
    },
    "flowVersion": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}

Device State Example

{
  "time": "2016-06-13T04:00:00.000Z",
  "data": {
    "voltage": 22.4
  }
}

Device State or States

Schema for a single device state or an array of device states

Device State or States Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "oneOf": [
    {
      "title": "Device State",
      "description": "Schema for a single Device state",
      "type": "object",
      "properties": {
        "time": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "object",
              "properties": {
                "$date": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "$date"
              ]
            }
          ]
        },
        "meta": {},
        "data": {
          "type": "object",
          "patternProperties": {
            "^[0-9a-zA-Z_-]{1,255}$": {
              "type": [
                "number",
                "string",
                "boolean"
              ]
            }
          },
          "additionalProperties": false
        },
        "flowVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "required": [
        "data"
      ],
      "additionalProperties": false
    },
    {
      "title": "Device States",
      "description": "Schema for an array of Device states",
      "type": "array",
      "items": {
        "title": "Device State",
        "description": "Schema for a single Device state",
        "type": "object",
        "properties": {
          "time": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type":