Telegram Bot API
🌐 English

setChatPhoto

Category: Chat · Bot API 10.3 · Official documentation

Sets chat photo.

Returns: On success, returns True.

Parameters

ParameterTypeRequiredDescription
chat_idInteger or StringYesChat ID
photoInputFileYesNew chat photo URL or file_id

Parameter descriptions are concise summaries; see the official documentation for the full text.

Example request

curl

curl -s "https://api.telegram.org/bot$TOKEN/setChatPhoto" \
  -F chat_id=123456789 \
  -F photo=@photo.jpg

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/setChatPhoto",
    data={
        "chat_id": 123456789
    },
    files={"photo": open("photo.jpg", "rb")},
    timeout=30,
)
print(resp.json())

JavaScript

import { readFile } from "node:fs/promises";

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const form = new FormData();
form.append("chat_id", "123456789");
form.append("photo", new Blob([await readFile("photo.jpg")]), "photo.jpg");
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setChatPhoto`, { method: "POST", body: form });
console.log(await res.json());

Step-by-step guide: How to Create a Telegram Bot: Step by Step with BotFather and Python