---
title: "Check the SPF record of a domain"
description: "The SPF record of any domain with every include followed and every DNS lookup counted."
url: "https://nextmail.sh/docs/api/tools/spf"
area: "API"
category: "Mailbox"
---

# Check the SPF record of a domain

The SPF record of any domain with every include followed and every DNS lookup counted.

`GET /tools/spf`

## GET /tools/spf

The SPF record of any domain with every include followed and every DNS lookup counted.

## Example

Needs no scope. It reads the SPF record, follows every `include` and `redirect` into `tree`, counts `lookups` against the limit of 10 and `voidLookups` against the limit of 2, and names the `senders` it recognises. `status` is `pass`, `warn`, `fail` or `missing`, and `findings` lists everything found, errors first, each with a stable `code`.

**curl**

```
curl "$API/tools/spf?domain=acme.com" -H "$AUTH"
```

**Response**

```
{
  "object": "spf_report",
  "domain": "acme.com",
  "status": "pass",
  "record": "v=spf1 include:_spf.google.com include:amazonses.com -all",
  "records": ["v=spf1 include:_spf.google.com include:amazonses.com -all"],
  "strings": ["v=spf1 include:_spf.google.com include:amazonses.com -all"],
  "length": 57,
  "lookups": 2,
  "lookupLimit": 10,
  "voidLookups": 0,
  "voidLimit": 2,
  "allQualifier": "-",
  "tree": { "domain": "acme.com", "via": null, "record": "v=spf1 include:_spf.google.com include:amazonses.com -all", "lookups": 2, "totalLookups": 2, "terms": […], "children": […], "error": null },
  "senders": [
    { "name": "Google Workspace", "include": "_spf.google.com" },
    { "name": "Amazon SES", "include": "amazonses.com" }
  ],
  "ipv4Addresses": 99328,
  "ipv6Ranges": 6,
  "findings": [
    { "code": "one-record", "severity": "pass", "message": "Exactly one SPF record is published.", "subject": null, "value": null },
    { "code": "lookups-within-limit", "severity": "pass", "message": "2 of 10 DNS lookups used.", "subject": null, "value": 2 }
  ]
}
```

> Each node of `tree` carries its own `lookups` and the `totalLookups` of everything below it, so the include that spends the most is easy to find.

> Every answer is what public DNS said at that moment. DNS that does not answer is a 503 `unreachable`, which is worth retrying, and a value that does not read as a domain is a 422 `invalid_parameter` on `domain`.

## Reference

- [`GET /tools/spf`](https://nextmail.sh/docs/api/reference/tools#get-tools-spf): full reference
