Telegram Bot Info API

Methods for getting and setting bot information

OpenAPI Specification

telegram-bot-info-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Telegram Bot Bot Info API
  description: The Telegram Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. Bots can receive messages, send messages, manage chats, handle payments, work with stickers, and much more. All methods are HTTPS POST requests to https://api.telegram.org/bot<token>/METHOD_NAME.
  version: '9.5'
  contact:
    name: Telegram Support
    url: https://core.telegram.org/bots/api
  license:
    name: Terms of Service
    url: https://telegram.org/tos
  termsOfService: https://telegram.org/tos
servers:
- url: https://api.telegram.org/bot{token}
  description: Telegram Bot API Server
  variables:
    token:
      default: YOUR_BOT_TOKEN
      description: Bot authentication token obtained from @BotFather
security:
- BotToken: []
tags:
- name: Bot Info
  description: Methods for getting and setting bot information
paths:
  /getMe:
    post:
      operationId: getMe
      summary: Get Bot Info
      description: A simple method for testing your bot authentication token. Returns basic information about the bot in the form of a User object.
      tags:
      - Bot Info
      responses:
        '200':
          description: Bot user object returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
  /getUserProfilePhotos:
    post:
      operationId: getUserProfilePhotos
      summary: Get User Profile Photos
      description: Get a list of profile pictures for a user.
      tags:
      - Bot Info
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - user_id
              properties:
                user_id:
                  type: integer
                  description: Unique identifier of the target user
                offset:
                  type: integer
                  description: Sequential number of the first photo to be returned
                limit:
                  type: integer
                  description: Limits the number of photos to be retrieved (1-100)
      responses:
        '200':
          description: User profile photos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserProfilePhotosResponse'
  /getFile:
    post:
      operationId: getFile
      summary: Get File
      description: Get basic info about a file and prepare it for downloading.
      tags:
      - Bot Info
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - file_id
              properties:
                file_id:
                  type: string
                  description: File identifier to get info about
      responses:
        '200':
          description: File object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileResponse'
  /setMyCommands:
    post:
      operationId: setMyCommands
      summary: Set My Commands
      description: Change the list of the bot commands.
      tags:
      - Bot Info
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - commands
              properties:
                commands:
                  type: array
                  items:
                    $ref: '#/components/schemas/BotCommand'
                  description: List of bot commands (max 100)
                scope:
                  type: object
                  description: Scope of users for which the commands are relevant
                language_code:
                  type: string
                  description: Two-letter ISO 639-1 language code
      responses:
        '200':
          description: Commands set successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BooleanResponse'
  /getMyCommands:
    post:
      operationId: getMyCommands
      summary: Get My Commands
      description: Get the current list of the bot commands.
      tags:
      - Bot Info
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                scope:
                  type: object
                  description: Scope of users for which commands are relevant
                language_code:
                  type: string
                  description: Two-letter ISO 639-1 language code
      responses:
        '200':
          description: Array of BotCommand objects
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BotCommandsResponse'
components:
  schemas:
    BotCommand:
      type: object
      properties:
        command:
          type: string
          description: Text of the command (1-32 characters, lowercase, no spaces)
        description:
          type: string
          description: Description of the command (3-256 characters)
      required:
      - command
      - description
    User:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for this user or bot
        is_bot:
          type: boolean
          description: True if this user is a bot
        first_name:
          type: string
          description: User's or bot's first name
        last_name:
          type: string
          description: User's or bot's last name
        username:
          type: string
          description: User's or bot's username
        language_code:
          type: string
          description: IETF language tag of the user's language
        is_premium:
          type: boolean
          description: True if this user is a Telegram Premium user
      required:
      - id
      - is_bot
      - first_name
    UserProfilePhotos:
      type: object
      properties:
        total_count:
          type: integer
          description: Total number of profile pictures the target user has
        photos:
          type: array
          items:
            type: array
            items:
              type: object
          description: Requested profile pictures (in up to 4 sizes each)
      required:
      - total_count
      - photos
    UserResponse:
      type: object
      properties:
        ok:
          type: boolean
        result:
          $ref: '#/components/schemas/User'
    UserProfilePhotosResponse:
      type: object
      properties:
        ok:
          type: boolean
        result:
          $ref: '#/components/schemas/UserProfilePhotos'
    BooleanResponse:
      type: object
      properties:
        ok:
          type: boolean
        result:
          type: boolean
    BotCommandsResponse:
      type: object
      properties:
        ok:
          type: boolean
        result:
          type: array
          items:
            $ref: '#/components/schemas/BotCommand'
    File:
      type: object
      properties:
        file_id:
          type: string
          description: Identifier for this file, which can be used to download or reuse the file
        file_unique_id:
          type: string
          description: Unique identifier for this file (stable across bots)
        file_size:
          type: integer
          description: File size in bytes
        file_path:
          type: string
          description: File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
      required:
      - file_id
      - file_unique_id
    FileResponse:
      type: object
      properties:
        ok:
          type: boolean
        result:
          $ref: '#/components/schemas/File'
  securitySchemes:
    BotToken:
      type: apiKey
      in: path
      name: token
      description: Bot authentication token obtained from @BotFather (embedded in URL path)
externalDocs:
  description: Official Telegram Bot API Documentation
  url: https://core.telegram.org/bots/api