---
name: "saveTempOnlineUnlimited"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "saveTempOnlineUnlimited - Save an online unlimited password, applicable to WiFi Photo Lock devices."
summary: "Save an online unlimited password, applicable to WiFi Photo Lock devices."
---

## saveTempOnlineUnlimited

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

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

### Description

Save an online unlimited-use password

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `CreateOnlineUnlimitedParams` | Yes | Input parameters |

### Return Value

Type: `Promise<SaveTempOnlineUnlimitedResult>`

None (resolve after successful save)

##### SaveTempOnlineUnlimitedResult

| Property | Type | Description |
| --- | --- | --- |
| `type` | `"custom"` | Password type; fixed as `custom` (custom, unlimited uses) for this API |
| `name` | `string` | Password name |
| `pwdId` | `string` | Cloud password ID; used to locate the record for subsequent deletion/modification |
| `effectiveConfig` | `EffectiveConfig` | Validity settings (effective/expiry time and weekly recurrence) |

### Error Codes

| Error Code | Error Message |
| --- | --- |
| `1030` | Invalid password format |
| `1031` | Password name too long (over 20 characters) |
| `1032` | Missing validity time settings |
| `1033` | Missing start date |
| `1034` | Missing end date |
| `1010` | Start time is later than expiry time |
| `1035` | weeks not provided in weekly repeat mode |
| `1037` | Cloud: Password already exists (USER_PWD_ALREADY_EXIST) |
| `1038` | Cloud: Duplicate password name (LOCK_PWD_NAME_REPEAT) |
| `1039` | Cloud: Invalid time parameters (START_END_DATE_NOT_RIGHT) |

### Referenced Types

##### `interface` CreateOnlineUnlimitedParams

| Property | Type | Description |
| --- | --- | --- |
| `password` | `string` | Password content, must be numeric |
| `name` | `string` | Password name, length must not exceed 20 |
| `effective` | `EffectiveConfig` | Password validity configuration |
| `phone` | `string` | SMS notification phone number; if provided, SMS is enabled |
| `countryCode` | `string` | SMS country code |

##### `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 { saveTempOnlineUnlimited } from '@ray-js/lock-sdk';
saveTempOnlineUnlimited({ password: '654321', name: 'Unlimited-use password' });
```
