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"
}On-demand history sweep
For each chat (the ones in chats, or the maxChats with the most recent message), asks the phone for the messages older than the oldest one already stored, page by page, until the phone returns nothing. Each chat’s anchor is its oldest stored message: chats with no stored message are left out. Runs in the background: the response only confirms the start and returns the request’s requestId. The messages arrive as history.message.* events on RabbitMQ; with webhookUrl or webhook: true, the new messages also arrive at the webhook, in the history.on_demand.messages event. The cap per chat is maxPagesPerChat × count. The phone must be online, and its answer is best-effort. requestFull also asks for a FULL_HISTORY_SYNC_ON_DEMAND, accepted only on WhatsApp Business; on personal WhatsApp, the full history from pairing cannot be repeated without pairing again. cancel stops the sweep in progress. History media is not stored.
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"
}Body
Response
Sweep started (or cancelled, with cancel)
