---
name: "getLogs"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "getLogs - Get log record list."
summary: "Get log record list."
---

## getLogs

> [VERSION] @ray-js/lock-sdk >= 1.0.0

### Description

Get log record list

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `GetLogsParams` | No | Input parameters |

### Return Value

Type: `Promise<GetLogsResult>`

Paginated log list (fields such as entry and timestamp are assembled by the implementation)

##### GetLogsResult

| Property | Type | Description |
| --- | --- | --- |
| `list` | `LogData[]` | Log data |
| `hasMore` | `boolean` | Has more |
| `total` | `number` | Total count |

### Referenced Types

##### `interface` GetLogsParams

| Property | Type | Description |
| --- | --- | --- |
| `page` | `number` | Page number, default 1 |
| `pageSize` | `number` | Page size, default 50 |

##### `interface` LogData

| Property | Type | Description |
| --- | --- | --- |
| `logId` | `string` | Unique log ID |
| `time` | `number` | Event time (milliseconds timestamp) |
| `currentUser` | `boolean` | Whether related to the current logged-in user |
| `type` | `"alarm_record" \| "close_record" \| "unlock_record" \| "operation" \| "local_operation"` | Log type |
| `operationType` | `"dev_bind" \| "member_schedule_update" \| "unlock_add" \| "unlock_del" \| "temp_pwd_create" \| "temp_pwd_del" \| "temp_pwd_meta_update" \| "temp_pwd_name_update" \| "offline_pwd_achieve" \| "offline_pwd_clear_achieve" \| "offline_pwd_clear_single_achieve" \| "offline_pwd_name_update" \| "arming_switch" \| "unlock_switch" \| "automatic_lock" \| "auto_lock_time" \| "verify_lock_switch" \| "do_not_disturb" \| "special_control" \| "special_function" \| "beep_volume" \| "remote_unlock_setting" \| "remote_voice_pwd_setting"` | Only valid when the operation type field type equals operation |
| `userId` | `string` | Associated user ID |
| `dpId` | `number` | Associated DP numeric ID |
| `dpCode` | `string` | Associated DP code |
| `data` | `any` | Business data (DP value or other structure) |
| `userName` | `string` | Associated user nickname |
| `avatarUrl` | `string` | Associated user avatar URL (returned by some devices in history.list 2.0) |
| `relateDevName` | `string` | Associated sub-device name (returned by some devices in history.list 2.0; sub-device/gateway-attached lock scenario) |
| `bindable` | `boolean` | Whether bindable (valid for unlock_record) |
| `unlockName` | `string` | Unlock method name (unlock_record) |
| `mediaInfo` | `MediaInfo[]` | Attachment media list |
| `unionUnlockInfo` | `UnionUnlockInfo[]` | Combination unlock members (unlock_record) |
| `closeValue` | `"UNDEFINED" \| "VOICE_REMOTE" \| "APP_REMOTE" \| "AUTO" \| "LOCAL_MANUAL" \| "FITTINGS" \| "APP" \| "GEO_FENCE"` | Lock method (close_record) |
| `localRecord` | `LocalUnlockMethodData \| LocalAddUserData \| LocalSettingData \| LocalOperateOtherData` | Local operation details (local_operation) |
| `isHijack` | `boolean` | Duress alarm |
| `unlockMethod` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye"` | Unlock method type (unlock_record) |
| `matterRecord` | `Object` | Matter unlock record |
| `tempPwdInfo` | `Object` | Temporary password info; valid when operateType is temp_pwd_create/ |
| `clearInfo` | `Object` | Clear-password info |
| `unlockInfo` | `Object` | Unlock method info Valid when the operation type is unlock_add/unlock_del |
| `userEffectiveInfo` | `Object` | Update user validity info Valid when the operation type is member_schedule_update |

##### `interface` LocalUnlockMethodData

| Property | Type | Description |
| --- | --- | --- |
| `category` | `0 \| 1 \| 2` | Add/Delete/Update unlock methods |
| `unlockMethod` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye" \| "remoteControl"` | Unlock method type or remote control |
| `unlockId` | `number` | Unlock method ID |
| `isRemoveAll` | `boolean` | Clear all unlock methods of this type |
| `userType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Operator type |
| `userId` | `number` | Operator ID |
| `toUserType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Target user type |
| `toUserId` | `number` | Target user ID |

##### `interface` LocalAddUserData

| Property | Type | Description |
| --- | --- | --- |
| `category` | `16 \| 17` | Local add/delete users |
| `userType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Operator type |
| `userId` | `number` | Operator ID |
| `toUserType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Target user type |
| `toUserId` | `number` | Target user ID |

##### `interface` LocalSettingData

| Property | Type | Description |
| --- | --- | --- |
| `category` | `32` | Local settings |
| `type` | `number` | Setting type |
| `data` | `number \| Uint8Array<ArrayBuffer \| SharedArrayBuffer>` | Parsed value or buffer |
| `originData` | `Uint8Array<ArrayBuffer \| SharedArrayBuffer>` | Raw DP buffer |
| `userType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Operator type |
| `userId` | `number` | Operator ID |
| `toUserType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Target user type |
| `toUserId` | `number` | Target user ID |

##### `interface` LocalOperateOtherData

| Property | Type | Description |
| --- | --- | --- |
| `category` | `number` | Operation category (numeric) |
| `type` | `number` | Operation type |
| `data` | `Uint8Array<ArrayBuffer \| SharedArrayBuffer>` | Operation data |
| `userType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Operator type |
| `userId` | `number` | Operator ID |
| `toUserType` | `"LocalOperateUserType.SUPER_ADMIN" \\| "LocalOperateUserType.ADMIN" \\| "LocalOperateUserType.SPECIAL_USER" \\| "LocalOperateUserType.NORMAL_USER"` | Target user type |
| `toUserId` | `number` | Target user ID |

##### `interface` EffectiveConfig

| Property | Type | Description |
| --- | --- | --- |
| `effectiveDate` | `number` | Effective date (seconds-level timestamp) |
| `expiredDate` | `number` | Expiration date (seconds-level timestamp) |
| `repeat` | `"none" \| "week"` | Repeat policy: none or weekly |
| `weeks` | `Week` | Weekly repeat bitmap |
| `effectiveTime` | `number` | Daily start time (minutes) |
| `expiredTime` | `number` | Daily end time (minutes) |

##### `enum` LocalOperateUserType

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `LocalOperateUserType.SUPER_ADMIN` | `0` | Super administrator |
| `LocalOperateUserType.ADMIN` | `1` | Administrator |
| `LocalOperateUserType.SPECIAL_USER` | `2` | Special user |
| `LocalOperateUserType.NORMAL_USER` | `3` | Regular user |

##### `type` Week

Weekly repeat bitmap: indices 0–6 correspond to Sun–Sat; 0 inactive, 1 active

```typescript
export type Week = [
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
];
```

##### `type` MediaInfo

| Property | Type | Description |
| --- | --- | --- |
| `mediaPath` | `string` | Media logical path |
| `fileKey` | `string` | Object storage file key |
| `fileUrl` | `string` | Accessible URL |
| `mediaBucket` | `string` | Bucket name |
| `mediaKey` | `string` | Media object key |
| `width` | `number` | Image width |
| `height` | `number` | Image height |
| `angle` | `number` | Image angle |
| `position` | `number` | Camera position |
| `isVR` | `boolean` | Whether it is VR mode |

##### `type` UnionUnlockInfo

| Property | Type | Description |
| --- | --- | --- |
| `userId` | `string` | User ID |
| `userName` | `string` | User nickname |
| `unlockName` | `string` | Unlock method name |
| `sn` | `number` | Protocol SN |
| `type` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye"` | Type |

##### `type` LogData.matterRecord

| Property | Type | Description |
| --- | --- | --- |
| `sn` | `number` | Hardware ID |
| `source` | `number` | Unlock source 0: Tuya App Matter unlock 1: Third-party unlock |
| `type` | `number` | Unlock type 0: Unknown 1: Phone 2: Third-party PIN code |

##### `type` LogData.tempPwdInfo

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` | Temporary password name |
| `originName` | `string` | Original temporary password name, present when renaming the password |
| `effectiveConfig` | `EffectiveConfig` | Temporary password validity configuration |

##### `type` LogData.clearInfo

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` | Name of the clear password |
| `originName` | `string` | Original clear-password name; set when renaming the password |
| `effectiveConfig` | `EffectiveConfig` | Clear-password validity configuration |
| `targetName` | `string` | Target password name |

##### `type` LogData.unlockInfo

| Property | Type | Description |
| --- | --- | --- |
| `userName` | `string` | Owner user name of the unlock method |
| `userId` | `string` | Owner user ID of the unlock method |
| `unlockName` | `string` | Unlock method name |
| `type` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye"` | Unlock method type |

##### `type` LogData.userEffectiveInfo

| Property | Type | Description |
| --- | --- | --- |
| `userName` | `string` | User name |
| `permanent` | `boolean` | Whether permanently valid |
| `effectiveConfig` | `EffectiveConfig` | User validity configuration Empty when permanently valid |


### Examples

```ts
import { getLogs } from '@ray-js/lock-sdk';
const logs = await getLogs({ offset: 0, limit: 20 });
```
