Media

Upload

Upload with multipart POST /v1/bot/media before attaching content. The maximum file size is 200 MB.

curl -X POST https://chat.wokey.pro/_keychat/v1/bot/media \
  -H "Authorization: Bearer $KEYCHAT_BOT_TOKEN" \
  -F "file=@photo.jpg"

Attach

media.type is image, video, or file. Send multiple media items for a gallery; clients build the grid and reserve image dimensions while loading.

External URLs

Do not substitute arbitrary remote URLs for uploads. Platform media prevents tracking, disappearing files, and mixed content.

SDK practice

Upload binary data through the SDK first, then place the returned media descriptor in attachments. Do not replace it with an arbitrary external URL.

Include width, height, and duration_ms when known so clients can reserve layout space and avoid visual jumps.

Usage examples

const bytes = await readFile('photo.png');
const media = await bot.uploadMedia(new Blob([bytes], { type: 'image/png' }), 'photo.png');
await bot.sendMessage({ chat_id: chatId, content: {
  attachments: [{ type: 'image', ...media }]
}});
© 2026. Key Chat.