> For the complete documentation index, see [llms.txt](https://painor.gitbook.io/gramjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://painor.gitbook.io/gramjs/working-with-payments/account.gettmppassword.md).

# account.getTmpPassword

Get temporary payment password

## Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.account.getTmpPassword({
        password: new Api.InputCheckPasswordSRP({...}),
        period: 1240138,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result: Api.account.TmpPassword = await client.invoke(new Api.account.getTmpPassword({
        password: new Api.InputCheckPasswordSRP({...}),
        period: 1240138,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}
{% endtabs %}

## TL schema

```
account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword;
---functions---
account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;
```

## Parameters

|     Name     | Type                                                                          | Description                                                                                        |
| :----------: | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **password** | [InputCheckPasswordSRP](https://core.telegram.org/type/InputCheckPasswordSRP) | SRP password parameters                                                                            |
|  **period**  | [int](https://core.telegram.org/type/int)                                     | Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 |

## Result

[account.TmpPassword](https://core.telegram.org/type/account.TmpPassword)

## Possible errors

| Code | Type                    | Description                           |
| :--: | ----------------------- | ------------------------------------- |
|  400 | PASSWORD\_HASH\_INVALID | The provided password hash is invalid |
|  400 | TMP\_PASSWORD\_DISABLED | The temporary password is disabled    |

## Can bots use this methd ?

### yes

## Related pages
