Baixar mídia (unificado)
curl --request POST \
--url https://api.d-api.cloud/api/v1/media/download \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "<string>",
"media_key": "<string>",
"mimetype": "<string>",
"url": "<string>",
"direct_path": "<string>",
"file_enc_sha256": "<string>",
"file_sha256": "<string>",
"file_length": 123,
"async": "<string>",
"base64": true
}
'import requests
url = "https://api.d-api.cloud/api/v1/media/download"
payload = {
"sessionId": "<string>",
"media_key": "<string>",
"mimetype": "<string>",
"url": "<string>",
"direct_path": "<string>",
"file_enc_sha256": "<string>",
"file_sha256": "<string>",
"file_length": 123,
"async": "<string>",
"base64": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sessionId: '<string>',
media_key: '<string>',
mimetype: '<string>',
url: '<string>',
direct_path: '<string>',
file_enc_sha256: '<string>',
file_sha256: '<string>',
file_length: 123,
async: '<string>',
base64: true
})
};
fetch('https://api.d-api.cloud/api/v1/media/download', 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.d-api.cloud/api/v1/media/download",
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([
'sessionId' => '<string>',
'media_key' => '<string>',
'mimetype' => '<string>',
'url' => '<string>',
'direct_path' => '<string>',
'file_enc_sha256' => '<string>',
'file_sha256' => '<string>',
'file_length' => 123,
'async' => '<string>',
'base64' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.d-api.cloud/api/v1/media/download"
payload := strings.NewReader("{\n \"sessionId\": \"<string>\",\n \"media_key\": \"<string>\",\n \"mimetype\": \"<string>\",\n \"url\": \"<string>\",\n \"direct_path\": \"<string>\",\n \"file_enc_sha256\": \"<string>\",\n \"file_sha256\": \"<string>\",\n \"file_length\": 123,\n \"async\": \"<string>\",\n \"base64\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.d-api.cloud/api/v1/media/download")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"<string>\",\n \"media_key\": \"<string>\",\n \"mimetype\": \"<string>\",\n \"url\": \"<string>\",\n \"direct_path\": \"<string>\",\n \"file_enc_sha256\": \"<string>\",\n \"file_sha256\": \"<string>\",\n \"file_length\": 123,\n \"async\": \"<string>\",\n \"base64\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/media/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sessionId\": \"<string>\",\n \"media_key\": \"<string>\",\n \"mimetype\": \"<string>\",\n \"url\": \"<string>\",\n \"direct_path\": \"<string>\",\n \"file_enc_sha256\": \"<string>\",\n \"file_sha256\": \"<string>\",\n \"file_length\": 123,\n \"async\": \"<string>\",\n \"base64\": true\n}"
response = http.request(request)
puts response.read_bodyGuias
Baixar mídia
Baixe mídia recebida de forma unificada.
POST
/
api
/
v1
/
media
/
download
Baixar mídia (unificado)
curl --request POST \
--url https://api.d-api.cloud/api/v1/media/download \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "<string>",
"media_key": "<string>",
"mimetype": "<string>",
"url": "<string>",
"direct_path": "<string>",
"file_enc_sha256": "<string>",
"file_sha256": "<string>",
"file_length": 123,
"async": "<string>",
"base64": true
}
'import requests
url = "https://api.d-api.cloud/api/v1/media/download"
payload = {
"sessionId": "<string>",
"media_key": "<string>",
"mimetype": "<string>",
"url": "<string>",
"direct_path": "<string>",
"file_enc_sha256": "<string>",
"file_sha256": "<string>",
"file_length": 123,
"async": "<string>",
"base64": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sessionId: '<string>',
media_key: '<string>',
mimetype: '<string>',
url: '<string>',
direct_path: '<string>',
file_enc_sha256: '<string>',
file_sha256: '<string>',
file_length: 123,
async: '<string>',
base64: true
})
};
fetch('https://api.d-api.cloud/api/v1/media/download', 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.d-api.cloud/api/v1/media/download",
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([
'sessionId' => '<string>',
'media_key' => '<string>',
'mimetype' => '<string>',
'url' => '<string>',
'direct_path' => '<string>',
'file_enc_sha256' => '<string>',
'file_sha256' => '<string>',
'file_length' => 123,
'async' => '<string>',
'base64' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.d-api.cloud/api/v1/media/download"
payload := strings.NewReader("{\n \"sessionId\": \"<string>\",\n \"media_key\": \"<string>\",\n \"mimetype\": \"<string>\",\n \"url\": \"<string>\",\n \"direct_path\": \"<string>\",\n \"file_enc_sha256\": \"<string>\",\n \"file_sha256\": \"<string>\",\n \"file_length\": 123,\n \"async\": \"<string>\",\n \"base64\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.d-api.cloud/api/v1/media/download")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"<string>\",\n \"media_key\": \"<string>\",\n \"mimetype\": \"<string>\",\n \"url\": \"<string>\",\n \"direct_path\": \"<string>\",\n \"file_enc_sha256\": \"<string>\",\n \"file_sha256\": \"<string>\",\n \"file_length\": 123,\n \"async\": \"<string>\",\n \"base64\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/media/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sessionId\": \"<string>\",\n \"media_key\": \"<string>\",\n \"mimetype\": \"<string>\",\n \"url\": \"<string>\",\n \"direct_path\": \"<string>\",\n \"file_enc_sha256\": \"<string>\",\n \"file_sha256\": \"<string>\",\n \"file_length\": 123,\n \"async\": \"<string>\",\n \"base64\": true\n}"
response = http.request(request)
puts response.read_bodyBaixa a mídia de uma mensagem recebida. O WhatsApp entrega mídias criptografadas;
este endpoint descriptografa usando os metadados que chegam no webhook
(
media_key, mimetype, direct_path ou url, e os hashes).
Defina base64: true para receber o conteúdo embutido na resposta, ou use
async para downloads grandes em segundo plano.
Os campos necessários (
media_key, mimetype, file_sha256 etc.) vêm no
payload do webhook de mensagem recebida — repasse-os diretamente para cá.Authorizations
API Key para autenticação. Formato: <API_KEY>
Body
application/jsonmultipart/form-datatext/plain
Response
200
Resposta bem-sucedida
⌘I
