sendVideo
Send a video to a specified chat. Supports uploading a file directly or passing a file_id of a previously uploaded file.
Request
POST /:token/sendVideo
Use multipart/form-data encoding for file uploads.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| chat_id | Integer/String | Yes | Unique identifier or username of the target chat |
| video | String/File | Yes | Video file or file_id of a previously uploaded file |
| caption | String | No | Video caption text |
| parse_mode | String | No | Parsing mode for the caption, supports HTML or Markdown |
| width | Integer | No | Video width in pixels |
| height | Integer | No | Video height in pixels |
| duration | Integer | No | Video duration in seconds |
| reply_markup | Object | No | Custom keyboard or inline keyboard markup, JSON-serialized object |
| reply_to_message_id | Integer | No | ID of the message to reply to |
Response
Returns the sent Message object on success.
json
{
"ok": true,
"result": {
"message_id": 102,
"from": {
"id": 123456789,
"is_bot": true,
"first_name": "MyBot",
"username": "my_bot"
},
"chat": {
"id": 987654321,
"first_name": "User",
"username": "user123",
"type": "private"
},
"date": 1700000000,
"video": {
"file_id": "BAACAgIAAxkBAAI...",
"file_unique_id": "AQADAgAT...",
"width": 1920,
"height": 1080,
"duration": 30,
"file_size": 1048576
},
"caption": "This is a sample video"
}
}Error Codes
| Code | Description |
|---|---|
| 400 | Bad request parameters, e.g. unsupported file format |
| 401 | Invalid or expired token |
| 403 | Bot does not have permission to send messages to this chat |
| 404 | Chat not found |
| 413 | File too large |
| 500 | Internal server error |
Examples
Send Video via File Upload
bash
curl -X POST "https://api.example.com/<token>/sendVideo" \
-F "chat_id=987654321" \
-F "video=@/path/to/video.mp4" \
-F "caption=This is a sample video" \
-F "width=1920" \
-F "height=1080" \
-F "duration=30"Send Video via file_id
bash
curl -X POST "https://api.example.com/<token>/sendVideo" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 987654321,
"video": "BAACAgIAAxkBAAI...",
"caption": "Forwarding a video"
}'