Test mode and test values

Use these values to test how your integration handles spam and ham results. SpamAPI answers them with a fixed result, without classifying the content.

  • They need a valid API key and count toward rate limits.
  • They don't use monthly checks and don't appear in usage or site statistics. Once this month's checks are used up, they are rejected with 429 usage_limit_exceeded like any other check.
  • Their responses have no prediction_ref, because no check is stored.

Force a spam result

Send one of these values in POST /api/v1/check. Matching ignores letter case.

Field Value
comment_author spamapi-guaranteed-spam
comment_author viagra-test-123
comment_author_email spam@test.spamapi.com
comment_author_email akismet-guaranteed-spam@example.com
curl https://api.spamapi.de/api/v1/check \
  -H "X-API-Key: $SPAMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "blog": "https://example.com",
    "user_ip": "203.0.113.10",
    "comment_author": "spamapi-guaranteed-spam",
    "comment_content": "Test submission"
  }'
{
  "is_spam": true,
  "score": 1,
  "recommendation": "discard",
  "reasons": ["guaranteed_spam"],
  "request_id": "6f1d9c2b-3e4a-4b5c-8d7e-9f0a1b2c3d4e"
}

Force a ham result

Set is_test to true and user_role to administrator. Both are required; is_test alone doesn't change the result. This takes precedence over the spam values above.

curl https://api.spamapi.de/api/v1/check \
  -H "X-API-Key: $SPAMAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "blog": "https://example.com",
    "user_ip": "203.0.113.10",
    "comment_content": "Test submission",
    "user_role": "administrator",
    "is_test": true
  }'
{
  "is_spam": false,
  "score": 0,
  "recommendation": "allow",
  "request_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
}

Don't send is_test or user_role from production traffic unless you mean to skip classification.

Test the WordPress plugin

Sign out of WordPress, or use a private browser window, and post a comment or submit a supported form with the email address spam@test.spamapi.com. The plugin treats it as spam; see what happens to spam for each form plugin. Comments from users who can moderate comments aren't checked.