Documentação ›
Contactos › Opt-out contatto
POST
Opt-out contatto
POSThttps://app.sendapp.ai/api/contacts/{id}/opt-out
Esclude il contatto dalle campagne e dagli invii marketing (stesso effetto di una risposta STOP). Idempotente: l'opt-out di un contatto già escluso restituisce
changed = false. Parâmetros
apikey
obrigatório
La tua API Key (anche header
X-API-Key).
id
obrigatório
ID do contacto (inteiro, no path). Use
GET /api/contacts para o encontrar.
reason
opcional
Etichetta breve salvata come motivo dell'opt-out (default "api").
Pedido
curl -X POST 'https://app.sendapp.ai/api/contacts/42/opt-out' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "reason": "crm_sync" }'<?php
$ch = curl_init('https://app.sendapp.ai/api/contacts/42/opt-out');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['X-API-Key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['reason' => 'crm_sync']),
]);
echo curl_exec($ch);
curl_close($ch);const res = await fetch('https://app.sendapp.ai/api/contacts/42/opt-out', {
method: 'POST',
headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ reason: 'crm_sync' })
});
console.log(await res.json());Resposta (200 OK)
{
"status": "success",
"changed": true,
"contact": { "id": 42, "opted_out": true, "opted_out_reason": "crm_sync", "...": "..." }
}Erro
{
"status": "error",
"message": "Contact not found."
}