---
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

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

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

##### `type` BitStatus

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

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

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

#### Example

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