QivunaDevelopers

Media and getFile

Bots send files with sendPhoto, sendVideo and sendDocument, and download files they receive with getFile. Files go through the same pipeline as people's: location data and camera details are stripped from pictures.

Sending a file#

Upload the file with multipart/form-data under the method's own field name, or reuse a file_id your bot received or sent:

curl -s https://bots.qivuna.com/v1/sendPhoto \
  -H "Authorization: Bot $QIVUNA_BOT_TOKEN" \
  -F chat_id=-4503600130020245 \
  -F photo=@chart.png \
  -F caption="Weekly results"
{"chat_id": -4503600130020245, "photo": "3f9c0a7e4b1d2c5e6f708192a3b4c5d6e7f80912"}
MethodFieldAccepted
sendPhotophotoJPEG, PNG, WebP; HEIC/HEIF is converted to JPEG. At most 8,000 pixels a side and 25 megapixels.
sendVideovideoMP4, MOV, WebM, 3GP.
sendDocumentdocumentThe file types people can send in chats.

Where media can go#

Every refusal happens before anything is stored or counted.

Upload limits#

Tiernewstandardverified
Upload volume per UTC day200 MB1 GB5 GB

Past the volume, 429 rate_limited with retry_after until the next UTC midnight. Pictures are decoded one at a time per bot, in a pool shared by bots; when it is busy you get 429 with a short retry_after — retry then.

Files your bot receives#

A message with files carries the first one as photo, video or document (by its stored type) — a single File, not a list of sizes — and its text as caption. People can send up to 10 files in one message; then attachments lists all of them in order, each as {type, …File}.

"photo": {"file_id": "3f9c0a7e4b1d2c5e6f708192a3b4c5d6e7f80912",
          "file_unique_id": "Qm7bX0k2_Lr9TzP1",
          "file_size": 248113, "mime_type": "image/jpeg", "file_name": "IMG_2041.jpg"}

End-to-end encrypted files are never presented to bots.

Downloading with getFile#

curl -s "https://bots.qivuna.com/v1/getFile?file_id=3f9c0a7e4b1d2c5e6f708192a3b4c5d6e7f80912" \
  -H "Authorization: Bot $QIVUNA_BOT_TOKEN"
# → {"ok":true,"result":{"file_id":"3f9c…","file_unique_id":"Qm7b…","file_size":248113,
#     "mime_type":"image/jpeg","file_name":"IMG_2041.jpg","file_path":"<43 characters>"}}

curl -s -o photo.jpg "https://bots.qivuna.com/v1/file/<file_path>" \
  -H "Authorization: Bot $QIVUNA_BOT_TOKEN"