getChatGifts
Returns chat's gifts.
Returns: On success, returns OwnedGifts.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chat_id | Integer or String | Yes | Chat ID or @username |
exclude_unsaved | Boolean | Optional | Exclude gifts that aren't saved to the profile page |
exclude_saved | Boolean | Optional | Exclude gifts that are saved to the profile page |
exclude_unlimited | Boolean | Optional | Exclude gifts that can be purchased an unlimited number of times |
exclude_limited_upgradable | Boolean | Optional | Exclude limited gifts that can be upgraded to unique |
exclude_limited_non_upgradable | Boolean | Optional | Exclude limited gifts that can't be upgraded to unique |
exclude_from_blockchain | Boolean | Optional | Exclude gifts assigned from the TON blockchain |
exclude_unique | Boolean | Optional | Exclude unique gifts |
sort_by_price | Boolean | Optional | Sort by gift price instead of send date |
offset | String | Optional | Pagination offset |
limit | Integer | Optional | Count (1-100) |
Example request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/getChatGifts" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/getChatGifts",
json={
"chat_id": 123456789
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/getChatGifts`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789
}),
});
console.log(await res.json());
Step-by-step guide: How to Create a Telegram Bot: Step by Step with BotFather and Python
Related methods
sendInvoiceSends an invoice for payment.createInvoiceLinkCreates a payment link.refundStarPaymentRefunds a Telegram Stars payment.sendGiftSends a gift to a user or chat.getMyStarBalanceReturns the bot's Telegram Stars balance.getStarTransactionsReturns bot's Telegram Stars transactions.editUserStarSubscriptionCancels or renews a Telegram Stars subscription.giftPremiumSubscriptionGifts a Telegram Premium subscription.answerShippingQueryAnswers a shipping query.answerPreCheckoutQueryAnswers a pre-checkout query.getAvailableGiftsReturns available gifts the bot can send.getUserGiftsReturns user's gifts.