SPF Check
SPF tells receivers which hosts may send mail for a domain. This check fetches the domain's v=spf1 record, follows every include and redirect the way a receiver does, counts the DNS lookups against the limit of ten, collects the networks the whole tree authorises, and reports what a receiver would reject or ignore. Pass an address as ip_test to learn whether it is authorised to send.
/api/spf-checkCosts 2 creditsAPI keyValidate a domain's SPF record (2 credits)
What is checked
- One record. A domain must publish exactly one
v=spf1TXT record; two is a permerror for every receiver. - Syntax per RFC 7208: mechanisms, qualifiers, networks, CIDR lengths, and modifiers. Unknown mechanisms are an error, unknown modifiers only a note.
- The lookup budget. Every
include,redirect,a,mx,ptrandexistsin the whole tree costs one DNS lookup; receivers stop at ten.dns_lookups_numis the total,void_lookups_numthe ones that returned nothing (receivers tolerate two). - Policy.
+allauthorises the whole internet;?allgives no verdict; a record with neitherallnorredirectleaves unlisted hosts neutral;ptris deprecated. - Includes that point at a domain with no SPF record, or back into the chain, are errors.
Testing an address
With ip_test the record is evaluated for that address following RFC 7208's check_host: mechanisms in order, include recursively, a and mx resolved, redirect last.
| ip_result | ip_authorized | Meaning |
|---|---|---|
| pass | true | A mechanism matched with + (or no) qualifier |
| fail | false | Matched a - mechanism, typically -all |
| softfail | false | Matched a ~ mechanism; receivers mark, not reject |
| neutral | false | Matched ? or nothing matched and the record has no all |
| none | false | The domain publishes no SPF record |
| permerror | null | The record is invalid or over the lookup limit |
| temperror | null | A DNS lookup did not complete |
| unsupported | null | Evaluation reached a macro or ptr term, which this check does not expand |
Issue codes
| code | type | Means |
|---|---|---|
| SPF_NOT_FOUND | error | No v=spf1 record |
| MULTIPLE_SPF_RECORDS | error | More than one v=spf1 record at a domain in the tree |
| TOO_MANY_DNS_LOOKUPS | error | Over ten lookups across the tree |
| TOO_MANY_VOID_LOOKUPS | warning | More than two lookups returned nothing |
| PLUS_ALL_FOUND | error | +all (or a bare all) authorises every host |
| NEUTRAL_ALL_FOUND | warning | ?all gives unlisted hosts no verdict |
| RECORD_TERMINATION_MISSING | warning | No all mechanism and no redirect |
| PTR_DEPRECATED | warning | The ptr mechanism is deprecated |
| INCLUDE_WITHOUT_SPF_RECORD | error | An include or redirect target has no SPF record |
| INCLUDE_LOOP | error | A domain includes itself through the chain |
| DUPLICATE_INCLUDE | warning | The same include appears twice |
| UNSUPPORTED_MACRO | info | A term uses macros; the IP test stopped there |
| DNS_LOOKUP_FAILED | error | A lookup timed out or the resolver failed; the report is partial |
Further codes cover individual syntax faults (INVALID_IP4_NETWORK, INVALID_CIDR_LENGTH, UNKNOWN_MECHANISM, MULTIPLE_REDIRECT_MODIFIERS and the like). Every issue carries a message written for the person fixing the record.
Request
| Field | Type | Description |
|---|---|---|
| domain* | string | Sending domain whose SPF record to check (e.g. example.com) |
| ip_test | string | null | IPv4 or IPv6 address to evaluate against the record: is it authorised to send mail for the domain? |
Authenticate with API key. Send it as the X-API-Key header.
curl -X POST "https://api.senapati.io/api/spf-check" \
-H "X-API-Key: $SENAPATI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain":"google.com","ip_test":"209.85.220.41"}'Response
Every success is wrapped in { "data": … } with a request_id; the fields below describe data. See Errors for the failure shape.
{"request_id": "req_3b9e51c0","timestamp": "2026-10-21T09:30:12.418203+00:00","data": {"domain": "google.com","has_spf_record": true,"spf_record": "v=spf1 include:_spf.google.com ~all","spf_records_count": 1,"spf_records_list": [{"record": "v=spf1 include:_spf.google.com ~all","origin": "google.com","chars_num": 35,"use_macro": false,"domains": ["_spf.google.com"],"authorized_ips": {"ipv4": [],"ipv6": []}},{"record": "v=spf1 ip4:74.125.0.0/16 ip4:209.85.128.0/17 ip6:2001:4860:4864::/56 ip6:2404:6800:4864::/56 ip6:2607:f8b0:4864::/56 ip6:2800:3f0:4864::/56 ip6:2a00:1450:4864::/56 ip6:2c0f:fb50:4864::/56 ~all","origin": "_spf.google.com","chars_num": 192,"use_macro": false,"domains": [],"authorized_ips": {"ipv4": ["74.125.0.0/16","209.85.128.0/17"],"ipv6": ["2001:4860:4864::/56","2404:6800:4864::/56","2607:f8b0:4864::/56","2800:3f0:4864::/56","2a00:1450:4864::/56","2c0f:fb50:4864::/56"]}}],"domains_extracted": ["_spf.google.com"],"authorized_ips": {"ipv4": ["209.85.128.0/17","74.125.0.0/16"],"ipv6": ["2001:4860:4864::/56","2404:6800:4864::/56","2607:f8b0:4864::/56","2800:3f0:4864::/56","2a00:1450:4864::/56","2c0f:fb50:4864::/56"]},"dns_lookups_num": 1,"void_lookups_num": 0,"macros_found": false,"issues_found": [],"has_issues": false,"spf_valid": true,"lookup_failed": false,"ip_test": "209.85.220.41","ip_result": "pass","ip_authorized": true,"elapsed_ms": 326}}
spf_records_list holds every record in the tree with the domain it was fetched from; authorized_ips is the union of their ip4 and ip6 networks.
| Field | Type | Description |
|---|---|---|
| domain* | string | |
| has_spf_record* | boolean | True when a v=spf1 TXT record exists |
| spf_record* | string | null | The domain's own SPF record |
| spf_records_count* | integer | How many v=spf1 records the domain publishes; more than one is an error |
| spf_records_list* | SPFRecordDetail[] | Every record in the tree, the domain's own first |
| ↳ record* | string | The record text |
| ↳ origin* | string | Domain the record was fetched from |
| ↳ chars_num* | integer | Length of the record in characters |
| ↳ use_macro* | boolean | True when the record uses SPF macros |
| ↳ domains* | string[] | Domains this record references through include and redirect |
| ↳ authorized_ips* | AuthorizedIPs | ip4 and ip6 networks listed in this record |
| ↳ ipv4 | string[] | |
| ↳ ipv6 | string[] | |
| domains_extracted* | string[] | All domains reached through include and redirect, in order |
| authorized_ips* | AuthorizedIPs | All ip4 and ip6 networks across the tree, sorted |
| ↳ ipv4 | string[] | |
| ↳ ipv6 | string[] | |
| dns_lookups_num* | integer | Terms that cost a DNS lookup across the whole tree; receivers stop at 10 and return permerror |
| void_lookups_num* | integer | Lookups that returned nothing while expanding the tree and, with ip_test, while evaluating; receivers tolerate at most 2 |
| macros_found* | boolean | True when any record uses macros |
| issues_found* | AuthIssue[] | |
| ↳ code* | string | Stable machine-readable code, e.g. PLUS_ALL_FOUND |
| ↳ type* | "error" | "warning" | "info" | error: receivers reject or ignore the record; warning: it works but is weaker than it should be; info: a note, not a defect |
| ↳ message* | string | What was found and why it matters |
| has_issues* | boolean | |
| spf_valid* | boolean | A record exists and nothing in it makes receivers return permerror |
| lookup_failed* | boolean | True when a DNS query did not complete; the report is partial |
| ip_test* | string | null | The address evaluated, if one was given |
| ip_result* | "pass" | "fail" | "softfail" | "neutral" | "none" | "permerror" | "temperror" | "unsupported" | null | RFC 7208 result for ip_test; 'unsupported' when the record needs macro expansion or the ptr mechanism, which this check does not do |
| ip_authorized* | boolean | null | True on pass; false on fail, softfail, neutral or none; null when no ip_test was given or the record could not be evaluated |
| elapsed_ms | integer | default 0 |
Errors
- 401missing or invalid API key / token
- 402not enough credits on the account
- 422the request body or a parameter failed validation
- 429plan rate limit exceeded
Nested objects
| Field | Type | Description |
|---|---|---|
| record* | string | The record text |
| origin* | string | Domain the record was fetched from |
| chars_num* | integer | Length of the record in characters |
| use_macro* | boolean | True when the record uses SPF macros |
| domains* | string[] | Domains this record references through include and redirect |
| authorized_ips* | AuthorizedIPs | ip4 and ip6 networks listed in this record |
| ↳ ipv4 | string[] | |
| ↳ ipv6 | string[] |
| Field | Type | Description |
|---|---|---|
| code* | string | Stable machine-readable code, e.g. PLUS_ALL_FOUND |
| type* | "error" | "warning" | "info" | error: receivers reject or ignore the record; warning: it works but is weaker than it should be; info: a note, not a defect |
| message* | string | What was found and why it matters |
Notes
- A report with
lookup_failed: truerests on a DNS query that did not complete; retry it before acting on it. - Macros (
%{i}and friends) are detected and reported but not expanded, andptris not evaluated: the IP test answersunsupportedrather than guess. - Expansion stops after twenty lookups even for a record far over the limit, so a pathological chain cannot run away.