curl --request POST \
--url https://api.d-api.cloud/api/v1/history/full-sync \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "minha-sessao",
"maxChats": 50,
"count": 50,
"maxPagesPerChat": 10,
"intervalMs": 3000
}
'import requests
url = "https://api.d-api.cloud/api/v1/history/full-sync"
payload = {
"sessionId": "minha-sessao",
"maxChats": 50,
"count": 50,
"maxPagesPerChat": 10,
"intervalMs": 3000
}
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: 'minha-sessao',
maxChats: 50,
count: 50,
maxPagesPerChat: 10,
intervalMs: 3000
})
};
fetch('https://api.d-api.cloud/api/v1/history/full-sync', 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/history/full-sync",
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' => 'minha-sessao',
'maxChats' => 50,
'count' => 50,
'maxPagesPerChat' => 10,
'intervalMs' => 3000
]),
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/history/full-sync"
payload := strings.NewReader("{\n \"sessionId\": \"minha-sessao\",\n \"maxChats\": 50,\n \"count\": 50,\n \"maxPagesPerChat\": 10,\n \"intervalMs\": 3000\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/history/full-sync")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"minha-sessao\",\n \"maxChats\": 50,\n \"count\": 50,\n \"maxPagesPerChat\": 10,\n \"intervalMs\": 3000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/history/full-sync")
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\": \"minha-sessao\",\n \"maxChats\": 50,\n \"count\": 50,\n \"maxPagesPerChat\": 10,\n \"intervalMs\": 3000\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"requestId": "3f6c1d2e-9a4b-4c8d-b7e1-5a2f0c9d8e71",
"sessionId": "minha-sessao",
"data": {
"status": "started",
"chats": 50,
"count": 50,
"max_pages_per_chat": 10,
"interval_ms": 3000
},
"timestamp": "2026-12-01T14:00:00.000Z"
}{
"success": false,
"error": "No stored messages to anchor the history request",
"sessionId": "minha-sessao"
}{
"success": false,
"error": "Session not found",
"sessionId": "minha-sessao"
}{
"success": false,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"error": "a history full sync is already running for this session; send cancel=true to stop it",
"sessionId": "minha-sessao"
}{
"success": false,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"error": "full history request failed",
"sessionId": "minha-sessao"
}{
"success": false,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"error": "Command timeout - no response received within 30 seconds",
"sessionId": "minha-sessao"
}Varredura de histórico sob demanda
Para cada conversa (as informadas em chats ou as maxChats com mensagem mais recente), pede ao celular as mensagens anteriores à mais antiga já gravada, página por página, até o celular devolver vazio. A âncora de cada conversa é a mensagem mais antiga gravada no banco: conversa sem mensagem gravada fica de fora. Roda em background: a resposta só confirma o início e traz o requestId do pedido. As mensagens chegam pelos eventos history.message.* no RabbitMQ; com webhookUrl ou webhook: true, as mensagens novas também chegam no webhook, no evento history.on_demand.messages. O teto por conversa é maxPagesPerChat × count. O celular precisa estar online, e a resposta dele é best-effort. requestFull também pede um FULL_HISTORY_SYNC_ON_DEMAND, aceito só em WhatsApp Business; no WhatsApp pessoal, o histórico completo do pareamento não pode ser repetido sem parear de novo. cancel interrompe a varredura em andamento. Mídia do histórico não é gravada.
curl --request POST \
--url https://api.d-api.cloud/api/v1/history/full-sync \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "minha-sessao",
"maxChats": 50,
"count": 50,
"maxPagesPerChat": 10,
"intervalMs": 3000
}
'import requests
url = "https://api.d-api.cloud/api/v1/history/full-sync"
payload = {
"sessionId": "minha-sessao",
"maxChats": 50,
"count": 50,
"maxPagesPerChat": 10,
"intervalMs": 3000
}
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: 'minha-sessao',
maxChats: 50,
count: 50,
maxPagesPerChat: 10,
intervalMs: 3000
})
};
fetch('https://api.d-api.cloud/api/v1/history/full-sync', 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/history/full-sync",
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' => 'minha-sessao',
'maxChats' => 50,
'count' => 50,
'maxPagesPerChat' => 10,
'intervalMs' => 3000
]),
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/history/full-sync"
payload := strings.NewReader("{\n \"sessionId\": \"minha-sessao\",\n \"maxChats\": 50,\n \"count\": 50,\n \"maxPagesPerChat\": 10,\n \"intervalMs\": 3000\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/history/full-sync")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"minha-sessao\",\n \"maxChats\": 50,\n \"count\": 50,\n \"maxPagesPerChat\": 10,\n \"intervalMs\": 3000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.d-api.cloud/api/v1/history/full-sync")
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\": \"minha-sessao\",\n \"maxChats\": 50,\n \"count\": 50,\n \"maxPagesPerChat\": 10,\n \"intervalMs\": 3000\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"requestId": "3f6c1d2e-9a4b-4c8d-b7e1-5a2f0c9d8e71",
"sessionId": "minha-sessao",
"data": {
"status": "started",
"chats": 50,
"count": 50,
"max_pages_per_chat": 10,
"interval_ms": 3000
},
"timestamp": "2026-12-01T14:00:00.000Z"
}{
"success": false,
"error": "No stored messages to anchor the history request",
"sessionId": "minha-sessao"
}{
"success": false,
"error": "Session not found",
"sessionId": "minha-sessao"
}{
"success": false,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"error": "a history full sync is already running for this session; send cancel=true to stop it",
"sessionId": "minha-sessao"
}{
"success": false,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"error": "full history request failed",
"sessionId": "minha-sessao"
}{
"success": false,
"commandId": "8f14e45f-ceea-467a-9b1c-2f4d9d6a1c10",
"error": "Command timeout - no response received within 30 seconds",
"sessionId": "minha-sessao"
}Corpo
Resposta
Varredura iniciada (ou cancelada, com cancel)
