Campanhas
Pausar uma campanha
Deixa de iniciar chamadas novas; as chamadas em curso continuam e os destinatários por ligar ficam à espera.
POST https://api.diska.ai/v1/campaigns/{campaign_id}/pause
Âmbito: campaigns:write
Parâmetros
No caminho
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
campaign_id | string | Sim | Identificador da campanha. |
Exemplos
curl -X POST "https://api.diska.ai/v1/campaigns/<campaign_id>/pause" \
-H "Authorization: Bearer $DISKA_API_KEY"
import os
import requests
response = requests.post(
"https://api.diska.ai/v1/campaigns/<campaign_id>/pause",
headers={"Authorization": f"Bearer {os.environ['DISKA_API_KEY']}"},
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/campaigns/<campaign_id>/pause', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.DISKA_API_KEY}` }
})
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/campaigns/<campaign_id>/pause');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('DISKA_API_KEY')],
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.
POST
https://api.diska.ai/v1/campaigns/{campaign_id}/pauseComeça por dsk_. Fica só neste separador do browser.
path
Introduza uma chave API (dsk_…).
Resposta 200
| Campo | Tipo | Descrição |
|---|---|---|
id | string | Identificador da campanha. |
name | string | Nome. |
status | string | draft, scheduled, running, paused, completed ou cancelled. |
agent_id | string | null | Agente. |
agent_name | string | null | Nome do agente. |
phone_number_id | string | null | Linha usada. |
phone_number | string | null | Número da linha. |
schedule | object | Horário. |
schedule.start_at | string | null | Início (ISO 8601 com fuso), ou null para começar ao iniciar. |
schedule.timezone | string | Fuso das janelas. Padrão: Africa/Luanda. |
schedule.windows | array | Janelas por dia da semana. Sem janelas, liga dentro do horário de contacto. |
schedule.windows[].day | string | Dia da semana, em inglês. Um de: monday, tuesday, wednesday, thursday, friday, saturday, sunday. |
schedule.windows[].start | string | Início, HH:MM. |
schedule.windows[].end | string | Fim, HH:MM. |
schedule.max_duration_days | integer | Dias que a campanha pode durar; no fim, o que falta é cancelado. Entre 1 e 90. Padrão: 7. |
limits | object | Limites. |
limits.max_concurrency | integer | Chamadas da campanha em simultâneo. Entre 1 e 50. Padrão: 2. |
limits.reserved_capacity | integer | Chamadas simultâneas da organização que ficam livres para outras chamadas. Entre 0 e 50. Padrão: 1. |
limits.max_attempts | integer | Tentativas por destinatário; só não atendidas ou ocupadas são repetidas. Entre 1 e 3. Padrão: 1. |
limits.retry_delay_minutes | integer | Minutos entre tentativas. Entre 15 e 1440. Padrão: 60. |
limits.budget_minutes | integer | null | Minutos máximos; a campanha pausa antes de os ultrapassar. Entre 1 e 100000. |
pause_reason | string | null | Porque está pausada: manual, budget_exhausted, quota_exhausted ou emergency_stop. |
waiting_reason | string | null | Porque não está a ligar agora, por exemplo outside_window ou no_capacity. Um de: outside_window, not_started, no_capacity, capacity_not_configured, line_unavailable, outbound_disabled, agent_unavailable, number_unavailable, halted. |
next_window_at | string | null | Quando abre a próxima janela. |
deadline_at | string | null | Fim do prazo máximo. |
created_at | string | null | Data de criação (ISO 8601). |
started_at | string | null | Quando foi iniciada. |
completed_at | string | null | Quando terminou. |
cancelled_at | string | null | Quando foi cancelada. |
stats | object | Indicadores. |
stats.total | integer | Destinatários. Padrão: 0. |
stats.pending | integer | Por ligar. Padrão: 0. |
stats.in_flight | integer | A ligar ou em chamada. Padrão: 0. |
stats.completed | integer | Chamada feita (atendida, não atendida ou ocupado). Padrão: 0. |
stats.failed | integer | Não foi possível ligar. Padrão: 0. |
stats.cancelled | integer | Cancelados. Padrão: 0. |
stats.excluded | integer | Na lista de exclusão. Padrão: 0. |
stats.calls_started | integer | Tentativas enviadas (cada repetição conta). Padrão: 0. |
stats.answered | integer | Atendidas. Padrão: 0. |
stats.no_answer | integer | Não atendidas. Padrão: 0. |
stats.unavailable | integer | Ocupado ou indisponível. Padrão: 0. |
stats.answer_rate | number | null | Atendidas ÷ (atendidas + não atendidas + indisponíveis). |
stats.total_duration_seconds | integer | Soma da duração das chamadas atendidas. Padrão: 0. |
stats.progress | number | Destinatários em estado final ÷ total. Padrão: 0. |
stats.cost_kz | number | null | Custo em kwanzas, só quando há tarifa configurada. |
stats.with_post_call | integer | Chamadas com resultado pós-chamada. Padrão: 0. |
{
"id": "5c2e8a14-7d3b-4f9e-a1c6-0b8d2f4e6a93",
"name": "Exemplo",
"status": "draft",
"agent_id": "3f1c2a7e-5b9d-4c1e-8f3a-2d6b7e9c1a40",
"agent_name": "Recepção",
"phone_number_id": "5c2e8a14-7d3b-4f9e-a1c6-0b8d2f4e6a93",
"phone_number": "+244900000000",
"schedule": {
"start_at": "2026-10-25T18:40:00Z",
"timezone": "Africa/Luanda",
"windows": [
{
"day": "monday",
"start": "2026-10-25T18:40:00Z",
"end": "2026-11-01T18:40:00Z"
}
],
"max_duration_days": 7
},
"limits": {
"max_concurrency": 2,
"reserved_capacity": 1,
"max_attempts": 1,
"retry_delay_minutes": 60,
"budget_minutes": 0
},
"pause_reason": "manual",
"waiting_reason": "outside_window",
"next_window_at": "2026-10-25T18:40:00Z",
"deadline_at": "2026-10-25T18:40:00Z",
"created_at": "2026-10-25T18:40:00Z",
"started_at": "2026-10-25T18:40:00Z",
"completed_at": "2026-10-25T18:40:01Z",
"cancelled_at": "2026-10-25T18:40:00Z",
"stats": {
"total": 1,
"pending": 0,
"in_flight": 0,
"completed": 38,
"failed": 3,
"cancelled": 1,
"excluded": 0,
"calls_started": 0,
"answered": 0,
"no_answer": 0,
"unavailable": 0,
"answer_rate": 0,
"total_duration_seconds": 0,
"progress": 0,
"cost_kz": 0,
"with_post_call": 0
}
}
Erros
| Código | Quando |
|---|---|
409 | A campanha não está agendada nem em execução. |
Os erros comuns a todos os endpoints (401, 403, 422, 429 e 5xx) estão em Erros.

