---
name: "getUserInfo"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
---

## getUserInfo

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

### Description

Get details of a single user.

### Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `userId` | `string` | Yes | User ID |

### Return Value

Type: `Promise<UserInfo>`

User details

##### UserInfo

| Property | Type | Description |
| --- | --- | --- |
| `userId` | `string` | Cloud user ID |
| `lockUserId` | `number` | Lock-side user ID |
| `avatarUrl` | `string` | Avatar URL |
| `backHomeNotifyAttr` | `number` | Return-home notification bit flags |
| `effectiveFlag` | `number` | Active status flag |
| `nickName` | `string` | Nickname |
| `offlineUnlock` | `boolean` | Whether offline unlocking is supported |
| `timeScheduleInfo` | `Object` | Effective period and repeat rules |
| `unlockDetails` | `Object[]` | Details grouped by unlock method type |
| `userContact` | `string` | User contact info (account) |
| `userType` | `10 \| 20 \| 30 \| 40 \| 50` | User type |
| `isFamilyUser` | `boolean` | Whether the user is a home member |

##### UserInfo.timeScheduleInfo properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `effectiveTime` | `number` | Yes | - | Start time (timestamp in ms) |
| `expiredTime` | `number` | Yes | - | End time (timestamp in ms) |
| `permanent` | `boolean` | Yes | - | Whether permanent |
| `scheduleDetails` | `Object` | No | - | Repeat details when not permanent |


##### UserInfo.timeScheduleInfo.scheduleDetails properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `repeat` | `boolean` | Yes | - | Whether repeats weekly |
| `effectiveTime` | `number` | Yes | - | Daily start minute (minutes since 00:00) |
| `invalidTime` | `number` | Yes | - | Daily end minute (minutes) |
| `timeZoneId` | `string` | Yes | - | Time zone ID |
| `weeks` | `Week` | Yes | - | Weekday bitmask |


##### UserInfo.unlockDetails[] properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `count` | `number` | Yes | - | Number of items in the group |
| `dpCode` | `string` | Yes | - | DP code for the group |
| `dpId` | `number` | Yes | - | DP ID for the group |
| `type` | `UnlockMethodType` | Yes | - | Unlock method type |
| `unlockList` | `UnlockMethodBaseInfo[]` | Yes | - | Unlock methods in the group |


### Referenced Types

##### `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` UnlockMethodType

Unlock method business type literal

```typescript
export type UnlockMethodType =
  | "finger"
  | "face"
  | "password"
  | "card"
  | "fingerVein"
  | "hand"
  | "eye";
```

##### `interface` UnlockMethodBaseInfo

| Property | Type | Description |
| --- | --- | --- |
| `unlockId` | `number` | Unlock method hardware/instance ID |
| `unlockName` | `string` | Unlock method name |
| `isBound` | `boolean` | Whether bound to a cloud user |
| `id` | `number` | Cloud-assigned unlock method record ID |
| `photoUnlock` | `boolean` | Whether an image-based unlock method |
| `isSpecial` | `boolean` | Whether a special unlock method (notifications and other extensions) |

##### `type` BitStatus

Bit switch: 0 off, 1 on / Single-bit flag

```typescript
export type BitStatus = 0 | 1;
```


### Examples

#### Example

```ts
import { getUserInfo } from '@ray-js/lock-sdk';
const info = await getUserInfo({ userId: 'user_001' });
```
