Späw Documentation
Ressources

Protection

Des règles anti-fraude évaluées avant d'enregistrer un mandat ou de programmer un prélèvement. Une opération refusée renvoie une erreur 400 de code blocked_by_protection.

Lire les règles

GET/v1/protection
curl https://xn--spw-rla.com/v1/protection \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE"
const res = await fetch('https://xn--spw-rla.com/v1/protection', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
  },
});
const data = await res.json();
Réponse · 200
{
  "object": "protection",
  "max_amount": 50000,
  "allowed_countries": [
    "FR",
    "BE",
    "LU"
  ],
  "max_customers_per_iban": 2,
  "max_mandates_per_ip_per_hour": 20,
  "block_after_chargeback": true,
  "blocklist": [
    {
      "id": "blk_3",
      "kind": "iban",
      "value": "FR…2607",
      "reason": "Prélèvement contesté",
      "created": "2026-11-12T10:02:11.000Z"
    }
  ]
}

Modifier les règles

POST/v1/protection

Seuls les champs envoyés changent. null lève une limite.

Paramètres

max_amountentier
Plafond par échéance, en centimes. Un abonnement ou un prélèvement au-dessus est refusé.
allowed_countriesliste
Pays d'IBAN acceptés (codes à deux lettres). Liste vide : toute la zone SEPA.
max_customers_per_ibanentier
Nombre maximum de clients différents sur un même IBAN.
max_mandates_per_ip_per_hourentier
Mandats signés en ligne depuis une même adresse IP, par heure.
block_after_chargebackbooléen
Après une contestation : l'IBAN est bloqué et les abonnements du mandat passent en pause.
curl -X POST https://xn--spw-rla.com/v1/protection \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE" \
  -H "Content-Type: application/json" \
  -d '{
    "max_amount": 50000,
    "allowed_countries": [
      "FR",
      "BE",
      "LU"
    ],
    "max_customers_per_iban": 2
  }'
const res = await fetch('https://xn--spw-rla.com/v1/protection', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "max_amount": 50000,
    "allowed_countries": [
      "FR",
      "BE",
      "LU"
    ],
    "max_customers_per_iban": 2
  }),
});
const data = await res.json();
Réponse · 200
{
  "object": "protection",
  "max_amount": 50000,
  "allowed_countries": [
    "FR",
    "BE",
    "LU"
  ],
  "max_customers_per_iban": 2,
  "max_mandates_per_ip_per_hour": 20,
  "block_after_chargeback": true,
  "blocklist": [
    {
      "id": "blk_3",
      "kind": "iban",
      "value": "FR…2607",
      "reason": "Prélèvement contesté",
      "created": "2026-11-12T10:02:11.000Z"
    }
  ]
}

Bloquer un IBAN ou un e-mail

POST/v1/protection/blocklist

Un IBAN bloqué n'est jamais conservé en clair : seule son empreinte l'est.

Paramètres

ibantexte
IBAN à bloquer.
emailtexte
Ou adresse e-mail à bloquer.
reasontexte
Motif, pour mémoire.
curl -X POST https://xn--spw-rla.com/v1/protection/blocklist \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "fraude@example.org",
    "reason": "Signalé par le support"
  }'
const res = await fetch('https://xn--spw-rla.com/v1/protection/blocklist', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "email": "fraude@example.org",
    "reason": "Signalé par le support"
  }),
});
const data = await res.json();
Réponse · 201
{
  "object": "protection",
  "max_amount": 50000,
  "allowed_countries": [
    "FR",
    "BE",
    "LU"
  ],
  "max_customers_per_iban": 2,
  "max_mandates_per_ip_per_hour": 20,
  "block_after_chargeback": true,
  "blocklist": [
    {
      "id": "blk_3",
      "kind": "iban",
      "value": "FR…2607",
      "reason": "Prélèvement contesté",
      "created": "2026-11-12T10:02:11.000Z"
    }
  ]
}

Retirer de la liste de blocage

DELETE/v1/protection/blocklist/:id
curl -X DELETE https://xn--spw-rla.com/v1/protection/blocklist/blk_3 \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE"
const res = await fetch('https://xn--spw-rla.com/v1/protection/blocklist/blk_3', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
  },
});
const data = await res.json();
Réponse · 200
{
  "id": "blk_3",
  "deleted": true
}