Blog and knowledge base of the service
Sending a photo message in a Telegram bot
Published: 22.07.2025

What formats does Telegram accept photos and what are the limitations?

Photo requirements when sending

The Telegram Bot API accepts images in the following formats:

  1. JPEG/JPG is the main and recommended format for sending photos via the bot.
  2. PNG is supported, but not always recommended, especially for large sizes.
  3. WEBP is supported, but is more commonly used for stickers.
  4. GIF is not supported in the method and an animation will be sent.

Important: the photo formats sent by the bot are actually limited to what Telegram recognizes as "photo". This means that in practice, the bot must send images in JPEG format so that Telegram correctly interprets them as a photo (and not as a file).

It has a size limit of 20 MB.

Parameters and settings of the photo message

Photo link requirements

The direct link to the image should lead directly to the file, not to the web page.

Example: https://example.com/images/photo.jpg ✅

Incorrect: https://example.com/gallery/photo?id=123 ❌ (this is a page, not a file)

Photo link requirements-1

The image format must be compatible (usually JPG, JPEG, PNG, WEBP):

The URL must end in .jpg, .jpeg, .png, .webp, etc.

Example: https://cdn.domain.com/photo123.jpg ✅

The file must be publicly available.:

Without authorization, tokens, or cookies.

Telegram (the server) should be able to download it directly at this URL.

The URL content must be a valid image.:

The Content-Type header should be, for example: image/jpeg, image/png.

How to get the image code to send by file_id

There are two ways to quickly get the image code.:

Paste the link to the picture, and then click the “Test” button

How to get the image code to send by file_id-1

Enable debugging mode in the unknown command/error event and send a photo to the bot. As a result, the image code will be available in the "Test data" section


How to get the image code to send by file_id-2


How to get the image code to send by file_id-3

Popular mistakes when sending photos in the Telegram bot

400 Bad Request: wrong file identifier/HTTP URL specified

The reason:

– Incorrect photo format (for example, the URL does not lead to the image or the file_id is invalid).

How to fix it:

– Make sure that:

  1. The URL ends with .jpg, .png and leads to an image, not an HTML page.
  2. The file_id is relevant for this bot (if used).
  3. The URL header is Content-Type: image/jpeg or image/png.

Example of an incorrect one: "https://example.com/page ?id=123"

400 Bad Request: wrong type of the web page content

The reason:

– Telegram expects an image from the URL, but receives HTML or another unsupported type of content.

How to fix it:

– Make sure that the Content-Type header on the link is image/jpeg, image/png, etc.

400 Bad Request: photo must be non-empty

The reason:

– The photo field is missing or an empty file has been transferred.

How to fix:

– Make sure that the photo field is set correctly (URL, InputFile, or file_id) and the image really exists.

413 Request Entity Too Large

The reason:

– The file exceeds the limit (20 MB for sendPhoto).

How to fix it:

– Reduce the image size or use sendDocument (up to 50 MB) if you do not need to display as a photo.

400 Bad Request: chat not found

The reason:

– Incorrect chat_id is specified, or the bot does not have access to the chat.

How to fix it:

– Make sure that:

  1. The bot has been added to the group/channel.
  2. The correct ID is specified (for example, @yourchannelname or a number).
  3. The bot has the rights to send messages.


403 Forbidden: bot was blocked by the user

The reason:

– The user or channel has blocked the bot.

How to fix it:

– Nothing but asking the user to unblock the bot.

Technical information for the BOT-MARKET API

The message type code for sending requests (MessageType) is “2”

Comments
to write comments
Comment list is empty. Start now!