ThingsBoard Telemetry API

Read and write device/asset time-series telemetry and key/value attributes (CLIENT/SERVER/SHARED scopes), run entity queries, and manage calculated fields. 26 endpoints.

ThingsBoard Telemetry API is one of 15 APIs that ThingsBoard publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

This API exposes 1 machine-runnable capability that can be deployed as REST, MCP, or Agent Skill surfaces via Naftiko.

Tagged areas include IoT, Telemetry, TimeSeries, Attributes, and CalculatedFields. The published artifact set on APIs.io includes API documentation, an OpenAPI specification, and 1 Naftiko capability spec.

OpenAPI Specification

thingsboard-telemetry-openapi.yml Raw ↑
# ThingsBoard ThingsBoard Telemetry API
# Source: https://demo.thingsboard.io/v3/api-docs (Apache 2.0)
openapi: 3.1.0
info:
  title: ThingsBoard Telemetry API
  description: "ThingsBoard Telemetry API \u2014 subset of the ThingsBoard REST API (open-source IoT platform). Covers: Telemetry, Entity Query, Calculated Field."
  version: 4.3.0.3DEMO
  contact:
    name: ThingsBoard team
    url: https://thingsboard.io
    email: [email protected]
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://demo.thingsboard.io
  description: ThingsBoard Live Demo
- url: http://localhost:8080
  description: Local ThingsBoard server
tags:
- name: telemetry-controller
  description: Telemetry
- name: entity-query-controller
  description: Entity Query
- name: calculated-field-controller
  description: Calculated Field
paths:
  /api/plugins/telemetry/{entityType}/{entityId}/{scope}:
    post:
      tags:
      - telemetry-controller
      summary: Save Entity Attributes (saveEntityAttributesV1)
      description: "Creates or updates the entity attributes based on Entity Id and the specified attribute scope.  List of possible attribute scopes depends on the entity type: \n\n * SERVER_SCOPE - supported\
        \ for all entity types;\n * SHARED_SCOPE - supported for devices.\n\nThe request payload is a JSON object with key-value format of attributes to create or update. For example:\n\n```json\n{\n \"\
        stringKey\":\"value1\", \n \"booleanKey\":true, \n \"doubleKey\":42.0, \n \"longKey\":73, \n \"jsonKey\": {\n    \"someNumber\": 42,\n    \"someArray\": [1,2,3],\n    \"someNestedObject\": {\"key\"\
        : \"value\"}\n }\n}\n```\nReferencing a non-existing entity Id or invalid entity type will cause an error. \n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."
      operationId: saveEntityAttributesV1
      parameters:
      - name: entityType
        in: path
        description: A string value representing the entity type. For example, 'DEVICE'
        required: true
        schema:
          type: string
      - name: entityId
        in: path
        description: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: A string value representing the attributes scope. For example, 'SERVER_SCOPE'.
        required: true
        schema:
          type: string
          enum:
          - SERVER_SCOPE
          - SHARED_SCOPE
      requestBody:
        description: A string value representing the json object. For example, '{"key":"value"}'. See API call description for more details.
        content:
          application/json:
            schema:
              type: string
        required: true
      responses:
        '200':
          description: Attribute from the request was created or updated. Platform creates an audit log event about entity attributes updates with action type 'ATTRIBUTES_UPDATED', and also sends event
            msg to the rule engine with msg type 'ATTRIBUTES_UPDATED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Invalid structure of the request or invalid attributes scope provided.
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to save entity attributes for selected entity. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about entity attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
    delete:
      tags:
      - telemetry-controller
      summary: Delete Entity Attributes (deleteEntityAttributes)
      description: "Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. \n\nAvailable for users\
        \ with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."
      operationId: deleteEntityAttributes
      parameters:
      - name: entityType
        in: path
        description: A string value representing the entity type. For example, 'DEVICE'
        required: true
        schema:
          type: string
      - name: entityId
        in: path
        description: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: A string value representing the attributes scope. For example, 'SERVER_SCOPE'.
        required: true
        schema:
          type: string
          enum:
          - SERVER_SCOPE
          - SHARED_SCOPE
          - CLIENT_SCOPE
      - name: keys
        in: query
        description: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. If attribute keys contain comma, duplicate 'key' parameter for each
          key, for example '?key=my,key&key=my,second,key
        required: false
        schema:
          type: string
      - name: params
        in: query
        required: true
        schema:
          $ref: '#/components/schemas/MultiValueMapStringString'
      responses:
        '200':
          description: Entity attributes was removed for the selected keys in the request. Platform creates an audit log event about entity attributes removal with action type 'ATTRIBUTES_DELETED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Platform returns a bad request in case if keys or scope are not specified.
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to delete entity attributes for selected entity. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about entity attributes removal with action type 'ATTRIBUTES_DELETED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
  /api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}:
    post:
      tags:
      - telemetry-controller
      summary: Save or Update Time Series Data (saveEntityTelemetry)
      description: "Creates or updates the entity time series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats:\n\nSimple format without\
        \ timestamp. In such a case, current server time will be used: \n\n```json\n{\"temperature\": 26}\n```\n\n Single JSON object with timestamp: \n\n```json\n{\"ts\":1634712287000,\"values\":{\"temperature\"\
        :26, \"humidity\":87}}\n```\n\n JSON array with timestamps: \n\n```json\n[{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\"\
        :25, \"humidity\":88}}]\n```\n\n The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing\
        \ entity Id or invalid entity type will cause an error. \n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."
      operationId: saveEntityTelemetry
      parameters:
      - name: entityType
        in: path
        description: A string value representing the entity type. For example, 'DEVICE'
        required: true
        schema:
          type: string
      - name: entityId
        in: path
        description: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility
        required: true
        schema:
          type: string
          enum:
          - ANY
      requestBody:
        description: A JSON with the telemetry values. See API call description for more details.
        content:
          application/json:
            schema:
              type: string
        required: true
      responses:
        '200':
          description: Time series from the request was created or updated. Platform creates an audit log event about entity time series updates with action type 'TIMESERIES_UPDATED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Invalid structure of the request
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to save entity time series for selected entity. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about entity time series updates with action type 'TIMESERIES_UPDATED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
  /api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}/{ttl}:
    post:
      tags:
      - telemetry-controller
      summary: Save or Update Time Series Data with TTL (saveEntityTelemetryWithTTL)
      description: "Creates or updates the entity time series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats:\n\nSimple format without\
        \ timestamp. In such a case, current server time will be used: \n\n```json\n{\"temperature\": 26}\n```\n\n Single JSON object with timestamp: \n\n```json\n{\"ts\":1634712287000,\"values\":{\"temperature\"\
        :26, \"humidity\":87}}\n```\n\n JSON array with timestamps: \n\n```json\n[{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\"\
        :25, \"humidity\":88}}]\n```\n\n The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. \n\nThe ttl parameter\
        \ takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. \n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."
      operationId: saveEntityTelemetryWithTTL
      parameters:
      - name: entityType
        in: path
        description: A string value representing the entity type. For example, 'DEVICE'
        required: true
        schema:
          type: string
      - name: entityId
        in: path
        description: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility
        required: true
        schema:
          type: string
          enum:
          - ANY
      - name: ttl
        in: path
        description: A long value representing TTL (Time to Live) parameter.
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        description: A JSON with the telemetry values. See API call description for more details.
        content:
          application/json:
            schema:
              type: string
        required: true
      responses:
        '200':
          description: Time series from the request was created or updated. Platform creates an audit log event about entity time series updates with action type 'TIMESERIES_UPDATED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Invalid structure of the request
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to save entity time series for selected entity. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about entity time series updates with action type 'TIMESERIES_UPDATED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
  /api/plugins/telemetry/{entityType}/{entityId}/attributes/{scope}:
    post:
      tags:
      - telemetry-controller
      summary: Save Entity Attributes (saveEntityAttributesV2)
      description: "Creates or updates the entity attributes based on Entity Id and the specified attribute scope.  List of possible attribute scopes depends on the entity type: \n\n * SERVER_SCOPE - supported\
        \ for all entity types;\n * SHARED_SCOPE - supported for devices.\n\nThe request payload is a JSON object with key-value format of attributes to create or update. For example:\n\n```json\n{\n \"\
        stringKey\":\"value1\", \n \"booleanKey\":true, \n \"doubleKey\":42.0, \n \"longKey\":73, \n \"jsonKey\": {\n    \"someNumber\": 42,\n    \"someArray\": [1,2,3],\n    \"someNestedObject\": {\"key\"\
        : \"value\"}\n }\n}\n```\nReferencing a non-existing entity Id or invalid entity type will cause an error. \n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."
      operationId: saveEntityAttributesV2
      parameters:
      - name: entityType
        in: path
        description: A string value representing the entity type. For example, 'DEVICE'
        required: true
        schema:
          type: string
      - name: entityId
        in: path
        description: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: A string value representing the attributes scope. For example, 'SERVER_SCOPE'.
        required: true
        schema:
          type: string
          enum:
          - SERVER_SCOPE
          - SHARED_SCOPE
      requestBody:
        description: A string value representing the json object. For example, '{"key":"value"}'. See API call description for more details.
        content:
          application/json:
            schema:
              type: string
        required: true
      responses:
        '200':
          description: Attribute from the request was created or updated. Platform creates an audit log event about entity attributes updates with action type 'ATTRIBUTES_UPDATED', and also sends event
            msg to the rule engine with msg type 'ATTRIBUTES_UPDATED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Invalid structure of the request or invalid attributes scope provided.
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to save entity attributes for selected entity. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about entity attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
  /api/plugins/telemetry/{deviceId}/{scope}:
    post:
      tags:
      - telemetry-controller
      summary: Save Device Attributes (saveDeviceAttributes)
      description: "Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update.\
        \ For example:\n\n```json\n{\n \"stringKey\":\"value1\", \n \"booleanKey\":true, \n \"doubleKey\":42.0, \n \"longKey\":73, \n \"jsonKey\": {\n    \"someNumber\": 42,\n    \"someArray\": [1,2,3],\n\
        \    \"someNestedObject\": {\"key\": \"value\"}\n }\n}\n```\n\n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."
      operationId: saveDeviceAttributes
      parameters:
      - name: deviceId
        in: path
        description: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: A string value representing the attributes scope. For example, 'SERVER_SCOPE'.
        required: true
        schema:
          type: string
          enum:
          - SERVER_SCOPE
          - SHARED_SCOPE
      requestBody:
        description: A string value representing the json object. For example, '{"key":"value"}'. See API call description for more details.
        content:
          application/json:
            schema:
              type: string
        required: true
      responses:
        '200':
          description: Attribute from the request was created or updated. Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED', and also sends event
            msg to the rule engine with msg type 'ATTRIBUTES_UPDATED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Invalid structure of the request or invalid attributes scope provided.
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to save device attributes for selected device. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
    delete:
      tags:
      - telemetry-controller
      summary: Delete Device Attributes (deleteDeviceAttributes)
      description: 'Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error


        Available for users with ''TENANT_ADMIN'' or ''CUSTOMER_USER'' authority.'
      operationId: deleteDeviceAttributes
      parameters:
      - name: deviceId
        in: path
        description: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
        required: true
        schema:
          type: string
      - name: scope
        in: path
        description: A string value representing the attributes scope. For example, 'SERVER_SCOPE'.
        required: true
        schema:
          type: string
          enum:
          - SERVER_SCOPE
          - SHARED_SCOPE
          - CLIENT_SCOPE
      - name: keys
        in: query
        description: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. If attribute keys contain comma, duplicate 'key' parameter for each
          key, for example '?key=my,key&key=my,second,key
        required: false
        schema:
          type: string
      - name: params
        in: query
        required: true
        schema:
          $ref: '#/components/schemas/MultiValueMapStringString'
      responses:
        '200':
          description: Device attributes was removed for the selected keys in the request. Platform creates an audit log event about device attributes removal with action type 'ATTRIBUTES_DELETED'.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Platform returns a bad request in case if keys or scope are not specified.
          content:
            application/json:
              schema:
                type: string
        '401':
          description: User is not authorized to delete device attributes for selected entity. Most likely, User belongs to different Customer or Tenant.
          content:
            application/json:
              schema:
                type: string
        '500':
          description: The exception was thrown during processing the request. Platform creates an audit log event about device attributes removal with action type 'ATTRIBUTES_DELETED' that includes an
            error stacktrace.
          content:
            application/json:
              schema:
                type: string
  /api/entitiesQuery/find:
    post:
      tags:
      - entity-query-controller
      summary: Find Entity Data by Query
      description: "Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated\
        \ result of the query that contains requested entity fields and latest values of requested attributes and time series data.\n\n# Query Definition\n\n\n\nMain **entity filter** is mandatory and defines\
        \ generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\"\n\nOptional **key filters** allow to filter results\
        \ of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts\
        \ with 'T', and attribute 'model' is 'T1000', and time series field 'batteryLevel' > 40\".\n\nThe **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry\
        \ fields to fetch for each entity.\n\nThe **page link** contains information about the page to fetch and the sort ordering.\n\nLet's review the example:\n\n```json\n{\n  \"entityFilter\": {\n  \
        \  \"type\": \"entityType\",\n    \"resolveMultiple\": true,\n    \"entityType\": \"DEVICE\"\n  },\n  \"keyFilters\": [\n    {\n      \"key\": {\n        \"type\": \"TIME_SERIES\",\n        \"key\"\
        : \"temperature\"\n      },\n      \"valueType\": \"NUMERIC\",\n      \"predicate\": {\n        \"operation\": \"GREATER\",\n        \"value\": {\n          \"defaultValue\": 0,\n          \"dynamicValue\"\
        : {\n            \"sourceType\": \"CURRENT_USER\",\n            \"sourceAttribute\": \"temperatureThreshold\",\n            \"inherit\": false\n          }\n        },\n        \"type\": \"NUMERIC\"\
        \n      }\n    }\n  ],\n  \"entityFields\": [\n    {\n      \"type\": \"ENTITY_FIELD\",\n      \"key\": \"name\"\n    },\n    {\n      \"type\": \"ENTITY_FIELD\",\n      \"key\": \"label\"\n   \
        \ },\n    {\n      \"type\": \"ENTITY_FIELD\",\n      \"key\": \"additionalInfo\"\n    }\n  ],\n  \"latestValues\": [\n    {\n      \"type\": \"ATTRIBUTE\",\n      \"key\": \"model\"\n    },\n \
        \   {\n      \"type\": \"TIME_SERIES\",\n      \"key\": \"temperature\"\n    }\n  ],\n  \"pageLink\": {\n    \"page\": 0,\n    \"pageSize\": 10,\n    \"sortOrder\": {\n      \"key\": {\n       \
        \ \"key\": \"name\",\n        \"type\": \"ENTITY_FIELD\"\n      },\n      \"direction\": \"ASC\"\n    }\n  }\n}\n```\n\n Example mentioned above search all devices which have attribute 'active'\
        \ set to 'true'. Now let's review available entity filters and key filters syntax:\n\n # Entity Filters\nEntity Filter body depends on the 'type' parameter. Let's review available entity filter\
        \ types. In fact, they do correspond to available dashboard aliases.\n\n## Single Entity\n\nAllows to filter only one entity based on the id. For example, this entity filter selects certain device:\n\
        \n```json\n{\n  \"type\": \"singleEntity\",\n  \"singleEntity\": {\n    \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\",\n    \"entityType\": \"DEVICE\"\n  }\n}\n```\n\n## Entity List Filter\n\n\
        Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices:\n\n```json\n{\n  \"type\": \"entityList\",\n  \"entityType\": \"DEVICE\",\n  \"entityList\"\
        : [\n    \"e6501f30-2a7a-11ec-94eb-213c95f54092\",\n    \"e6657bf0-2a7a-11ec-94eb-213c95f54092\"\n  ]\n}\n```\n\n## Entity Name Filter\n\nAllows to filter entities of the same type using the **'starts\
        \ with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality':\n\n```json\n{\n  \"type\": \"entityName\",\n  \"entityType\": \"\
        DEVICE\",\n  \"entityNameFilter\": \"Air Quality\"\n}\n```\n\n## Entity Type Filter\n\nAllows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this\
        \ entity filter selects all tenant customers:\n\n```json\n{\n  \"type\": \"entityType\",\n  \"entityType\": \"CUSTOMER\"\n}\n```\n\n## Asset Type Filter\n\nAllows to filter assets based on their\
        \ type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla':\n\n```json\n{\n  \"type\": \"assetType\"\
        ,\n  \"assetType\": \"charging station\",\n  \"assetNameFilter\": \"Tesla\"\n}\n```\n\n## Device Type Filter\n\nAllows to filter devices based on their type and the **'starts with'** expression\
        \ over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC':\n\n```json\n{\n  \"type\": \"deviceType\",\n  \"deviceType\": \"Temperature\
        \ Sensor\",\n  \"deviceNameFilter\": \"ABC\"\n}\n```\n\n## Edge Type Filter\n\nAllows to filter edge instances based on their type and the **'starts with'** expression over their name. For example,\
        \ this entity filter selects all 'Factory' edge instances which name starts with 'Nevada':\n\n```json\n{\n  \"type\": \"edgeType\",\n  \"edgeType\": \"Factory\",\n  \"edgeNameFilter\": \"Nevada\"\
        \n}\n```\n\n## Entity View Filter\n\nAllows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete\
        \ Mixer' entity views which name starts with 'CAT':\n\n```json\n{\n  \"type\": \"entityViewType\",\n  \"entityViewType\": \"Concrete Mixer\",\n  \"entityViewNameFilter\": \"CAT\"\n}\n```\n\n## Api\
        \ Usage Filter\n\nAllows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage'\
        \ entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092':\n\n```json\n{\n  \"type\": \"apiUsageState\",\n  \"customerId\": {\n    \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\",\n\
        \    \"entityType\": \"CUSTOMER\"\n  }\n}\n```\n\n## Relations Query Filter\n\nAllows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'.\
        \ The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or\
        \ only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates\
        \ all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'.\n\nFor example, this entity filter selects all devices and\
        \ assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092':\n\n```json\n{\n  \"type\": \"relationsQuery\",\n  \"rootEntity\": {\n    \"entityType\": \"ASSET\",\n    \"\
        id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\"\n  },\n  \"direction\": \"FROM\",\n  \"maxLevel\": 1,\n  \"fetchLastLevelOnly\": false,\n  \"filters\": [\n    {\n      \"relationType\": \"Contains\"\
        ,\n      \"entityTypes\": [\n        \"DEVICE\",\n        \"ASSET\"\n      ]\n    }\n  ]\n}\n```\n\n## Asset Search Query\n\nAllows to filter assets that are related to the provided root entity.\
        \ Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search\
        \ 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType'\
        \ defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using\
        \ different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions.\n\nFor example, this entity filter selects 'charging station' assets which are related\
        \ to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n  \"type\": \"assetSearchQuery\",\n  \"rootEntity\": {\n    \"entityType\": \"ASSET\",\n \
        \   \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\"\n  },\n  \"direction\": \"FROM\",\n  \"maxLevel\": 1,\n  \"fetchLastLevelOnly\": false,\n  \"relationType\": \"Contains\",\n  \"assetTypes\"\
        : [\n    \"charging station\"\n  ]\n}\n```\n\n## Device Search Query\n\nAllows to filter devices that are related to the provided root entity. Filters related devices based on the relation type\
        \ and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the\
        \ 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for.\
        \ The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts\
        \ only devices that match 'relationType' and 'deviceTypes' conditions.\n\nFor example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset\
        \ with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation:\n\n```json\n{\n  \"type\": \"deviceSearchQuery\",\n  \"rootEntity\": {\n    \"entityType\": \"ASSET\",\n    \"id\": \"\
        e52b0020-2a7a-11ec-94eb-213c95f54092\"\n  },\n  \"direction\": \"FROM\",\n  \"maxLevel\": 2,\n  \"fetchLastLevelOnly\": true,\n  \"relationType\": \"Contains\",\n  \"deviceTypes\": [\n    \"Air\
        \ Quality Sensor\",\n    \"Charging port\"\n  ]\n}\n```\n\n## Entity Vi

# --- truncated at 32 KB (145 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/thingsboard/refs/heads/main/openapi/thingsboard-telemetry-openapi.yml