MasLeads API
Producción estable Referencia API
PUT /api/v1/settings/webhook

Configurar Webhook

Configura o actualiza el webhook por defecto para recibir notificaciones automáticas cuando tus jobs se completen.

El webhook debe responder con HTTP 200 en menos de 10 segundos. Se reintentan hasta 5 veces con backoff exponencial.

Autenticación

X-API-Key cabecera HTTP obligatorio

Tu API Key privada de MasLeads. Obtenla en el panel de control (Perfil → API → API Keys). Pásala en todas las llamadas en la cabecera HTTP.

Ejemplo: X-API-Key: sk_live_...

Cuerpo de la Solicitud (Body)

webhook_url string obligatorio

URL donde enviar las notificaciones. Debe ser HTTPS.

Ejemplo: https://tu-servidor.com/webhooks/masleads

webhook_secret string opcional

Secreto para firmar el payload con HMAC-SHA256. Mínimo 16 caracteres. Recomendado: 32+ caracteres aleatorios.

Restricciones: 16-100 caracteres

Ejemplo: mi_secreto_webhook_muy_seguro_123456

Códigos de Estado

CódigoDescripción
200Webhook configurado exitosamente
400URL inválida o secreto demasiado corto
401API Key inválida, revocada o no enviada
429Rate limit excedido
PUT https://api.masleads.es/api/v1/settings/webhook
curl -X PUT "https://api.masleads.es/api/v1/settings/webhook" \
  -H "X-API-Key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "webhook_url": "https://tu-servidor.com/webhooks/masleads",
  "webhook_secret": "mi_secreto_webhook_muy_seguro_123456"
}'
import requests

url = "https://api.masleads.es/api/v1/settings/webhook"
headers = {
    "X-API-Key": "sk_live_...",
    "Content-Type": "application/json",
}

payload = {
    "webhook_url": "https://tu-servidor.com/webhooks/masleads",
    "webhook_secret": "mi_secreto_webhook_muy_seguro_123456"
}

response = requests.put(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
const response = await fetch("https://api.masleads.es/api/v1/settings/webhook", {
  method: "PUT",
  headers: {
    "X-API-Key": "sk_live_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "webhook_url": "https://tu-servidor.com/webhooks/masleads",
    "webhook_secret": "mi_secreto_webhook_muy_seguro_123456"
  })
});

const data = await response.json();
console.log(data);
Respuesta de ejemplo 200
{
  "webhook_url": "https://tu-servidor.com/webhooks/masleads",
  "webhook_secret": "****",
  "is_configured": true,
  "last_triggered_at": null,
  "last_status_code": null,
  "created_at": "2026-01-09T10:00:00",
  "updated_at": "2026-01-09T10:00:00"
}