# account.getPrivacy

Get privacy settings of current account

## 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.getPrivacy({
        key: new Api.InputPrivacyKey({...}),
        }));
    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.PrivacyRules = await client.invoke(new Api.account.getPrivacy({
        key: new Api.InputPrivacyKey({...}),
        }));
    console.log(result); // prints the result
})();
```
{% endtab %}
{% endtabs %}

## TL schema

```
account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;
---functions---
account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules;
```

## Parameters

|   Name  | Type                                                              | Description                                            |
| :-----: | ----------------------------------------------------------------- | ------------------------------------------------------ |
| **key** | [InputPrivacyKey](https://core.telegram.org/type/InputPrivacyKey) | Peer category whose privacy settings should be fetched |

## Result

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

## Possible errors

| Code | Type                  | Description                |
| :--: | --------------------- | -------------------------- |
|  400 | PRIVACY\_KEY\_INVALID | The privacy key is invalid |

## Can bots use this methd ?

### yes

## Related pages
