send media message
curl --request POST \
--url https://api.chatlevel.io/v1/devices/{id}/messages/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "[email protected]",
"toNumber": "31620292537",
"mediaUrl": "<string>",
"mediaBase64": "<string>",
"mediaCaption": "<string>"
}
'import requests
url = "https://api.chatlevel.io/v1/devices/{id}/messages/media"
payload = {
"to": "[email protected]",
"toNumber": "31620292537",
"mediaUrl": "<string>",
"mediaBase64": "<string>",
"mediaCaption": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '[email protected]',
toNumber: '31620292537',
mediaUrl: '<string>',
mediaBase64: '<string>',
mediaCaption: '<string>'
})
};
fetch('https://api.chatlevel.io/v1/devices/{id}/messages/media', 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://api.chatlevel.io/v1/devices/{id}/messages/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '[email protected]',
'toNumber' => '31620292537',
'mediaUrl' => '<string>',
'mediaBase64' => '<string>',
'mediaCaption' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.chatlevel.io/v1/devices/{id}/messages/media"
payload := strings.NewReader("{\n \"to\": \"[email protected]\",\n \"toNumber\": \"31620292537\",\n \"mediaUrl\": \"<string>\",\n \"mediaBase64\": \"<string>\",\n \"mediaCaption\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.chatlevel.io/v1/devices/{id}/messages/media")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"[email protected]\",\n \"toNumber\": \"31620292537\",\n \"mediaUrl\": \"<string>\",\n \"mediaBase64\": \"<string>\",\n \"mediaCaption\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatlevel.io/v1/devices/{id}/messages/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"[email protected]\",\n \"toNumber\": \"31620292537\",\n \"mediaUrl\": \"<string>\",\n \"mediaBase64\": \"<string>\",\n \"mediaCaption\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"messageId": "3EB0C1F0B2F0A1D5E8F4"
}{
"status": {
"code": 400,
"message": "Invalid image format (only PNG, JPEG, GIF, WebP allowed)"
}
}{
"status": "error",
"error": {
"code": 401,
"message": "Missing or invalid authorization header. Please provide a Bearer token."
}
}{
"status": {
"code": 404,
"message": "Device 12345 is not connected. Please restart the device or scan the QR code to connect."
}
}{
"status": {
"code": 408,
"message": "Request timeout"
}
}{
"status": {
"code": 413,
"message": "Request payload too large"
}
}{
"status": {
"code": 422,
"message": "Device is not fully authenticated. Please scan the QR code to complete the connection."
}
}{
"status": {
"code": 429,
"message": "Rate limit exceeded. Maximum 100 requests per minute per user."
}
}{
"status": {
"code": 500,
"message": "Failed to send media message"
}
}messages
send media message
Send a media message (image only: PNG, JPEG, GIF, WebP). Must provide either mediaUrl or mediaBase64, but not both. Maximum file size: 10MB.
POST
/
devices
/
{id}
/
messages
/
media
send media message
curl --request POST \
--url https://api.chatlevel.io/v1/devices/{id}/messages/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "[email protected]",
"toNumber": "31620292537",
"mediaUrl": "<string>",
"mediaBase64": "<string>",
"mediaCaption": "<string>"
}
'import requests
url = "https://api.chatlevel.io/v1/devices/{id}/messages/media"
payload = {
"to": "[email protected]",
"toNumber": "31620292537",
"mediaUrl": "<string>",
"mediaBase64": "<string>",
"mediaCaption": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '[email protected]',
toNumber: '31620292537',
mediaUrl: '<string>',
mediaBase64: '<string>',
mediaCaption: '<string>'
})
};
fetch('https://api.chatlevel.io/v1/devices/{id}/messages/media', 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://api.chatlevel.io/v1/devices/{id}/messages/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '[email protected]',
'toNumber' => '31620292537',
'mediaUrl' => '<string>',
'mediaBase64' => '<string>',
'mediaCaption' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.chatlevel.io/v1/devices/{id}/messages/media"
payload := strings.NewReader("{\n \"to\": \"[email protected]\",\n \"toNumber\": \"31620292537\",\n \"mediaUrl\": \"<string>\",\n \"mediaBase64\": \"<string>\",\n \"mediaCaption\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.chatlevel.io/v1/devices/{id}/messages/media")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"[email protected]\",\n \"toNumber\": \"31620292537\",\n \"mediaUrl\": \"<string>\",\n \"mediaBase64\": \"<string>\",\n \"mediaCaption\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatlevel.io/v1/devices/{id}/messages/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"[email protected]\",\n \"toNumber\": \"31620292537\",\n \"mediaUrl\": \"<string>\",\n \"mediaBase64\": \"<string>\",\n \"mediaCaption\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"messageId": "3EB0C1F0B2F0A1D5E8F4"
}{
"status": {
"code": 400,
"message": "Invalid image format (only PNG, JPEG, GIF, WebP allowed)"
}
}{
"status": "error",
"error": {
"code": 401,
"message": "Missing or invalid authorization header. Please provide a Bearer token."
}
}{
"status": {
"code": 404,
"message": "Device 12345 is not connected. Please restart the device or scan the QR code to connect."
}
}{
"status": {
"code": 408,
"message": "Request timeout"
}
}{
"status": {
"code": 413,
"message": "Request payload too large"
}
}{
"status": {
"code": 422,
"message": "Device is not fully authenticated. Please scan the QR code to complete the connection."
}
}{
"status": {
"code": 429,
"message": "Rate limit exceeded. Maximum 100 requests per minute per user."
}
}{
"status": {
"code": 500,
"message": "Failed to send media message"
}
}Authorizations
API key authentication. Provide your API key as: Authorization: Bearer <api_key>
Path Parameters
Device ID Numeric device identifier
Body
application/json
- Option 1
- Option 2
Full WhatsApp JID. Use for LIDs (e.g., '138087493537914@lid'), groups (e.g., '[email protected]'), or full phone JIDs (e.g., '[email protected]'). Mutually exclusive with toNumber.
Example:
WhatsApp phone number (digits only, 8-15 digits). Will be formatted as [email protected]. Mutually exclusive with 'to'.
Example:
"31620292537"
URL of the media file
Base64 encoded media content
Optional caption for the media
⌘I
