---
name: "createTempLimit"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "createTempLimit - Create temporary time-limited password."
summary: "Create temporary time-limited password."
---

## createTempLimit

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

### Description

Create a time-limited temporary password

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `CreateLimitParams` | Yes | Parameters |

### Return Value

Type: `Promise<TempPasswordResult>`

Time-limited temporary password creation result

### Error Codes

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

### Referenced Types

##### `interface` CreateLimitParams

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` | Password name, length must not exceed 20 |
| `effectiveTime` | `number` | Password effective start time (seconds) |
| `invalidTime` | `number` | Password effective end time (seconds) |


### Examples

```ts
import { createTempLimit } from '@ray-js/lock-sdk';
const result = await createTempLimit({ count: 5 });
```
