Webhooks
Alterar um endpoint de webhook
Altera só os campos enviados.
PATCH https://api.diska.ai/v1/webhook-endpoints/{endpoint_id}
Âmbito: webhooks:manage
active: true reactiva um endpoint desactivado e põe failure_count a zero; active: false pára as entregas. O secret não muda.
Parâmetros
No caminho
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
endpoint_id | string | Sim | Identificador do endpoint. |
Corpo do pedido
application/json
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
url | string | null | Não | Novo URL https://. 12 a 2000 caracteres. |
description | string | null | Não | Nova descrição; "" apaga-a. Até 500 caracteres. |
events | array | Não | Nova lista de eventos (pelo menos um). |
active | boolean | null | Não | true reactiva e põe failure_count a zero; false pára as entregas. |
{
"active": true
}
Exemplos
curl -X PATCH "https://api.diska.ai/v1/webhook-endpoints/<endpoint_id>" \
-H "Authorization: Bearer $DISKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"active":true}'
import os
import requests
response = requests.patch(
"https://api.diska.ai/v1/webhook-endpoints/<endpoint_id>",
headers={"Authorization": f"Bearer {os.environ['DISKA_API_KEY']}"},
json={
"active": True,
},
timeout=30,
)
response.raise_for_status()
print(response.json())
// Node.js 18 ou superior, num ficheiro .mjs
const response = await fetch('https://api.diska.ai/v1/webhook-endpoints/<endpoint_id>', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.DISKA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"active": true
})
})
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`)
console.log(await response.json())
<?php
$ch = curl_init('https://api.diska.ai/v1/webhook-endpoints/<endpoint_id>');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DISKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'active' => true,
]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $body");
}
print_r(json_decode($body, true));
Experimentar
Envie o pedido a partir desta página, com a sua chave. A chave fica só nesta página: não é guardada e só é enviada para api.diska.ai. Use uma chave de teste com os âmbitos mínimos.
PATCH
https://api.diska.ai/v1/webhook-endpoints/{endpoint_id}Começa por dsk_. Fica só neste separador do browser.
path
Introduza uma chave API (dsk_…).
Resposta 200
| Campo | Tipo | Descrição |
|---|---|---|
id | string | Identificador do endpoint. |
url | string | Destino das entregas. |
description | string | null | Descrição. |
events | array | Eventos subscritos. |
active | boolean | false quando foi desactivado (por si ou automaticamente). Padrão: true. |
disabled_reason | string | null | Motivo da desactivação automática, ou null. |
failure_count | integer | Entregas falhadas seguidas. Padrão: 0. |
last_delivery_at | string | null | Última entrega. |
last_delivery_status | string | null | Resultado da última entrega, por exemplo delivered (200). |
secret_preview | string | Início e fim do secret, para o identificar. |
created_at | string | null | Data de criação (ISO 8601). |
{
"id": "e7a1c3f5-9b2d-4f6e-8a0c-3d5f7b9e1c24",
"url": "https://o-seu-sistema.com/hooks/diska",
"description": "CRM — produção",
"events": [
"call.completed"
],
"active": true,
"disabled_reason": null,
"failure_count": 0,
"last_delivery_at": "2026-10-25T18:40:00Z",
"last_delivery_status": "delivered (200)",
"secret_preview": "dskw_AbC…wXyZ",
"created_at": "2026-10-25T18:40:00Z"
}
Erros
| Código | Quando |
|---|---|
400 | URL inválido: use um endpoint https:// completo., URL bloqueado por segurança: …, Subscreva pelo menos um evento., Eventos desconhecidos: … ou Limite de 10 endpoints por organização atingido. |
404 | Endpoint não encontrado. |
Os erros comuns a todos os endpoints (401, 403, 422, 429 e 5xx) estão em Erros.

