curl --request POST \
--url https://api.cloudtalk.io/v1/message-media \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileimport requests
url = "https://api.cloudtalk.io/v1/message-media"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
options.body = form;
fetch('https://api.cloudtalk.io/v1/message-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.cloudtalk.io/v1/message-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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: multipart/form-data"
],
]);
$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.cloudtalk.io/v1/message-media"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.cloudtalk.io/v1/message-media")
.header("Authorization", "Basic <encoded-value>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudtalk.io/v1/message-media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "77120",
"contentType": "image/jpeg",
"size": 48213,
"expiresAt": "2026-11-13T10:00:00Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"code": "UNAUTHORIZED",
"message": "You are not authorized to access this resource."
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}<string>{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}Upload media
Uploads one image or file as multipart/form-data with one part, file, and answers 201 with its id. Pass the id in mediaIds on Send a message before expiresAt, 24 hours after the upload. Each upload goes with one message.
Images: jpg, png or gif on MMS, jpg or png on WhatsApp (image/jpeg, image/jpg, image/png, image/gif), up to 5,226,880 bytes on both channels.
Files, for WhatsApp only, up to 16,777,216 bytes (16 MiB): PDF (application/pdf); vCard (text/vcard, text/x-vcard, application/vcard); text/csv, text/rtf, text/richtext, text/calendar and text/directory; images image/bmp and image/tiff; audio audio/mpeg, audio/mp4, audio/ogg, audio/amr, audio/amr-nb, audio/3gpp, audio/3gpp2, audio/ac3, audio/webm, audio/basic, audio/L24, audio/vnd.wave and audio/vnd.rn-realaudio; video video/mp4, video/mpeg, video/quicktime, video/webm, video/3gpp, video/3gpp2, video/3gpp-tt, video/H261, video/H263, video/H263-1998, video/H263-2000 and video/H264.
Every upload needs SMS on your account, and files other than images also need WhatsApp. The declared type must match the file’s content. There is no upload by URL. The file name comes back as media[].fileName on the message.
Counts toward your company’s Messaging rate limit, one count shared by the Messages, Conversations, WhatsApp templates and media operations: 60 requests per minute by default. See Rate limiting.
curl --request POST \
--url https://api.cloudtalk.io/v1/message-media \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileimport requests
url = "https://api.cloudtalk.io/v1/message-media"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
options.body = form;
fetch('https://api.cloudtalk.io/v1/message-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.cloudtalk.io/v1/message-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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: multipart/form-data"
],
]);
$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.cloudtalk.io/v1/message-media"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.cloudtalk.io/v1/message-media")
.header("Authorization", "Basic <encoded-value>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudtalk.io/v1/message-media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "77120",
"contentType": "image/jpeg",
"size": 48213,
"expiresAt": "2026-11-13T10:00:00Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"code": "UNAUTHORIZED",
"message": "You are not authorized to access this resource."
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}<string>{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"retryable": true,
"candidates": [
{
"id": "<string>",
"numberE164": "<string>",
"internalName": "<string>"
}
]
},
"target": "<string>"
},
"requestId": "<string>"
}Authorizations
HTTP Basic Authentication. Use your API Access Key ID as the username and your API Access Key Secret as the password. Generate keys in the CloudTalk Dashboard under Account -> Settings -> API Keys (https://dashboard.cloudtalk.io/menu/account/settings/API-keys).
Response
Uploaded. Send the id in mediaIds before expiresAt.
What mediaIds takes on Send a message.
"77120"