openapi: 3.1.0
info:
title: ThingsBoard Admin admin-controller audit-log-controller API
description: 'ThingsBoard Admin API — subset of the ThingsBoard REST API (open-source IoT platform). Covers: Admin, Audit Log, Event, Usage Info, Queue, Queue Stats, Mail Config Template, Qr Code Settings, Job.'
version: 4.3.0.3DEMO
contact:
name: ThingsBoard team
url: https://thingsboard.io
email: info@thingsboard.io
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: audit-log-controller
description: Audit Log
paths:
/api/audit/logs:
get:
tags:
- audit-log-controller
summary: Get All Audit Logs (getAuditLogs)
description: "Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details. \n\nAvailable for users with 'TENANT_ADMIN' authority."
operationId: getAuditLogs
parameters:
- name: pageSize
in: query
description: Maximum amount of entities in a one page
required: true
schema:
type: integer
format: int32
- name: page
in: query
description: Sequence number of page starting from 0
required: true
schema:
type: integer
format: int32
- name: textSearch
in: query
description: 'The case insensitive ''substring'' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus.'
required: false
schema:
type: string
- name: sortProperty
in: query
description: 'Property of audit log to sort by. See the ''Model'' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged.'
required: false
schema:
type: string
enum:
- createdTime
- entityType
- entityName
- userName
- actionType
- actionStatus
- name: sortOrder
in: query
description: Sort order. ASC (ASCENDING) or DESC (DESCENDING)
required: false
schema:
type: string
enum:
- ASC
- DESC
- name: startTime
in: query
description: 'The start timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: endTime
in: query
description: 'The end timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: actionTypes
in: query
description: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details.
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PageDataAuditLog'
/api/audit/logs/user/{userId}:
get:
tags:
- audit-log-controller
summary: Get Audit Logs by User Id (getAuditLogsByUserId)
description: "Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details. \n\nAvailable for users with 'TENANT_ADMIN' authority."
operationId: getAuditLogsByUserId
parameters:
- name: userId
in: path
description: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
required: true
schema:
type: string
- name: pageSize
in: query
description: Maximum amount of entities in a one page
required: true
schema:
type: integer
format: int32
- name: page
in: query
description: Sequence number of page starting from 0
required: true
schema:
type: integer
format: int32
- name: textSearch
in: query
description: 'The case insensitive ''substring'' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus.'
required: false
schema:
type: string
- name: sortProperty
in: query
description: 'Property of audit log to sort by. See the ''Model'' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged.'
required: false
schema:
type: string
enum:
- createdTime
- entityType
- entityName
- userName
- actionType
- actionStatus
- name: sortOrder
in: query
description: Sort order. ASC (ASCENDING) or DESC (DESCENDING)
required: false
schema:
type: string
enum:
- ASC
- DESC
- name: startTime
in: query
description: 'The start timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: endTime
in: query
description: 'The end timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: actionTypes
in: query
description: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details.
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PageDataAuditLog'
/api/audit/logs/entity/{entityType}/{entityId}:
get:
tags:
- audit-log-controller
summary: Get Audit Logs by Entity Id (getAuditLogsByEntityId)
description: "Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details. \n\nAvailable for users with 'TENANT_ADMIN' authority."
operationId: getAuditLogsByEntityId
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: pageSize
in: query
description: Maximum amount of entities in a one page
required: true
schema:
type: integer
format: int32
- name: page
in: query
description: Sequence number of page starting from 0
required: true
schema:
type: integer
format: int32
- name: textSearch
in: query
description: 'The case insensitive ''substring'' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus.'
required: false
schema:
type: string
- name: sortProperty
in: query
description: 'Property of audit log to sort by. See the ''Model'' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged.'
required: false
schema:
type: string
enum:
- createdTime
- entityType
- entityName
- userName
- actionType
- actionStatus
- name: sortOrder
in: query
description: Sort order. ASC (ASCENDING) or DESC (DESCENDING)
required: false
schema:
type: string
enum:
- ASC
- DESC
- name: startTime
in: query
description: 'The start timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: endTime
in: query
description: 'The end timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: actionTypes
in: query
description: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details.
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PageDataAuditLog'
/api/audit/logs/customer/{customerId}:
get:
tags:
- audit-log-controller
summary: Get Audit Logs by Customer Id (getAuditLogsByCustomerId)
description: "Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details. \n\nAvailable for users with 'TENANT_ADMIN' authority."
operationId: getAuditLogsByCustomerId
parameters:
- name: customerId
in: path
description: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'
required: true
schema:
type: string
- name: pageSize
in: query
description: Maximum amount of entities in a one page
required: true
schema:
type: integer
format: int32
- name: page
in: query
description: Sequence number of page starting from 0
required: true
schema:
type: integer
format: int32
- name: textSearch
in: query
description: 'The case insensitive ''substring'' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus.'
required: false
schema:
type: string
- name: sortProperty
in: query
description: 'Property of audit log to sort by. See the ''Model'' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged.'
required: false
schema:
type: string
enum:
- createdTime
- entityType
- entityName
- userName
- actionType
- actionStatus
- name: sortOrder
in: query
description: Sort order. ASC (ASCENDING) or DESC (DESCENDING)
required: false
schema:
type: string
enum:
- ASC
- DESC
- name: startTime
in: query
description: 'The start timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: endTime
in: query
description: 'The end timestamp in milliseconds of the search time range over the AuditLog class field: ''createdTime''.'
required: false
schema:
type: integer
format: int64
- name: actionTypes
in: query
description: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details.
required: false
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PageDataAuditLog'
components:
schemas:
PageDataAuditLog:
type: object
properties:
data:
type: array
description: Array of the entities
items:
$ref: '#/components/schemas/AuditLog'
readOnly: true
totalPages:
type: integer
format: int32
description: Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria
readOnly: true
totalElements:
type: integer
format: int64
description: Total number of elements in all available pages
readOnly: true
hasNext:
type: boolean
description: '''false'' value indicates the end of the result set'
readOnly: true
AuditLog:
type: object
properties:
id:
$ref: '#/components/schemas/AuditLogId'
description: JSON object with the auditLog Id
createdTime:
type: integer
format: int64
description: Timestamp of the auditLog creation, in milliseconds
example: 1609459200000
readOnly: true
tenantId:
$ref: '#/components/schemas/TenantId'
description: JSON object with Tenant Id
readOnly: true
customerId:
$ref: '#/components/schemas/CustomerId'
description: JSON object with Customer Id
readOnly: true
entityId:
$ref: '#/components/schemas/EntityId'
description: JSON object with Entity id
readOnly: true
entityName:
type: string
description: Name of the logged entity
example: Thermometer
readOnly: true
userId:
$ref: '#/components/schemas/UserId'
description: JSON object with User id.
readOnly: true
userName:
type: string
description: Unique user name(email) of the user that performed some action on logged entity
example: tenant@thingsboard.org
readOnly: true
actionType:
type: string
description: String represented Action type
enum:
- ADDED
- DELETED
- UPDATED
- ATTRIBUTES_UPDATED
- ATTRIBUTES_DELETED
- TIMESERIES_UPDATED
- TIMESERIES_DELETED
- RPC_CALL
- CREDENTIALS_UPDATED
- ASSIGNED_TO_CUSTOMER
- UNASSIGNED_FROM_CUSTOMER
- ACTIVATED
- SUSPENDED
- CREDENTIALS_READ
- ATTRIBUTES_READ
- RELATION_ADD_OR_UPDATE
- RELATION_DELETED
- RELATIONS_DELETED
- REST_API_RULE_ENGINE_CALL
- ALARM_ACK
- ALARM_CLEAR
- ALARM_DELETE
- ALARM_ASSIGNED
- ALARM_UNASSIGNED
- LOGIN
- LOGOUT
- LOCKOUT
- ASSIGNED_FROM_TENANT
- ASSIGNED_TO_TENANT
- PROVISION_SUCCESS
- PROVISION_FAILURE
- ASSIGNED_TO_EDGE
- UNASSIGNED_FROM_EDGE
- ADDED_COMMENT
- UPDATED_COMMENT
- DELETED_COMMENT
- SMS_SENT
example: ADDED
readOnly: true
actionData:
$ref: '#/components/schemas/JsonNode'
description: JsonNode represented action data
readOnly: true
actionStatus:
type: string
description: String represented Action status
enum:
- SUCCESS
- FAILURE
example: SUCCESS
readOnly: true
actionFailureDetails:
type: string
description: Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception.
readOnly: true
JsonNode:
description: A value representing the any type (object or primitive)
examples:
- {}
UserId:
type: object
properties:
id:
type: string
format: uuid
description: ID of the entity, time-based UUID v1
example: 784f394c-42b6-435a-983c-b7beff2784f9
entityType:
type: string
description: string
enum:
- USER
example: USER
required:
- entityType
- id
AuditLogId:
type: object
properties:
id:
type: string
format: uuid
description: string
example: 784f394c-42b6-435a-983c-b7beff2784f9
required:
- id
TenantId:
type: object
properties:
id:
type: string
format: uuid
description: ID of the entity, time-based UUID v1
example: 784f394c-42b6-435a-983c-b7beff2784f9
entityType:
type: string
description: string
enum:
- TENANT
example: TENANT
required:
- entityType
- id
CustomerId:
type: object
properties:
id:
type: string
format: uuid
description: ID of the entity, time-based UUID v1
example: 784f394c-42b6-435a-983c-b7beff2784f9
entityType:
type: string
description: string
enum:
- CUSTOMER
example: CUSTOMER
required:
- entityType
- id
EntityId:
type: object
properties:
id:
type: string
format: uuid
description: ID of the entity, time-based UUID v1
example: 784f394c-42b6-435a-983c-b7beff2784f9
entityType:
type: string
enum:
- TENANT
- CUSTOMER
- USER
- DASHBOARD
- ASSET
- DEVICE
- ALARM
- RULE_CHAIN
- RULE_NODE
- ENTITY_VIEW
- WIDGETS_BUNDLE
- WIDGET_TYPE
- TENANT_PROFILE
- DEVICE_PROFILE
- ASSET_PROFILE
- API_USAGE_STATE
- TB_RESOURCE
- OTA_PACKAGE
- EDGE
- RPC
- QUEUE
- NOTIFICATION_TARGET
- NOTIFICATION_TEMPLATE
- NOTIFICATION_REQUEST
- NOTIFICATION
- NOTIFICATION_RULE
- QUEUE_STATS
- OAUTH2_CLIENT
- DOMAIN
- MOBILE_APP
- MOBILE_APP_BUNDLE
- CALCULATED_FIELD
- JOB
- ADMIN_SETTINGS
- AI_MODEL
- API_KEY
example: DEVICE
required:
- entityType
- id
securitySchemes:
HTTP login form:
type: http
description: Enter Username / Password
scheme: loginPassword
bearerFormat: /api/auth/login|X-Authorization
API key form:
type: apiKey
description: 'Enter the API key value with ''ApiKey'' prefix in format: **ApiKey <your_api_key_value>**
Example: **ApiKey tb_5te51SkLRYpjGrujUGwqkjFvooWBlQpVe2An2Dr3w13wjfxDW**
<br>**NOTE**: Use only ONE authentication method at a time. If both are authorized, JWT auth takes the priority.<br>
'
name: X-Authorization
in: header