Spam classification API

Check comments and form submissions for spam before they go live.

Send a submission to the SpamAPI REST API and get back a spam or ham classification, a score and a recommended action. Use it from any language; the SpamAPI Anti-Spam plugin uses the same API.

Free plan with 100 checks a month. No payment details needed.

Request
curl https://api.staging.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": "Watch Deals",
    "comment_content": "Cheap replica watches, order now!"
  }'
Example response (shortened)
{
  "is_spam": true,
  "score": 0.97,
  "recommendation": "discard",
  "request_id": "0f6c2a7e-5d1b-4c39-9e8a-2b7d4f1c6a90"
}
All fields in the API reference

How it works

Send content, get a classification, decide the action

One HTTPS request per submission. SpamAPI classifies; your code or the WordPress plugin acts on the result.

  1. Step 1

    Send the submission

    POST the comment or form submission as JSON to /api/v1/check with your API key in the X-API-Key header. Only blog, your site's URL, and user_ip, the visitor's IP address, are required. Add the text, author details and user agent you have.

  2. Step 2

    Get a classification

    The response says whether the submission is spam in is_spam, gives a score from 0 (ham) to 1 (spam) and recommends one of three actions.

  3. Step 3

    Decide what happens

    Your application stays in control. If a result is wrong, report it with /api/v1/submit-spam or /api/v1/submit-ham.

The three recommendations

allow
Publish the submission as usual.
review
Hold it for a person to check.
discard
Reject it or move it to spam.
Make your first check

Features

What every account includes

All plans have the same features. They differ only in how many checks you can make each month.

  • API keys you control

    Create named keys in the dashboard and revoke them when you no longer need them. A key is shown in full only once, when you create it.

  • Usage at a glance

    Each check response carries X-Usage-Limit, X-Usage-Used and X-Usage-Remaining headers. The dashboard shows your usage month by month.

  • Activity per site

    See which sites send checks, with their spam and ham counts and when each site was first and last seen.

  • Feedback on mistakes

    Report spam that got through and legitimate content that was flagged. Your reports appear in the dashboard's usage history.

  • Test mode

    Exercise your integration with test requests and documented test values before real visitors reach it.

  • Explicit failures

    If classification is unavailable, the API answers 503 with detection_unavailable and no decision. Failed checks don't count toward your quota.

Integrations

Use the API directly or through the WordPress plugin

  • For your own application

    REST API

    • JSON over HTTPS, authenticated with an API key header
    • An OpenAPI specification and examples in Go, JavaScript, PHP and Python
    • Endpoints for feedback, monthly usage and per-site statistics
  • For WordPress sites

    SpamAPI Anti-Spam plugin

    • Checks visitors' comments and the submissions of every supported form plugin that is active: Contact Form 7, Gravity Forms and WPForms
    • One switch turns protection on; one setting makes all checks lenient, balanced or strict
    • Requires WordPress 6.4 or newer and PHP 8.3 or newer
    • Installs from a ZIP download; no Composer needed

Good to know

What SpamAPI does and doesn't do

  • It classifies; you moderate

    SpamAPI returns a classification and a recommendation. It doesn't publish or delete anything on your site; your code or the WordPress plugin acts on the result.

  • Some results will be wrong

    Scores are estimates. Keep a way to review held submissions, and report mistakes so a misclassified message isn't lost.

  • Checks count toward a monthly quota

    At your plan's limit, the API answers 429 until the quota resets at the start of the next UTC month or you move to a larger plan.

  • Outages return no decision

    A 503 response means no classification was made. Decide how your code handles it; the WordPress plugin lets the submission through.

  • WordPress coverage is specific

    The plugin checks visitors' comments and Contact Form 7, Gravity Forms and WPForms. It doesn't check pingbacks, trackbacks, comments from moderators or other form plugins. See what's supported .

Create a free account and make your first check

Register, create an API key in the dashboard and send your first request. The Free plan includes 100 checks a month; see all plans.