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)
https://api.zapzapapi.com/api/v1/instances/{id}/webhookAuthentication with the x-api-key and x-api-secret headers.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
id | text | path | Yes | Instance ID |
webhook_url | text | body | Yes | Webhook URL (HTTPS) |
events | text | body | No | Events to receive (empty = all) |
excludeMessages | select | body | No | Exclude 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.
Other endpoints in this category
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.
