Developer documentation

Telegram data-center migration and sessions

Handle DC addresses, migration responses, authorization transfer and temporary keys without confusing connection failures with invalid credentials.

GetTGAPI editorial teamUpdated
Documentation notesReviewed

Based on official sources and independently maintained by GetTGAPI. Documentation and glossary →

On this page
  1. Connect to the appropriate DC
  2. Separate sessions from credentials
  3. Diagnose before replaying

Connect to the appropriate DC

DC addresses and ports can change. Follow current configuration, and distinguish PHONE_MIGRATE_X, NETWORK_MIGRATE_X and FILE_MIGRATE_X: account placement, request handling and media location are different concerns.

Each DC has its own authorization keys. Follow authorization-transfer procedures instead of copying a key and assuming it works. Media-transfer connections have additional rules.

Separate sessions from credentials

Respect the configured number of main sessions sharing an authorization; incorrect reuse can produce AUTH_KEY_DUPLICATED. Temporary-key binding belongs to protocol forward secrecy, not to changing an application’s API Hash.

We recommend letting a maintained client library manage these details. Keep account state, task identifiers and sanitized diagnostics in your application, without exposing authorization keys in logs.

Diagnose before replaying

Identify the migration response and destination, confirm that the library migrated and transferred authorization, then decide whether the business request can be retried. Reconcile uncertain send or payment outcomes before issuing a second operation.