API reference/ Feedback
API reference

Feedback

Correct a verdict, one at a time or in bulk. Feedback trains your site's memory and the sender's reputation.

Correct a verdict

POST /v1/feedback API key
Body
id string required

The verdict id returned by /v1/classify.

label "spam" | "ham" required

The correct label.

curl -X POST https://api.spamex.dev/v1/feedback \
  -H "Authorization: Bearer $SPAMEX_KEY" -H "Content-Type: application/json" \
  -d '{"id": "3f0c1a9e2b7d4e1f9c3a5b6d7e8f9a0b", "label": "ham"}'
{ "ok": true, "id": "3f0c1a9e2b7d4e1f9c3a5b6d7e8f9a0b", "label": "ham" }

Only ids from your own key are accepted; anything else is 404. Sending feedback for an id twice replaces the earlier label.

What happens next

  • ham. The message is removed from the shared spam index and remembered as your legitimate message: an identical or near-identical submission to your site returns DUP_KNOWN_HAM at once. The sender’s IP, email and domain receive a strong ham vote.
  • spam. The message is remembered as spam for your site. The sender’s reputation receives a strong spam vote. Other sites see that vote only once a second, independent site agrees, so no single customer can blacklist a sender for everyone.

Bulk corrections

POST /v1/feedback/batch API key

For a “mark all as not spam” action. Up to 100 items per call. Unknown ids are reported, not fatal.

Body
items object[] required

A list of { "id": "...", "label": "spam" | "ham" } objects, 1 to 100 entries.

curl -X POST https://api.spamex.dev/v1/feedback/batch \
  -H "Authorization: Bearer $SPAMEX_KEY" -H "Content-Type: application/json" \
  -d '{"items": [
    {"id": "3f0c1a9e2b7d4e1f9c3a5b6d7e8f9a0b", "label": "ham"},
    {"id": "9b1e4c2d7a0f4b3e8d6c5a4f3e2d1c0b", "label": "ham"},
    {"id": "0000000000000000000000000000dead", "label": "spam"}
  ]}'
{ "ok": true, "applied": 2, "missing": ["0000000000000000000000000000dead"] }
↑↓ navigate↵ openDocs and blog