v1

latestOpenAPI 3.0.32026-07-1416059.6 KB

sendDocument

Use this method to send general files.

post/bot{token}/sendDocument

Path parameters

tokenstring required

Your Bot Token

Request body

chat_idstring

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

documentstring

File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file by just passing the path to the file as String and the SDK will take care of uploading it for you.

captionstring

Document caption (may also be used when resending documents by file_id), 0-200 characters

disable_notificationboolean

Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. Other apps coming soon.

reply_to_message_idinteger

If the message is a reply, ID of the original message

reply_markupobject

Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

Response

200

okboolean

Example response

{
  "ok": true,
  "result": {
    "message_id": 1,
    "from": {
      "id": 12345678,
      "first_name": "YourBot",
      "username": "YourBot"
    },
    "chat": {
      "id": 123456789,
      "first_name": "John",
      "last_name": "Doe",
      "username": "JohnDoe",
      "type": "private"
    },
    "date": 1459976718,
    "document": {
      "file_id": "Abc123XyZ....",
      "file_name": "Document.pdf",
      "mime_type": "application/pdf",
      "thumb": {
        "file_id": "Abc532xYz...",
        "file_size": 6859,
        "width": 200,
        "height": 200
      },
      "file_size": 306738
    },
    "caption": "This is document"
  }
}