---
name: "createTempOffline"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "createTempOffline - Create an offline password, applicable to WiFi Photo Lock devices."
summary: "Create an offline password, applicable to WiFi Photo Lock devices. Supports creating one-time passwords and unlimited passwords."
---

## createTempOffline

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

> 💡 This API is for WiFi Pro locks only; do not use it with other locks.

### Description

Create an offline temporary password.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `CreateOfflineParams` | Yes | Offline creation parameters |

### Return Value

Type: `Promise<OfflineTempResult>`

Offline temporary password creation result

##### OfflineTempResult

| Property | Type | Description |
| --- | --- | --- |
| `type` | `"once" \| "multiple"` | Type: one-time or multiple-use |
| `name` | `string` | Name |
| `password` | `string` | Plaintext password (already parsed per device) |
| `unlockBindingId` | `string` | Password ID |
| `pwdId` | `string` | Cloud password ID |
| `effectiveConfig` | `EffectiveConfig` | Activation settings |

### Error Codes

| Error Code | Error Message |
| --- | --- |
| `1031` | Password name too long (exceeds 20 characters) |
| `1010` | Start time is later than expiry time |
| `1067` | Cloud: Offline passwords for the period exhausted (OFFLINE_PWD_EXAUST_IN_PERIOD) |

### Referenced Types

##### `interface` CreateOfflineParams

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` | Name (required if not one-time) |
| `effective` | `EffectiveConfig` | Validity configuration |
| `isOnce` | `boolean` | Is an offline one-time password |

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

##### `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,
];
```


### Examples

```ts
import { createTempOffline } from '@ray-js/lock-sdk';
const result = createTempOffline({ type: 'once' });
```
