---
agentTools:
  projectIndex: https://telegram-bot-sdk.readme.io/llms.txt
---

# sendPhoto

Use this method to send photos.

Use this method to send photos. On success, the sent [Message](https://core.telegram.org/bots/api#message) is returned.

See [sendPhoto](https://core.telegram.org/bots/api#sendphoto) official docs for a list of supported parameters and other info.

# Sending Photo Using Image URL

The ability to send an image directly from a URL is also supported in the library. Instead of supplying a local path and filename, you may just pass the image URL and it'll take care of downloading and sending it to the Telegram directly.

## Example

[block:code]
{
  "codes": [
    {
      "code": "use Telegram\\Bot\\Api;\n\n$telegram = new Api('BOT TOKEN');\n\n$response = $telegram->sendPhoto([\n\t'chat_id' => 'CHAT_ID', \n\t'photo' => 'http://example.com/photos/image.jpg',\n\t'caption' => 'Some caption'\n]);\n\n$messageId = $response->getMessageId();",
      "language": "php",
      "name": "Standalone"
    },
    {
      "code": "$response = Telegram::sendPhoto([\n\t'chat_id' => 'CHAT_ID', \n\t'photo' => 'http://example.com/photos/image.jpg',\n\t'caption' => 'Some caption'\n]);\n\n$messageId = $response->getMessageId();",
      "language": "php",
      "name": "Laravel"
    }
  ]
}
[/block]

[block:callout]
{
  "type": "warning",
  "title": "Sending Photo using a File or URL!",
  "body": "The API Explorer below doesn't support file upload or URL based photo sending. You can only use it to test using an existing *file_id*, if you have one.\n\nThis is a limitation of this API Explorer, Not the SDK."
}
[/block]

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "API Settings",
    "version": "2.0"
  },
  "servers": [
    {
      "url": "https://api.telegram.org"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/bot{token}/sendPhoto": {
      "post": {
        "summary": "sendPhoto",
        "description": "Use this method to send photos.",
        "operationId": "sendphoto",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "Your Bot Token",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chat_id": {
                    "type": "string",
                    "description": "Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)"
                  },
                  "photo": {
                    "type": "string",
                    "description": "Photo to send. You can either pass a *file_id* as String to [resend](https://core.telegram.org/bots/api#resending-files-without-reuploading) a photo that is already on the Telegram servers, or upload a new photo by just passing the path to the file as String and the SDK will take care of uploading the file for you. You can also directly pass Image URL as String to automatically download and send it to Telegram.",
                    "default": "Required"
                  },
                  "caption": {
                    "type": "string",
                    "description": "Photo caption (may also be used when resending photos by *file_id*), 0-200 characters",
                    "default": "Optional"
                  },
                  "disable_notification": {
                    "type": "boolean",
                    "description": "Sends the message (silently)[https://telegram.org/blog/channels-2-0#silent-messages]. iOS users will not receive a notification, Android users will receive a notification with no sound. Other apps coming soon.",
                    "default": false
                  },
                  "reply_to_message_id": {
                    "type": "integer",
                    "description": "If the message is a reply, ID of the original message",
                    "default": null,
                    "format": "int32"
                  },
                  "reply_markup": {
                    "type": "object",
                    "description": "Additional interface options. A JSON-serialized object for a (custom reply keyboard)[https://core.telegram.org/bots#keyboards], instructions to hide keyboard or to force a reply from the user.",
                    "properties": {}
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"ok\": true,\n    \"result\": {\n        \"message_id\": 1,\n        \"from\": {\n            \"id\": 12345678,\n            \"first_name\": \"YourBot\",\n            \"username\": \"YourBot\"\n        },\n        \"chat\": {\n            \"id\": 123456789,\n            \"first_name\": \"John\",\n            \"last_name\": \"Doe\",\n            \"username\": \"JohnDoe\",\n            \"type\": \"private\"\n        },\n        \"date\": 1459976718,\n        \"photo\": [\n            {\n                \"file_id\": \"AbCdE123XyZ...\",\n                \"file_size\": 1437,\n                \"width\": 70,\n                \"height\": 90\n            },\n            {\n                \"file_id\": \"AbCdE123XyZ...\",\n                \"file_size\": 17334,\n                \"width\": 248,\n                \"height\": 320\n            },\n            {\n                \"file_id\": \"AbCdE123XyZ...\",\n                \"file_size\": 62089,\n                \"width\": 620,\n                \"height\": 800\n            },\n            {\n                \"file_id\": \"AbCdE123XyZ...\",\n                \"file_size\": 122255,\n                \"width\": 992,\n                \"height\": 1280\n            },\n            {\n                \"file_id\": \"AbCdE123XyZ...\",\n                \"file_size\": 128541,\n                \"width\": 1280,\n                \"height\": 1652\n            }\n        ]\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "message_id": {
                          "type": "integer",
                          "example": 1,
                          "default": 0
                        },
                        "from": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "example": 12345678,
                              "default": 0
                            },
                            "first_name": {
                              "type": "string",
                              "example": "YourBot"
                            },
                            "username": {
                              "type": "string",
                              "example": "YourBot"
                            }
                          }
                        },
                        "chat": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "example": 123456789,
                              "default": 0
                            },
                            "first_name": {
                              "type": "string",
                              "example": "John"
                            },
                            "last_name": {
                              "type": "string",
                              "example": "Doe"
                            },
                            "username": {
                              "type": "string",
                              "example": "JohnDoe"
                            },
                            "type": {
                              "type": "string",
                              "example": "private"
                            }
                          }
                        },
                        "date": {
                          "type": "integer",
                          "example": 1459976718,
                          "default": 0
                        },
                        "photo": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "file_id": {
                                "type": "string",
                                "example": "AbCdE123XyZ..."
                              },
                              "file_size": {
                                "type": "integer",
                                "example": 1437,
                                "default": 0
                              },
                              "width": {
                                "type": "integer",
                                "example": 70,
                                "default": 0
                              },
                              "height": {
                                "type": "integer",
                                "example": 90,
                                "default": 0
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"ok\": false,\n    \"error_code\": 400,\n    \"description\": \"[Error]: Bad Request: there is no photo in request\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "error_code": {
                      "type": "integer",
                      "example": 400,
                      "default": 0
                    },
                    "description": {
                      "type": "string",
                      "example": "[Error]: Bad Request: there is no photo in request"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "php",
              "code": "use Telegram\\Bot\\Api;\n\n$telegram = new Api('BOT TOKEN');\n\n$response = $telegram->sendPhoto([\n  'chat_id' => 'CHAT_ID', \n  'photo' => 'path/to/photo.jpg', \n\t'caption' => 'Some caption'\n]);\n\n$messageId = $response->getMessageId();",
              "name": "Standalone"
            },
            {
              "language": "php",
              "code": "$response = Telegram::sendPhoto([\n  'chat_id' => 'CHAT_ID', \n  'photo' => 'path/to/photo.jpg', \n\t'caption' => 'Some caption'\n]);\n\n$messageId = $response->getMessageId();",
              "name": "Laravel"
            }
          ],
          "samples-languages": [
            "php"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "User-Agent",
        "value": "Telegram Bot SDK - (https://github.com/irazasyed/telegram-bot-sdk)"
      }
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "58b53b061065f9c438aa1ab4:5705365b849f721900f279f2"
}
```