Spam Detection
Classify short-form text as spam or legitimate (ham). Ideal for messages, comments, emails, and form submissions.
POST
/spam/detectAuthentication
Bearer token in the Authorization header.
Request
Content-Type:
application/json| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Required | The message or text to classify. Long text is automatically chunked. |
Response
| Field | Type | Description |
|---|---|---|
| score | number | Probability the text is spam (0.0 – 1.0). |
| is_spam | boolean | Whether the text is classified as spam. |
| verdict | string | Human-readable verdict: "ham", "likely_ham", "suspicious", "likely_spam", or "spam". |
Example
Request
curl -X POST https://api.cacuda.com/spam/detect \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Congratulations! You have won a free iPhone!"}'Response 200 OK
{
"score": 0.97,
"is_spam": true,
"verdict": "spam"
}Error Codes
| Code | Description |
|---|---|
| 400 | Missing or empty text field. |
| 401 | Missing or invalid API key. |
| 402 | Insufficient credits. |
| 503 | Detection service unavailable. |
Notes
Text longer than ~450 tokens is automatically split into chunks. Each chunk consumes one credit.
Try it in the scanner
Test this endpoint interactively with real data. No code required.
Open Scanner