Submit spam (missed spam)

This call is for submitting comments that weren’t marked as spam but should have been.

It is very important that the values you submit with this call match those of your comment‑check calls as closely as possible. In order to learn from its mistakes, Akismet needs to match your missed spam and false positive reports to the original comment‑check API calls made when the content was first posted. While it is normal for less information to be available for submit‑spam and submit‑ham calls (most comment systems and forums will not store all metadata), you should ensure that the values that you do send match those of the original content.

This method is called with the following URL:

https://rest.akismet.com/1.1/submit-spam

This call takes the same arguments as the comment check call.
Important: All parameters should be sent via the POST method.

Parameters

api_key (required)
Your Akismet API key. You can find this on your account dashboard at https://akismet.com/account/

blog (required)
The front page or home URL of the instance making the request. For a blog or wiki this would be the front page. Note: Must be a full URI, including http://.

user_ip (required)
IP address of the comment submitter.

user_agent
User agent string of the web browser submitting the comment – typically the HTTP_USER_AGENT cgi variable. Not to be confused with the user agent of your Akismet library.

referrer (note spelling)
The content of the HTTP_REFERER header should be sent here.

permalink
The full permanent URL of the entry the comment was submitted to.

comment_type
A string that describes the type of content being sent. Examples:

  • comment: A blog comment.
  • forum‑post: A top‑level forum post.
  • reply: A reply to a top‑level forum post.
  • blog‑post: A blog post.
  • contact‑form: A contact form or feedback form submission.
  • signup: A new user account.
  • message: A message sent between just a few users.

You may send a value not listed above if none of them accurately describe your content. This is further explained here.

comment_author
Name submitted with the comment.

comment_author_email
Email address submitted with the comment.

comment_author_url
URL submitted with comment. Only send a URL that was manually entered by the user, not an automatically generated URL like the user’s profile URL on your site.

comment_content
The content that was submitted.

comment_date_gmt
The UTC timestamp of the creation of the comment, in ISO 8601 format. May be omitted for comment‑check requests if the comment is sent to the API at the time it is created.

comment_post_modified_gmt
The UTC timestamp of the publication time for the post, page or thread on which the comment was posted.

blog_lang
Indicates the language(s) in use on the blog or site, in ISO 639‑1 format, comma‑separated. A site with articles in English and French might use “en, fr_ca”.

blog_charset
The character encoding for the form values included in comment_* parameters, such as “UTF-8” or “ISO-8859-1”.

user_role
The user role of the user who submitted the comment. This is an optional parameter. If you set it to “administrator”, Akismet will always return false.

is_test
This is an optional parameter. You can use it when submitting test queries to Akismet.

recheck_reason
If you are sending content to Akismet to be rechecked, such as a post that has been edited or old pending comments that you’d like to recheck, include the parameter recheck_reason with a string describing why the content is being rechecked. For example, recheck_reason=edit.

honeypot_field_name
If you use a honeypot field in your implementation, include the name of the field in your request as well as the value of that field. For example, if you have a honeypot field that looks like <input type="text" name="hidden_honeypot_field" style="display: none;" />, then you should include two extra parameters in your request: honeypot_field_name=hidden_honeypot_field and hidden_honeypot_field=[the value of the input].

comment_context
The comment_context parameter provides context for the environment in which the comment was posted: a list of tags or categories applied to the parent blog post or the site on which the comment was posted.

Specify comment_context using PHP-style array parameter notation: comment_context[]=cooking&comment_context[]=recipes&comment_context[]=bbq. Note that any tags or categories should be taken from the parent post or environment; they should not be supplied by the commenters themselves.

Other server environmental variables
In PHP, there is an array of environmental variables called $_SERVER that contains information about the Web server itself as well as a key/value for every HTTP header sent with the request. This data is highly useful to Akismet. How the submitted content interacts with the server can be very telling, so please include as much of it as possible.

PHP example

$data = array(
    'blog' => 'http://yourgroovydomain.com',
    'user_ip' => '127.0.0.1',
    'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6',
    'referrer' => 'http://www.google.com',
    'permalink' => 'http://yourgroovydomain.com/blog/post=1',
    'comment_type' => 'comment',
    'comment_author' => 'admin',
    'comment_author_email' => 'test@example.com',
    'comment_author_url' => 'http://spam.example.net',
    'comment_content' => 'It means a lot that you would take the time to review our software.Thanks again.'
);
 
akismet_submit_spam( '123YourAPIKey', $data );
 
function akismet_submit_spam( $api_key, $data ) {
    $request = 'api_key=' . urlencode( $api_key ) .
        '&blog=' . urlencode($data['blog']) .
        '&user_ip=' . urlencode($data['user_ip']) .
        '&user_agent=' . urlencode($data['user_agent']) .
        '&referrer=' . urlencode($data['referrer']) .
        '&permalink=' . urlencode($data['permalink']) .
        '&comment_type=' . urlencode($data['comment_type']) .
        '&comment_author=' . urlencode($data['comment_author']) .
        '&comment_author_email=' . urlencode($data['comment_author_email']) .
        '&comment_author_url=' . urlencode($data['comment_author_url']) .
        '&comment_content=' . urlencode($data['comment_content']);
 
    $host = $http_host = 'rest.akismet.com';
    $path = '/1.1/submit-spam';
    $port = 443;
    $akismet_ua = "WordPress/4.4.1 | Akismet/3.1.7";
    $content_length = strlen( $request );
    $http_request  = "POST $path HTTP/1.0\r\n";
    $http_request .= "Host: $host\r\n";
    $http_request .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $http_request .= "Content-Length: {$content_length}\r\n";
    $http_request .= "User-Agent: {$akismet_ua}\r\n";
    $http_request .= "\r\n";
    $http_request .= $request;
 
    $response = '';
 
    if ( false != ( $fs = @fsockopen( 'ssl://' . $http_host, $port, $errno, $errstr, 10 ) ) ) {
        fwrite( $fs, $http_request );
 
        while ( !feof( $fs ) ) {
            $response .= fgets( $fs, 1160 ); // One TCP-IP packet
        }

        fclose( $fs );
 
        $response = explode( "\r\n\r\n", $response, 2 );
    }
 
    if ( 'Thanks for making the web a better place.' == $response[1] ) {
        return true;
    } else {
        return false;
    }
}

This call returns a single response:

Array (
    [0] => HTTP/1.1 200 OK
           Server: nginx
           Date: Mon, 24 Feb 2014 20:41:15 GMT
           Content-Type: text/html; charset=utf-8
           Connection: close
           Content-length: 41
    [1] => Thanks for making the web a better place.
)

We’re here to help

If you ever get stuck or need help troubleshooting something, please don’t hesitate to contact us.