Account and Instances

Configure Webhook

Sets or updates the instance webhook URL. The URL must be public and reachable over HTTPS. Events such as received messages, delivery status, and connection changes will be sent via POST to this URL. ⚠️ URL WARNING: {id} is already in the path: do NOT add it twice. ✅ Correct: PUT /api/v1/instances/YOUR-INSTANCE-ID/webhook ❌ Wrong: PUT /api/v1/YOUR-INSTANCE-ID/instances/YOUR-INSTANCE-ID/webhook (duplicated instanceId)

PUThttps://api.zapzapapi.com/api/v1/instances/{id}/webhook

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

Parameters

NameTypeInRequiredDescription
idtextpathYesInstance ID
webhook_urltextbodyYesWebhook URL (HTTPS)
eventstextbodyNoEvents to receive (empty = all)
excludeMessagesselectbodyNoExclude own messages

Request example

curl

curl -X PUT "https://api.zapzapapi.com/api/v1/instances/{id}/webhook" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-api-secret: YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"webhook_url":"https://meusite.com/webhook"}'

Node.js

const res = await fetch("https://api.zapzapapi.com/api/v1/instances/{id}/webhook", {
  method: "PUT",
  headers: {
    "x-api-key": "YOUR_API_KEY",
    "x-api-secret": "YOUR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "webhook_url": "https://meusite.com/webhook"
  }),
});
console.log(await res.json());

Python

import requests

res = requests.put(
    "https://api.zapzapapi.com/api/v1/instances/{id}/webhook",
    headers={"x-api-key": "YOUR_API_KEY", "x-api-secret": "YOUR_API_SECRET"},
    json={"webhook_url":"https://meusite.com/webhook"},
)
print(res.json())

Response example

JSON

{
  "ok": true,
  "webhook_url": "https://meusite.com/webhook"
}

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.