Key verification

Key verification authenticates your key before calling the comment-check, submit-spam, or submit-ham methods for the first time. This is the first call that you should make to Akismet and is especially useful if you will have multiple users with their own Akismet subscriptions using your application.

Note that you do not need to call this method before every call to comment-check, submit-spam, or submit-ham; you should only make this request to confirm that an API key is valid before storing it locally.

This method is called via a POST request to the following URL:

https://rest.akismet.com/1.1/verify-key

Required POST parameters

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

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

curl example

curl https://rest.akismet.com/1.1/verify-key \
  --data-urlencode api_key=YOUR_API_KEY \
  --data-urlencode blog=https://example.com

PHP SDK example

For non-WordPress PHP applications (PHP 8.1 or higher), you can use the official Akismet PHP SDK. Install it with composer require automattic/akismet-sdk.

use Automattic\Akismet\Akismet;
use Automattic\Akismet\Exception\InvalidApiKeyException;

$akismet = Akismet::create(
    apiKey: 'your-api-key',
    site: 'https://example.com'
);

try {
    $akismet->verifyKey();
    // The key is valid, so you can store it for future calls.
} catch (InvalidApiKeyException $e) {
    // The key is invalid or has been revoked.
}

Responses

The call returns valid if the key is valid:

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8

valid

If the call returns invalid, it usually includes an extra HTTP header with some debug information about what exactly was invalid about the call:

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
X-akismet-debug-help: We were unable to parse your blog URI

invalid

We’re here to help

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