Conversations

Sync History

Requests synchronization of older message history for a chat. Messages arrive via webhook/SSE.

POSThttps://api.zapzapapi.com/api/v1/{instanceId}/message/history-sync

Authentication with the x-api-key and x-api-secret headers.

Parameters

NameTypeInRequiredDescription
messageidtextbodyNoReference message ID used to fetch older messages from the chat
numbertextbodyNoFull chat JID
countnumberbodyNoDesired number of messages in the sync

Request example

curl

curl -X POST "https://api.zapzapapi.com/api/v1/{instanceId}/message/history-sync" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-api-secret: YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"messageid":"3EB01234567890ABCDEF","number":"5511999999999@s.whatsapp.net"}'

Node.js

const res = await fetch("https://api.zapzapapi.com/api/v1/{instanceId}/message/history-sync", {
  method: "POST",
  headers: {
    "x-api-key": "YOUR_API_KEY",
    "x-api-secret": "YOUR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "messageid": "3EB01234567890ABCDEF",
    "number": "5511999999999@s.whatsapp.net"
  }),
});
console.log(await res.json());

Python

import requests

res = requests.post(
    "https://api.zapzapapi.com/api/v1/{instanceId}/message/history-sync",
    headers={"x-api-key": "YOUR_API_KEY", "x-api-secret": "YOUR_API_SECRET"},
    json={"messageid":"3EB01234567890ABCDEF","number":"5511999999999@s.whatsapp.net"},
)
print(res.json())

Response example

JSON

{
  "ok": true,
  "count": 50
}

Values are illustrative; the fields follow the real response format.

See the full reference

Get your API keys

Create your account, connect a number in minutes and start using the API. R$15 per active number/month, with a welcome credit when you create the account, subject to the current campaign.