🚀 Experience the new and improved APIVoid! Check out what's new

SPF Validator API: Check and validate SPF record

A JSON API to check if the SPF record is present and valid, test if an IP is authorized to send emails. Use this API to verify the SPF record configuration, check if SPF authentication fails for a specific IP.

Consumes 10 credits per API call

# Example Curl request from the command line:
                          
curl -X POST "https://api.apivoid.com/v2/spf-validator" \
     -H "Content-Type: application/json" \
     -H "X-API-Key: YOUR_API_KEY_HERE" \
     -d '{
           "host":"gmail.com",
           "iptest":"216.58.192.0"
         }'

# Example JSON output for a 200 HTTP status code:

{
    "host": "gmail.com",
    "has_spf_record": true,
    "dns_lookups_num": 4,
    "spf_record": "v=spf1 redirect=_spf.google.com",
    "spf_records_list": [
        {
            "record": "v=spf1 redirect=_spf.google.com",
            "origin": "gmail.com",
            "chars_num": 31,
            "use_macro": false,
            "domains": [
                "_spf.google.com"
            ]
        },
        {
            "record": "v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all",
            "origin": "_spf.google.com",
            "chars_num": 103,
            "use_macro": false,
            "domains": [
                "_netblocks.google.com",
                "_netblocks2.google.com",
                "_netblocks3.google.com"
            ]
        },
        {
            "record": "v=spf1 ip4:35.190.247.0/24 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all",
            "authorized_ips": {
                "ipv4": [
                    "35.190.247.0/24",
                    "64.233.160.0/19",
                    "66.102.0.0/20",
                    "66.249.80.0/20",
                    "72.14.192.0/18",
                    "74.125.0.0/16",
                    "108.177.8.0/21",
                    "173.194.0.0/16",
                    "209.85.128.0/17",
                    "216.58.192.0/19",
                    "216.239.32.0/19"
                ]
            },
            "origin": "_netblocks.google.com",
            "chars_num": 223,
            "use_macro": false
        },
        {
            "record": "v=spf1 ip6:2001:4860:4000::/36 ip6:2404:6800:4000::/36 ip6:2607:f8b0:4000::/36 ip6:2800:3f0:4000::/36 ip6:2a00:1450:4000::/36 ip6:2c0f:fb50:4000::/36 ~all",
            "authorized_ips": {
                "ipv6": [
                    "2001:4860:4000::/36",
                    "2404:6800:4000::/36",
                    "2607:f8b0:4000::/36",
                    "2800:3f0:4000::/36",
                    "2a00:1450:4000::/36",
                    "2c0f:fb50:4000::/36"
                ]
            },
            "origin": "_netblocks2.google.com",
            "chars_num": 154,
            "use_macro": false
        },
        {
            "record": "v=spf1 ip4:172.217.0.0/19 ip4:172.217.32.0/20 ip4:172.217.128.0/19 ip4:172.217.160.0/20 ip4:172.217.192.0/19 ip4:172.253.56.0/21 ip4:172.253.112.0/20 ip4:108.177.96.0/19 ip4:35.191.0.0/16 ip4:130.211.0.0/22 ~all",
            "authorized_ips": {
                "ipv4": [
                    "172.217.0.0/19",
                    "172.217.32.0/20",
                    "172.217.128.0/19",
                    "172.217.160.0/20",
                    "172.217.192.0/19",
                    "172.253.56.0/21",
                    "172.253.112.0/20",
                    "108.177.96.0/19",
                    "35.191.0.0/16",
                    "130.211.0.0/22"
                ]
            },
            "origin": "_netblocks3.google.com",
            "chars_num": 211,
            "use_macro": false
        }
    ],
    "domains_extracted": [
        "_spf.google.com",
        "_netblocks.google.com",
        "_netblocks2.google.com",
        "_netblocks3.google.com"
    ],
    "authorized_ips": {
        "ipv4": [
            "35.190.247.0/24",
            "64.233.160.0/19",
            "66.102.0.0/20",
            "66.249.80.0/20",
            "72.14.192.0/18",
            "74.125.0.0/16",
            "108.177.8.0/21",
            "173.194.0.0/16",
            "209.85.128.0/17",
            "216.58.192.0/19",
            "216.239.32.0/19",
            "172.217.0.0/19",
            "172.217.32.0/20",
            "172.217.128.0/19",
            "172.217.160.0/20",
            "172.217.192.0/19",
            "172.253.56.0/21",
            "172.253.112.0/20",
            "108.177.96.0/19",
            "35.191.0.0/16",
            "130.211.0.0/22"
        ],
        "ipv6": [
            "2001:4860:4000::/36",
            "2404:6800:4000::/36",
            "2607:f8b0:4000::/36",
            "2800:3f0:4000::/36",
            "2a00:1450:4000::/36",
            "2c0f:fb50:4000::/36"
        ]
    },
    "issues_found": {
        "total": 0
    },
    "spf_valid": true,
    "has_issues": false,
    "macros_found": false,
    "ip_pass": true,
    "elapsed_ms": 58
}
Code analysis

Key Features

Perform SPF record lookup and verification, test IP authorization

Businesses and startups use this SPF Validator API to lookup and test SPF record of domains, check if SPF is correctly configured or if there are warnings or errors that should be fixed.

Check SPF Configuration

This API performs an analysis of the SPF record and highlights any misconfiguration found.

Test IP Authorization

Easily check if a specific IPv4 or IPv6 address is allowed to send emails on behalf of the domain.

Detailed Report

The API returns accurate and complete information about a domain's SPF record.

Throubleshoot with Ease

Easily troubleshoot SPF records with our API, verify and fix email authentication issues.

Common Use Cases

Take a look at some real-world use cases of this API service

Our API can be used in many ways, from cybersecurity tasks to domain analysis/research tasks. Here we showcase the most popular use cases according to our customers usage:

Perform SPF Tests

Test the SPF record of your domains, verify that all is configured correctly, and fix any issue found.

Monitor Your Customers

With this API you can monitor the SPF record of your customers for misconfigurations and IP pass tests.

Better Risk Assessment

Whether you need to check a domain for SPF record or obtain valuable SPF details, our API covers it all.

Domain Analysis Tasks

Scan a list of domains to identify those with correctly configured SPF records for research purposes.

Use cases

USAGE EXAMPLE

Learn how seamless it is to add and use SPF Validator API anywhere you want

All it takes is a HTTPS POST request with JSON payload to our endpoint, and you’ll receive the response within seconds, usually within 1-5 seconds. Here are a few code examples to use the API:

$host = 'gmail.com';

$apiUrl = 'https://api.apivoid.com/v2/spf-validator';
$apiKey = 'your_api_key_here';

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'X-API-Key: ' . $apiKey]);
curl_setopt($ch, CURLOPT_POST, true);
// Include 'iptest' => '216.58.192.0' to check if the IP is authorized to send emails
// In this example we do not include it and we only check if SPF is valid
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['host' => $host]));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $responseData = json_decode($response, true);

    print_r($responseData);
}

Start using our API services, it takes just a few minutes

Create your account, pick a subscription plan, and make your first API call instantly with your API key—simple as that!

Get started now