Telegram on iOS: postbox db_sqlite and Media
Telegram on iOS: the postbox db_sqlite key-value store, its SQLCipher layer and .tempkeyEncrypted, media cache, secret chats and Unix time.
- Location
- /private/var/mobile/Containers/Shared/AppGroup/<UUID>/telegram-data/account-<id>/postbox/db/db_sqlite (media: .../postbox/media/)
- Evidence area
- Proves
- Telegram messages cached on the device (cloud chats and secret chats), the peers involved, forwarded-from information, media and the signed-in account
- Timestamps
- Unix time in seconds, stored as 32-bit integers inside the binary message keys and records, UTC
- Acquisition
- Full file system extraction from an AFU device; plan on backups being incomplete. The database is SQLCipher-encrypted and needs the key from .tempkeyEncrypted
- Retention
- A local cache: cloud chats can be partial and are refreshed from Telegram's servers; secret chats exist only on the devices involved and can self-destruct
- Collection
- Full file system extraction
Tools
Compare all toolsWhat it is
The Telegram iOS client stores its local data in a framework called Postbox: a SQLite file named db_sqlite that Telegram uses as a key-value store, with numbered tables (t0, t2, t7, t9...) whose keys and values are binary records serialised by the app. Messages, peers (users, groups, channels), chat lists and metadata each live in their own table.
Two things make Telegram harder than WhatsApp. First, db_sqlite is encrypted with SQLCipher on current versions. Second, Telegram is a cloud messenger: regular chats live on Telegram's servers and the device keeps a cache, so what you find locally is what the app happened to download. Secret chats are the exception: they are end-to-end encrypted and exist only on the devices involved, which makes the local copy the only copy.
Where it lives
| Item | Path (under the Telegram app group container) | Notes |
|---|---|---|
| Message store | telegram-data/account-<id>/postbox/db/db_sqlite (+ -wal, -shm) | One account-<id> folder per signed-in account |
| Media cache | telegram-data/account-<id>/postbox/media/ | Photos, videos, documents, voice notes; _partial files are incomplete downloads |
| Key file | telegram-data/.tempkeyEncrypted | Wraps the SQLCipher key and salt |
| Accounts | telegram-data/accounts-metadata/ | Which accounts are signed in |
The container is an app group container, typically for the group group.ph.telegra.Telegraph; confirm the UUID through the container metadata plists. Whether any of it reaches an iTunes or Finder backup depends on the app's exclusion flags and version; do not count on it.
What it proves
- Messages cached locally: text, direction, author, chat, and forwarding information (original author and date).
- Peers the account knows: names, usernames, phone numbers where visible, and presence data.
- The chat list, including groups and channels joined.
- Media the device downloaded or sent, linked to messages.
- Secret chat content that is still on the device.
It does not prove that the local cache is complete. An absent message may simply never have been loaded on this device.
Key fields
Postbox tables are binary key-value tables; there are no named columns to query. Published parsers document the following (verify against the Telegram version you have):
| Table | Content |
|---|---|
t0 | Metadata, including the Postbox user version and account state |
t2 | Peers (users, groups, channels) |
t7 | Messages, keyed by peer ID, namespace, timestamp and message ID |
t9 | Chat list |
t20 | Peer presence |
Record layouts follow the open-source Telegram-iOS client, which is the reference when a field looks wrong.
Timestamps
Telegram stores Unix time in seconds as 32-bit integers inside message keys (peerId, namespace, timestamp, id) and in forwarding records. They are UTC. Because the key embeds the timestamp, messages can be ordered and filtered by time before their bodies are decoded.
Retention
Cloud chat caches are trimmed by Telegram's storage settings (Keep Media, cache size limits) and by the user clearing cache. Secret chats can use self-destruct timers, and deleting a secret chat removes it on both sides. Deleted records may persist in the WAL and freelist pages of the decrypted database for a while.
Collection
- Acquire a full file system from an AFU device and copy the entire Telegram app group container, including hidden files such as
.tempkeyEncrypted. - Record the Telegram version and whether a Telegram passcode (Settings, Privacy and Security, Passcode Lock) was set. It changes how the key file is protected.
- For cloud chats, a lawful request to the provider or a logged-in session may add data the device never cached.
Parsing
- Published research shows that
.tempkeyEncryptedis AES-encrypted with a key derived from a default value when no Telegram passcode is set; the decrypted file yields the SQLCipher key and salt, and the database opens with a 32-byte plaintext header setting. With a passcode set, the passcode is needed. - iLEAPP parses messages, accounts, chat lists, contacts and presence from a decrypted
db_sqlite, and links media frompostbox/media. - Commercial suites such as Cellebrite, Magnet AXIOM and Oxygen Forensic Detective handle decryption and decoding for supported versions.
Investigator tips
- Work on a decrypted copy and document the decryption steps and tool versions: the chain from
.tempkeyEncryptedto plaintext must be reproducible. _partialmedia files show that a download started but did not complete. Report them as such.- Telegram contact interactions can also surface in interactionC.db and notification data, depending on what the app donates.
- For a comparison of what WhatsApp, Signal and Telegram leave behind, see the messaging apps guide.