Configuration Reference¶
Complete reference for all configuration options.
Configuration Methods¶
Best for Docker deployments
- Easy to set in
docker-compose.yml - Override TOML configuration
- Format:
TDL_SECTION_KEY(uppercase, underscore-separated)
Priority Order
Environment variables always override config.toml values. Use environment variables for secrets and deployment-specific settings.
Environment Variable Format¶
Format: TDL_SECTION_KEY (uppercase, underscore-separated)
Examples: - TDL_API_ID → api_id - TDL_DAEMON_ENABLED → daemon.enabled - TDL_SOURCES_0_URL → sources[0].url
Core Settings¶
Telegram API Credentials¶
Required for all operations.
| Variable | Type | Required | Description |
|---|---|---|---|
TDL_API_ID | integer | Yes | API ID from https://my.telegram.org/apps |
TDL_API_HASH | string | Yes | API hash from https://my.telegram.org/apps |
TDL_PHONE_NUMBER | string | Yes | Phone number with country code (e.g., +1234567890) |
Paths and Storage¶
| Variable | Type | Default | Description |
|---|---|---|---|
TDL_DOWNLOAD_DIR | path | /downloads | Base directory for downloaded files |
TDL_FLAT_STRUCTURE | boolean | false | Store all files in download dir without per-channel subfolders |
TDL_TRACK_DOWNLOADS | boolean | true | Track downloaded files to prevent re-downloads after move/rename |
When TDL_FLAT_STRUCTURE is false (default), files are organized as {download_dir}/{channel_name}/{filename}. When true, all files go directly into {download_dir}/{filename}.
When TDL_TRACK_DOWNLOADS is true (default), a persistent history of downloaded files is kept in the state database. This prevents re-downloading files that have been moved, renamed, or processed by external tools (e.g., media servers, Paperless-ngx, mergerfs). The tracking uses Telegram's file_unique_id, which is stable and unique per file content regardless of source. Set to false to disable and rely only on file-exists checks.
Docker Environment¶
These are standard Docker environment variables, not prefixed with TDL_.
| Variable | Type | Default | Description |
|---|---|---|---|
PUID | integer | 1000 | User ID for file ownership (arr-stack convention) |
PGID | integer | 1000 | Group ID for file ownership |
TZ | string | UTC | Container timezone (e.g., Europe/Lisbon) |
Daemon Configuration¶
Controls continuous background operation.
| Variable | Type | Default | Description |
|---|---|---|---|
TDL_DAEMON_ENABLED | boolean | false | Enable daemon mode |
TDL_DAEMON_CHECK_INTERVAL | integer | 300 | Seconds between checks (60-86400) |
TDL_DAEMON_HEALTH_FILE | path | /app/health_status.txt | Health check file path |
TDL_DAEMON_LOG_LEVEL | string | INFO | Log level (DEBUG/INFO/WARNING/ERROR) |
Notification Configuration¶
Discord webhooks and generic HTTP POST notifications.
| Variable | Type | Default | Description |
|---|---|---|---|
TDL_NOTIFICATIONS_ENABLED | boolean | false | Enable notifications |
TDL_NOTIFICATIONS_DETAIL_LEVEL | string | summary | Detail level: minimal/summary/detailed |
TDL_NOTIFICATIONS_THROTTLE_SECONDS | integer | 60 | Minimum seconds between notifications (10-3600) |
TDL_NOTIFICATIONS_DISCORD_WEBHOOK_URL | URL | - | Discord webhook URL |
TDL_NOTIFICATIONS_DISCORD_USERNAME | string | Telegram Downloader | Discord bot username |
TDL_NOTIFICATIONS_GENERIC_WEBHOOK_URL | URL | - | Generic webhook URL (JSON POST) |
Detail levels: - minimal: Status only (success/failure) - summary: Status + file counts + error types (default) - detailed: Includes file names, timestamps, stack traces
Source Configuration¶
Configure download sources (channels, groups, forum topics, private chats).
Source URL Format¶
| Source Type | URL Format | Example |
|---|---|---|
| Public channel | https://t.me/username | https://t.me/example_channel |
| Public group | https://t.me/groupname | https://t.me/example_group |
| Private channel | https://t.me/c/CHAT_ID/MSG_ID | https://t.me/c/1234567890/1 |
| Forum topic | https://t.me/c/CHAT_ID/TOPIC_ID | https://t.me/c/1234567890/123 |
| Private chat | https://t.me/username | https://t.me/friend_username |
| Saved messages | https://t.me/me | https://t.me/me |
Source Settings¶
Format: TDL_SOURCES_N_KEY where N is the source index (0, 1, 2, ...)
| Variable | Type | Required | Description |
|---|---|---|---|
TDL_SOURCES_N_URL | URL | Yes | Source URL (see formats above) |
TDL_SOURCES_N_NAME | string | No | Custom folder name (auto-generated if omitted) |
Filter Configuration¶
Per-source filters override global defaults.
| Variable | Type | Default | Description |
|---|---|---|---|
TDL_SOURCES_N_FILTERS_EXTENSIONS | list | .pdf,.epub,.mobi | File extensions (comma-separated, with dots) |
TDL_SOURCES_N_FILTERS_MIN_SIZE | string | - | Minimum file size (e.g., "100KB", "5MB") |
TDL_SOURCES_N_FILTERS_MAX_SIZE | string | - | Maximum file size (e.g., "2GB") |
TDL_SOURCES_N_FILTERS_MIN_DATE | date | - | Minimum message date (ISO format: YYYY-MM-DD) |
TDL_SOURCES_N_FILTERS_MAX_DATE | date | - | Maximum message date |
TDL_SOURCES_N_FILTERS_PATTERNS | list | - | Filename patterns (comma-separated) |
Size format: Number + unit (KB, MB, GB) or raw bytes Pattern format: Wildcards (* = any characters, ? = single character) or regex (auto-detected)
Global Filter Defaults¶
Applied to all sources unless overridden.
| Variable | Type | Default | Description |
|---|---|---|---|
TDL_GLOBAL_FILTERS_EXTENSIONS | list | .pdf,.epub,.mobi | Default file extensions |
TDL_GLOBAL_FILTERS_MIN_SIZE | string | - | Default minimum size |
TDL_GLOBAL_FILTERS_MAX_SIZE | string | - | Default maximum size |
Retry Configuration¶
Error handling and retry behavior.
| Variable | Type | Default | Description |
|---|---|---|---|
TDL_RETRY_MAX_RETRIES | integer | 2 | Maximum retry attempts |
TDL_RETRY_BASE_DELAY | integer | 2 | Base delay in seconds |
TDL_RETRY_MAX_DELAY | integer | 60 | Maximum delay in seconds |
Example:
config.toml Example¶
Alternative to environment variables:
api_id = 12345678
api_hash = "abcdef1234567890abcdef1234567890"
phone_number = "+1234567890"
download_dir = "/downloads"
flat_structure = true
track_downloads = true
[daemon]
enabled = true
check_interval = 300
health_file = "/app/health_status.txt"
[notifications]
enabled = true
detail_level = "summary"
discord_webhook_url = "https://discord.com/api/webhooks/123/abc"
[[sources]]
url = "https://t.me/channel1"
name = "Channel One"
[sources.filters]
extensions = [".pdf", ".epub", ".mobi"]
min_size = "100KB"
max_size = "500MB"
[[sources]]
url = "https://t.me/c/1234567890/123"
name = "Forum Topic"
Note: Environment variables override config.toml values.