Skip to main content
POST
/
whatsapp
/
send
/
file
Send File / Media
curl --request POST \
  --url https://platform.chatsyncs.com/api/v1/whatsapp/send/file \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data apiToken=API-KEY \
  --data phone_number_id=PHONE-NUMBER-ID \
  --data phone_number=PHONE-NUMBER \
  --data media_url=https://example.com/image.jpg \
  --data 'media_id=<string>' \
  --data 'media_type=<string>' \
  --data 'media_caption_text=<string>'
import requests

url = "https://platform.chatsyncs.com/api/v1/whatsapp/send/file"

payload = {
"apiToken": "API-KEY",
"phone_number_id": "PHONE-NUMBER-ID",
"phone_number": "PHONE-NUMBER",
"media_url": "https://example.com/image.jpg",
"media_id": "<string>",
"media_type": "<string>",
"media_caption_text": "<string>"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}

response = requests.post(url, data=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
apiToken: 'API-KEY',
phone_number_id: 'PHONE-NUMBER-ID',
phone_number: 'PHONE-NUMBER',
media_url: 'https://example.com/image.jpg',
media_id: '<string>',
media_type: '<string>',
media_caption_text: '<string>'
})
};

fetch('https://platform.chatsyncs.com/api/v1/whatsapp/send/file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.chatsyncs.com/api/v1/whatsapp/send/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&phone_number=PHONE-NUMBER&media_url=https%3A%2F%2Fexample.com%2Fimage.jpg&media_id=%3Cstring%3E&media_type=%3Cstring%3E&media_caption_text=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://platform.chatsyncs.com/api/v1/whatsapp/send/file"

payload := strings.NewReader("apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&phone_number=PHONE-NUMBER&media_url=https%3A%2F%2Fexample.com%2Fimage.jpg&media_id=%3Cstring%3E&media_type=%3Cstring%3E&media_caption_text=%3Cstring%3E")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://platform.chatsyncs.com/api/v1/whatsapp/send/file")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&phone_number=PHONE-NUMBER&media_url=https%3A%2F%2Fexample.com%2Fimage.jpg&media_id=%3Cstring%3E&media_type=%3Cstring%3E&media_caption_text=%3Cstring%3E")
.asString();
require 'uri'
require 'net/http'

url = URI("https://platform.chatsyncs.com/api/v1/whatsapp/send/file")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "apiToken=API-KEY&phone_number_id=PHONE-NUMBER-ID&phone_number=PHONE-NUMBER&media_url=https%3A%2F%2Fexample.com%2Fimage.jpg&media_id=%3Cstring%3E&media_type=%3Cstring%3E&media_caption_text=%3Cstring%3E"

response = http.request(request)
puts response.read_body
{
  "status": "1",
  "wa_message_id": "wamid.HBgNODgwMTcyMzMwOTAwMxUC...",
  "message": "Message sent successfully."
}
Sends an image, video, audio, or document to a WhatsApp number — the single endpoint for all media types.
You must provide either media_url or media_id — at least one is required.

Body

application/x-www-form-urlencoded
apiToken
string
required

Your ChatSyncs API key (not a WhatsApp/Meta access token). Where to find it.

Example:

"API-KEY"

phone_number_id
string
required

The WhatsApp account's phone number ID. Where to find it.

Example:

"PHONE-NUMBER-ID"

phone_number
string
required

The subscriber's phone number, with country code, digits only.

Example:

"PHONE-NUMBER"

media_url
string

Public HTTPS URL of the file. Required if media_id isn't set.

Example:

"https://example.com/image.jpg"

media_id
string

A WhatsApp media ID from Upload Media or Graph. Required if media_url isn't set; requires media_type when used alone.

media_type
string

One of image, video, audio, document. Required when using media_id alone, or when media_url has no file extension.

media_caption_text
string

Caption for an image, video, or document (not supported for audio). Falls back to message if omitted.

Response

200 - application/json

Standard ChatSyncs response. status is "1" on success and "0" on failure.

status
string

"1" = success, "0" = failure.

message
string

Human-readable result message.