Skip to content

SendFileByUrl Test#

The method is aimed for sending a file uploaded by Url. The message will be added to the send queue. The message will be kept for 24 hours in the queue and will be sent immediately after phone authorization. The rate at which messages are sent from the queue is managed by Message sending delay parameter.

To form a link for your file you can use external storages.
We recommend using our external file storage via the UploadFile method.

Video, audio and image files available for viewing and listening to are sent as in native-mode WhatsApp. Documents are sent in the same way as in native-mode WhatsApp. Outgoing file type and send method is determined by the file extension. Description is only added to images and video.

The maximum size of outgoing files is 100 MB.

Sending multiple files with one request is not possible. 1 file is sent with only 1 message. The ability to send multiple files at the same time is created only on the side of the WhatsApp application.

There are no restrictions on image resolutions. However, when sending images through the API with a resolution exceeding 3000x3000 pixels, thumbnails will not be generated.

List of file extensions, that could be successfully sent and received via the API


To send a file, you have to execute a request at:


For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

Request parameters#

Parameter Type Mandatory Description
chatId string Yes Chat Id
urlFile string Yes Link to outgoing file
fileName string Yes File name. Must contain the file extension. Requires UTF-8 encoding without BOM. For example: test.jpg
caption string No File caption. Caption added to video, images. The maximum field length is 20000 characters.
quotedMessageId string No Quoted message ID. If present, the message will be sent quoting the specified chat message


  • Link format recommendations

    1. Symbols a-z, A-Z, 0-9, - (hyphen), _ (underscore) can be used in the link
    2. The link must not contain special characters ~$€%#£?! and spaces
    3. UTF-8 link character encoding without BOM
    4. It is required to transfer non-encoded links (the system encodes the link itself)
    5. It is required that the link points to a specific file, and not to the html page link examples
    6. Required to use fast storage, no limit on the number of file requests
  • Field fileName

    It is required to specify the fileName field with the correct file extension.

    File type detection by the system:

    1. By the extension specified in the file name, in the fileName field
    2. If the fileName field does not contain an extension, then the file type is obtained by Content-Type from the link header
    3. If the Content-Type field in the header is missing or contains a non-existent file type, the system will try to determine the file type based on the bytes of the file
    4. If the system cannot determine the file type, it will be sent with the default type (binary file)

Time to send a file

Sending files occurs in several stages:

  1. Receive the file
  2. Uploading a file to the WhatsApp server
  3. Request to send a file to WhatsApp

The time to send a file depends on the file size, the speed of receiving the file and WhatsApp processing the file. Depending on these factors, the time to send a file can vary from 1 to 20 seconds.

Request body example#

Sending a message to a personal chat:

    "chatId": "",
    "urlFile": "",
    "fileName": "horse.png",
    "caption": "Little horse"

Sending a message to a group chat:

    "chatId": "",
    "urlFile": "",
    "fileName": "horse.png",
    "caption": "Little horse"

Sending a quoted message:

    "chatId": "11001234567@с.us",
    "urlFile": "",
    "fileName": "horse.png",
    "caption": "Little horse",
    "quotedMessageId": "361B0E63F2FDF95903B6A9C9A102F34B"


Response parameters#

Parameter Type Description
idMessage string Outgoing message Id

Response body example#

    "idMessage": "3EB0C767D097B7C7C030"

SendFileByUrl errors#

For a list of errors common to all methods, refer to Common errors section

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/sendFileByUrl/{{apiTokenInstance}}"

payload = "{\r\n   \t\"chatId\": \"\",\r\n\t\"urlFile\": \"\",\r\n\t\"fileName\": \"horse.png\",\r\n\t\"caption\": \"little horse\"\r\n}"
headers = {
  'Content-Type': 'application/json'

response = requests.request("POST", url, headers=headers, data = payload)

curl --location '{{apiUrl}}/waInstance{{idInstance}}/sendFileByUrl/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "",
    "urlFile": "",
    "fileName": "horse.png",
    "caption": "лошадка"
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();

var headers = new HttpHeaders();

var jsonBody = "{\r\n   \t\"chatId\": \"\",\r\n\t\"urlFile\": \"\",\r\n\t\"fileName\": \"horse.png\",\r\n\t\"caption\": \"little horse\"\r\n}";

var requestEntity = new HttpEntity<>(jsonBody, headers);

var response =, HttpMethod.POST, requestEntity, String.class);
var requestUrl = new StringBuilder();

var response =
    .header("Content-Type", "application/json")
    .body("{\r\n   \t\"chatId\": \"\",\r\n\t\"urlFile\": \"\",\r\n\t\"fileName\": \"horse.png\",\r\n\t\"caption\": \"little horse\"\r\n}")

Sub SendFileByUrl()
    Dim url As String
    Dim RequestBody As String
    Dim http As Object

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/SendFileByUrl/{{apiTokenInstance}}"

    ' chatId is the number to send the message ( for private chats, for group chats), urlFile - url link, fileName - file name with extension, caption - title
    RequestBody = "{""chatId"":"""",""urlFile"":"""",""fileName"":""horse.png"",""caption"":""horse""}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    With http
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/json"
        .Send RequestBody
    End With

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    ' Range("A1").Value = response

    Set http = Nothing
End Sub