1. Domain email authentication audit (dmarc.analyse)
Inspect live SPF, DKIM, DMARC and BIMI records for a domain and receive copy-ready DNS fix records with TTLs.
POST https://previewfix.com/api/v1/engines/dmarc/analysecurl -sS -X POST "https://previewfix.com/api/v1/engines/dmarc/analyse" \
-H "Authorization: Bearer ak_live_0123456789abcdef0123456789abcdef01234567" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: dmarc-example-com-20261118" \
-d '{
"domain": "example.com"
}'const res = await fetch("https://previewfix.com/api/v1/engines/dmarc/analyse", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "dmarc-example-com-20261118",
},
body: JSON.stringify({ domain: "example.com" }),
});
const payload = await res.json();
if (!res.ok || !payload.ok) {
throw new Error(`${payload.error?.code ?? res.status}: ${payload.error?.message ?? "Request failed"}`);
}
console.log(payload.data.score, payload.data.fixes);<?php
declare(strict_types=1);
$ch = curl_init('https://previewfix.com/api/v1/engines/dmarc/analyse');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: dmarc-example-com-20261118',
],
CURLOPT_POSTFIELDS => json_encode(['domain' => 'example.com'], JSON_THROW_ON_ERROR),
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$envelope = json_decode((string) $raw, true, 512, JSON_THROW_ON_ERROR);
if ($status !== 200 || empty($envelope['ok'])) {
throw new RuntimeException($envelope['error']['code'] ?? 'transient_gateway_error');
}
print_r($envelope['data']['fixes']);{
"ok": true,
"data": {
"domain": "example.com",
"score": 48,
"verdict": "spoofable",
"summary": "DMARC policy is p=none (monitoring only); spoofing is not blocked.",
"spf": {
"status": "valid",
"records": ["v=spf1 include:_spf.example.com ~all"],
"lookupCount": 6,
"allQualifier": "~all",
"findings": []
},
"dkim": {
"probed": ["default", "selector1", "google", "k1"],
"validSelectors": ["selector1"],
"weakestBits": 2048,
"findings": []
},
"dmarc": {
"present": true,
"effectivePolicy": "none",
"grade": "C",
"strength": 45,
"records": ["v=DMARC1; p=none; rua=mailto:dmarc@example.com"],
"findings": []
},
"bimi": {
"present": false,
"ready": false,
"record": null,
"findings": []
},
"fixes": [
{
"host": "_dmarc",
"fqdn": "_dmarc.example.com",
"type": "TXT",
"value": "v=DMARC1; p=quarantine; pct=25; adkim=r; aspf=r; rua=mailto:dmarc@example.com;",
"valueSource": null,
"ttl": 3600,
"action": "replace",
"reason": "Move from monitoring (p=none) to staged quarantine.",
"optional": false
}
],
"rollout": [
{
"stage": 1,
"title": "Monitor aggregate reports before enforcing",
"policy": "p=quarantine; pct=25"
}
],
"scoreMeaning": "0 = hard to spoof, 100 = trivially spoofable",
"mode": "live"
},
"usage": {
"operation": "dmarc.analyse",
"units": 1,
"balance": 249,
"byok": false
}
}