# Telegram and MAX CLI settings and profiles (/en/docs/configuration)

Save settings for the command-line tools so you do not repeat the same options on every run, such as how many results to show. Learn where your settings are stored, how to check and change them, and where each messenger lists every available setting. The defaults work for most people; change a setting when you keep repeating the same option or want different values for different accounts.

Two terms help here. The **settings file** (`config.json`) keeps these values on your computer. A profile (A name for a particular account or bot and its settings, such as work. It helps you choose the right account and permissions when you have several.) is a named configuration for an account or bot connection, such as `work`, with its own values; values under `defaults` apply to every profile. Login data is never stored in this file, and what your agent may do is set in [Permissions](/llms.mdx/docs/configuration/content.md#permissions).

**On this page:**

1. [Where the file is](#where-the-file-is)
2. [Check and change a setting](#check-and-change-a-setting)
3. [Which value wins?](#which-value-wins)
4. [An example](#an-example)
5. [All settings for Telegram and MAX](#all-settings-for-telegram-and-max)
6. [Profiles and bots](#profiles-and-bots)
7. [Permissions](#permissions)

## Where the file is [#where-the-file-is]

The tool creates the file with common defaults the first time a command reads settings, and keeps an existing file as it is.

| System | Telegram | MAX |
|---|---|---|
| Linux | `~/.config/tg-cli/config.json` | `~/.config/max-cli/config.json` |
| macOS | `~/.config/tg-cli/config.json` | `~/.config/max-cli/config.json` |
| Windows | `%APPDATA%\tg-cli\Config\config.json` | `%APPDATA%\max-cli\Config\config.json` |

`config show` prints the actual path, which differs if your computer uses a custom directory. In PowerShell, type `tg.cmd` or `max.cmd`.

## Check and change a setting [#check-and-change-a-setting]

```sh
tg config show
tg personal config set limit 50
tg work config set limit 10
tg config set sends_per_hour 10 --defaults
tg personal config unset limit
```

`config show` lists every setting with its value and where that value came from. `config set` saves a value for the current profile, for a named profile such as `work`, or with `--defaults` for every profile. It checks the value before writing, so a typo is refused instead of saved. `config unset` removes a value so the default applies again. For MAX, write `max` instead of `tg`. You can also edit the file by hand.

## Which value wins? [#which-value-wins]

A command option such as `--limit 5` (a flag (An extra instruction such as --limit 5, added to a command to change that run. Supported options are listed in --help.)) changes only that run. It wins over an environment variable, then the profile's value in the file, then `defaults`, then the built-in value. Some settings have no option or environment variable; each messenger's reference says which ones exist.

## An example [#an-example]

```json
{
  "defaults": { "limit": 20, "sends_per_hour": 30 },
  "profiles": { "work": { "limit": 50 } }
}
```

`tg work chats list` shows 50 results, other profiles show 20, and `--limit 5` shows five for one command.

<details id="full-example" className="docs-disclosure">
<summary>A fuller example with profiles, bots and permissions</summary>

```json
{
  "defaults": { "limit": 20, "keep_runs_for_days": 14, "update_check": true },
  "profiles": {
    "personal": { "limit": 50, "color": true },
    "work": { "limit": 10, "record": true, "permissions": { "messages": "readonly" } }
  },
  "personal": { "defaults": { "sends_per_hour": 30 } },
  "bot": { "profiles": { "shop": { "sends_per_hour": 200 } } }
}
```

- `defaults` apply to every profile; `profiles.<name>` to one profile.
- `personal` applies only to commands for your own account; `bot` only to `tg <name> bot …` and `max <name> bot …` commands.
- `work` keeps a record of every run and may only read messages.

</details>

## All settings for Telegram and MAX [#all-settings-for-telegram-and-max]

The two tools share most settings, such as `limit`, `sends_per_hour`, `record` and `permissions`. Some exist in only one of them: for example, `proxy` in Telegram and `serve` in MAX. WireCat Desktop shows the runs that `record` keeps: [Search logs in WireCat Desktop](/llms.mdx/docs/desktop/logs/content.md). Each messenger documents its own settings:

- **Telegram:** [Telegram configuration guide](/llms.mdx/docs/tg/configuration/content.md) · [every Telegram setting, default and environment variable](/llms.mdx/docs/tg/configuration-reference/content.md).
- **MAX:** [MAX configuration guide](/llms.mdx/docs/max/configuration/content.md) · [every MAX setting, default and environment variable](/llms.mdx/docs/max/configuration-reference/content.md).

The other tools have their own settings files: [Zoom](/llms.mdx/docs/zm/configuration/content.md), [Google Drive](/llms.mdx/docs/drive/configuration/content.md), [Notion](/llms.mdx/docs/notion/configuration/content.md), [Yandex Disk](/llms.mdx/docs/ydisk/configuration/content.md), [Google Calendar](/llms.mdx/docs/gcal/configuration/content.md), [Mail](/llms.mdx/docs/mail/configuration/content.md), [Bitrix24](/llms.mdx/docs/b24/configuration/content.md), [amoCRM](/llms.mdx/docs/amo/configuration/content.md), [Attio](/llms.mdx/docs/attio/configuration/content.md), [HubSpot](/llms.mdx/docs/hubspot/configuration/content.md), [Asterisk](/llms.mdx/docs/pbx/configuration/content.md), [WordPress](/llms.mdx/docs/wordpress/configuration/content.md), [Linear](/llms.mdx/docs/linear/configuration/content.md) and [Memo](/llms.mdx/docs/memo/configuration/content.md).

## Profiles and bots [#profiles-and-bots]

Use profiles when you have multiple accounts, a bot or different access settings for your agents. A profile is a named configuration for one account or bot connection on this computer, with its own login and permissions. This page shows how to choose the right one and distinguish a bot command from a personal-account command.

### Choose a profile [#choose-a-profile]

Put the profile before the command:

```sh
tg work config show
drive personal sync
```

Name the profile in every command and agent request: `tg work …`, or `TG_PROFILE=work` for a whole
session (`tg` reads `TG_PROFILE` and `max` reads `MAX_PROFILE`; `zm` uses the `account.profile` setting; `memo` and `drive` read no profile variable, so name the profile in the command). No profile is ever picked for you. A command
that needs one and names none stops with an error that lists the profiles on this computer. A setting under `profiles.work` applies to that
profile; `defaults` supplies values it has not set.
Profiles are not separate operating-system users: an agent with unrestricted file access
can still reach other data on that computer.

### Switch to a bot [#switch-to-a-bot]

Use `bot` after the profile name:

```sh
tg support bot api get-me --json
max support bot api get-my-info --json
```

These commands require an already connected bot profile. The bot's account and rights come
from the messenger, not from your personal account. [Bots](/llms.mdx/docs/bot-api/content.md) explains setup and examples.

For login, use the [Telegram](/llms.mdx/docs/tg/sessions/content.md) or [MAX](/llms.mdx/docs/max/sessions/content.md) guide, or [connect Google Drive](/llms.mdx/docs/drive/installation/content.md).

## Permissions [#permissions]

Choose which actions your agent may perform: reading messages, sending replies or changing a group. This page helps you set access for the chosen account or bot and check limits before a real task. Permissions belong to a profile (A name for a particular account or bot and its settings, such as work. It helps you choose the right account and permissions when you have several.), a named set of settings for an account or bot; [Profiles](/llms.mdx/docs/configuration/content.md#profiles-and-bots) explains choosing one.

### Choose an access level [#choose-an-access-level]

| Level | What happens |
|---|---|
| `deny` | The action is refused, including reading. |
| `readonly` | Reading works; changes are refused. |
| `ask` | In a terminal, a change waits for your confirmation. Over MCP it runs without a question. |
| `allow` | The action can run without another question. |

A refusal tells you to check the requested action and settings. It does not mean your account
connection is broken. Do not ask an agent to remove a restriction just to finish a task.

### Allow one action [#allow-one-action]

```sh
tg work config set permissions.messages.send ask
max work config set permissions.messages.send ask
```

Replace `work` with your profile. For a default that allows reading messages and refuses changes:

```sh
tg work config set permissions.messages readonly
max work config set permissions.messages readonly
```

More specific keys win. A saved `permissions.messages.send ask` still permits sending; set it
to `readonly` to refuse sends. Check other exceptions with `config show`.

This controls messages. Other actions, such as reactions or chat administration, have their own
permission keys. Use the complete read-only profile examples in
[Telegram’s permission reference](/llms.mdx/docs/tg/configuration-reference/content.md#what-a-profile-may-do) or [MAX’s permission reference](/llms.mdx/docs/max/configuration-reference/content.md#%D0%BF%D1%80%D0%B0%D0%B2%D0%B0-%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B0).

### Permissions for a bot [#permissions-for-a-bot]

Bot permissions and limits belong to the bot section. To ask before sends in the terminal:

```sh
tg support config set permissions.bot.messages.send ask --bot
max support config set permissions.bot.messages.send ask --bot
tg support config set sends_per_hour 30 --bot
max support config set sends_per_hour 30 --bot
```

### Restrict recipients and repeated sends [#restrict-recipients-and-repeated-sends]

A recipient list limits which chats the profile may send to. An hourly send limit helps stop a
loop. These checks remain active when a particular command is allowed.
Read the [Telegram security guide](/llms.mdx/docs/tg/security/content.md) or [MAX security guide](/llms.mdx/docs/max/security/content.md)
for the commands to manage these controls.

### A temporary change for an MCP server [#a-temporary-change-for-an-mcp-server]

Add `--permission messages.send=deny` to the server startup command to refuse sending for that
process. Saved settings stay the same. The flag only tightens: an override that would loosen the profile's
level is refused at startup, so to allow more, change the profile's permissions. Over MCP, the server asks nothing at the `ask` level, and the agent writes and deletes at once. Only your AI app
may show its own confirmation. To keep the agent from changing data, give the profile `readonly` or `deny`, for
example `tg work config set permissions.messages readonly`. [Browser setup](/llms.mdx/docs/browser-apps/content.md) explains the full connection.

### Lock a whole run to reading [#lock-a-whole-run-to-reading]

Each tool also reads a variable in its environment that refuses changes for the whole run, whatever
the saved permissions allow. A refused change exits with code 5. Set it for an agent that should only read.

| Tool | Variable | What it refuses |
|---|---|---|
| tg, max | `TG_READ_ONLY=1`, `MAX_READ_ONLY=1` | Sending and other changes; the agent can still read and prepare reply text. |
| Zoom | `ZM_READ_ONLY=1` | Changes to Zoom, the login, settings and what you added; reading and syncing from Zoom still run. |
| Google Drive | `DRIVE_READ_ONLY` (any value except `0` or empty) | Every change, on this computer or in Google, as `--read-only` does. |
| Google Calendar | `GCAL_READ_ONLY` (any value except `0` or empty) | Every change to Google Calendar and to the settings; reading and `gcal sync` still run. |
| Memo | `MEMO_READ_ONLY` (any value except `0`) | Every change; reading, `memo sync` and a scheduled agent's `tasks link` still run. `memo mcp serve` keeps writing commands discoverable but refuses them. |

### Limits and detailed rules [#limits-and-detailed-rules]

An agent that can edit configuration files or run unrestricted terminal commands may be able
to change these settings. Read [Security](/llms.mdx/docs/security/content.md) before giving that access.
For nested permissions and exact command keys, see [Telegram](/llms.mdx/docs/tg/configuration-reference/content.md#what-a-profile-may-do) or [MAX](/llms.mdx/docs/max/configuration-reference/content.md#%D0%BF%D1%80%D0%B0%D0%B2%D0%B0-%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B0).
