Use this method to get up to date information about the chat

POST /getChat

Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.

Body Required

  • chat_id integer | string Required

    Any of:

    Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

    Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

Responses

  • default
    Hide response attributes Show response attributes object
    • ok boolean Required

      Default value is false.

    • error_code integer Required
    • description string Required
    • parameters object

      Contains information about why a request was unsuccessful.

      Hide parameters attributes Show parameters attributes object
      • migrate_to_chat_id integer

        Optional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.

      • retry_after integer

        Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated

  • 200
    Hide response attributes Show response attributes object
    • ok boolean Required

      Default value is true.

    • result object Required

      This object represents a chat.

      Hide result attributes Show result attributes object
      • id integer Required

        Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.

      • type string Required

        Type of chat, can be either “private”, “group”, “supergroup” or “channel”

        Values are private, group, supergroup, or channel.

      • title string

        Optional. Title, for supergroups, channels and group chats

      • username string

        Optional. Username, for private chats, supergroups and channels if available

      • first_name string

        Optional. First name of the other party in a private chat

      • last_name string

        Optional. Last name of the other party in a private chat

      • photo object

        This object represents a chat photo.

        Hide photo attributes Show photo attributes object
        • small_file_id string Required

          File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.

        • small_file_unique_id string Required

          Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.

        • big_file_id string Required

          File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.

        • big_file_unique_id string Required

          Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.

      • bio string

        Optional. Bio of the other party in a private chat. Returned only in getChat.

      • description string

        Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.

      • invite_link string

        Optional. Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.

      • pinned_message object

        This object represents a message.

      • permissions object

        Describes actions that a non-administrator user is allowed to take in a chat.

        Hide permissions attributes Show permissions attributes object
        • can_send_messages boolean

          Optional. True, if the user is allowed to send text messages, contacts, locations and venues

        • can_send_media_messages boolean

          Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages

        • can_send_polls boolean

          Optional. True, if the user is allowed to send polls, implies can_send_messages

        • can_send_other_messages boolean

          Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages

        • can_add_web_page_previews boolean

          Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages

        • can_change_info boolean

          Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups

        • can_invite_users boolean

          Optional. True, if the user is allowed to invite new users to the chat

        • can_pin_messages boolean

          Optional. True, if the user is allowed to pin messages. Ignored in public supergroups

      • slow_mode_delay integer

        Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in getChat.

      • sticker_set_name string

        Optional. For supergroups, name of group sticker set. Returned only in getChat.

      • can_set_sticker_set boolean

        Optional. True, if the bot can change the group sticker set. Returned only in getChat.

      • linked_chat_id integer

        Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.

      • location object

        Represents a location to which a chat is connected.

        Hide location attributes Show location attributes object
        • location object Required

          This object represents a point on the map.

          Hide location attributes Show location attributes object
          • longitude number Required

            Longitude as defined by sender

          • latitude number Required

            Latitude as defined by sender

          • horizontal_accuracy number

            Optional. The radius of uncertainty for the location, measured in meters; 0-1500

          • live_period integer

            Optional. Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only.

          • heading integer

            Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only.

          • proximity_alert_radius integer

            Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.

        • address string Required

          Location address; 1-64 characters, as defined by the chat owner

POST /getChat
curl \
 -X POST https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getChat \
 -H "Content-Type: application/json" \
 -d '{"chat_id":42}'
Request example
{
  "chat_id": 42
}
Request examples
{
  "chat_id": 42
}
Response examples (default)
{
  "ok": false,
  "error_code": 42,
  "description": "string",
  "parameters": {
    "migrate_to_chat_id": 42,
    "retry_after": 42
  }
}
Response examples (default)
{
  "ok": false,
  "error_code": 42,
  "description": "string",
  "parameters": {
    "migrate_to_chat_id": 42,
    "retry_after": 42
  }
}
Response examples (200)
{
  "ok": true,
  "result": {
    "id": 42,
    "type": "private",
    "title": "string",
    "username": "string",
    "first_name": "string",
    "last_name": "string",
    "photo": {
      "small_file_id": "string",
      "small_file_unique_id": "string",
      "big_file_id": "string",
      "big_file_unique_id": "string"
    },
    "bio": "string",
    "description": "string",
    "invite_link": "string",
    "pinned_message": {},
    "permissions": {
      "can_send_messages": true,
      "can_send_media_messages": true,
      "can_send_polls": true,
      "can_send_other_messages": true,
      "can_add_web_page_previews": true,
      "can_change_info": true,
      "can_invite_users": true,
      "can_pin_messages": true
    },
    "slow_mode_delay": 42,
    "sticker_set_name": "string",
    "can_set_sticker_set": true,
    "linked_chat_id": 42,
    "location": {
      "location": {
        "longitude": 42.0,
        "latitude": 42.0,
        "horizontal_accuracy": 42.0,
        "live_period": 42,
        "heading": 42,
        "proximity_alert_radius": 42
      },
      "address": "string"
    }
  }
}
Response examples (200)
{
  "ok": true,
  "result": {
    "id": 42,
    "type": "private",
    "title": "string",
    "username": "string",
    "first_name": "string",
    "last_name": "string",
    "photo": {
      "small_file_id": "string",
      "small_file_unique_id": "string",
      "big_file_id": "string",
      "big_file_unique_id": "string"
    },
    "bio": "string",
    "description": "string",
    "invite_link": "string",
    "pinned_message": {},
    "permissions": {
      "can_send_messages": true,
      "can_send_media_messages": true,
      "can_send_polls": true,
      "can_send_other_messages": true,
      "can_add_web_page_previews": true,
      "can_change_info": true,
      "can_invite_users": true,
      "can_pin_messages": true
    },
    "slow_mode_delay": 42,
    "sticker_set_name": "string",
    "can_set_sticker_set": true,
    "linked_chat_id": 42,
    "location": {
      "location": {
        "longitude": 42.0,
        "latitude": 42.0,
        "horizontal_accuracy": 42.0,
        "live_period": 42,
        "heading": 42,
        "proximity_alert_radius": 42
      },
      "address": "string"
    }
  }
}