---
title: "Generate an SPF record"
method: POST
path: "/email/spf/generate"
tags: ["email"]
---

# Generate an SPF record

`POST /email/spf/generate`

## Request

- Base URL: `https://intodns.ai/api`
- URL: `https://intodns.ai/api/email/spf/generate`
- Auth: none required

Build an SPF TXT record from direct mechanisms. Pure computation: no DNS is changed and no data is stored. The returned lookupCount covers direct mechanisms only; include and redirect targets can add nested lookups, so validate the published record with /email/spf before treating the count as final.

## Request body

- object
  - `mechanisms` object[]
    - `type` 'ip4' | 'ip6' | 'include' | 'a' | 'mx' | 'exists' | 'redirect', required
    - `value` string, required
  - `useA` boolean
  - `useMx` boolean
  - `policy` 'fail' | 'softfail' | 'neutral' | 'pass'

## Response `200`

Generated SPF record, direct lookup count, warnings, and DNS entry

- object

## Other responses

- `400`: Invalid generator input

---

[API](https://skmtc.dev/intodns/apis/intodns-ai-api.md) · [All operations](https://skmtc.dev/intodns/apis/intodns-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/intodns/apis/intodns-ai-api/revisions/c6c196b2fb4c?raw)
