# Domain & Email Deliverability Inspector (v1.0.0)

> Verify 100-email batches and audit recursive SPF, DMARC, MX, DKIM & BIMI at the edge.

Edge-native batch email deliverability verification and recursive sender authentication auditing (MX, RFC 7208 10-lookup SPF tree, DMARC, DKIM selectors, BIMI, and 160+ disposable/role/free-webmail classifiers).

## Why Agents Use This API Instead of DIY
Replaces brittle DIY DNS scripts with RFC 7208 10-lookup recursive SPF tree evaluation, RFC 7505 Null MX detection, DMARC/DKIM/BIMI parsing, and deduplicated DoH batch checks for $0.001-$0.01.

## Connection & Payment (x402 Default + Optional Bearer API Key)
- **MCP Server (Streamable HTTP):** `https://domain-deliverability.apikeg.com/mcp` (Registry ID: `com.apikeg/domain-deliverability` — `initialize`, `tools/list`, `resources/*`, and `prompts/*` are free)
- **OpenAPI 3.1 Spec:** [openapi.json](https://domain-deliverability.apikeg.com/openapi.json)
- **Full Schema & Examples:** [llms-full.txt](https://domain-deliverability.apikeg.com/llms-full.txt)
- **RFC 9727 API Catalog:** [.well-known/api-catalog](https://domain-deliverability.apikeg.com/.well-known/api-catalog)
- **x402 Bazaar Manifest:** [.well-known/x402.json](https://domain-deliverability.apikeg.com/.well-known/x402.json)
- **MCP Discovery Manifest:** [.well-known/mcp.json](https://domain-deliverability.apikeg.com/.well-known/mcp.json)
- **A2A Agent Card:** [.well-known/agent-card.json](https://domain-deliverability.apikeg.com/.well-known/agent-card.json)
- **Primary Payment (Zero Signup):** Cloudflare Monetization Gateway (`HTTP 402` / `x402` v2 with USDC on Base).
- **Optional Monthly API Key:** Pass `Authorization: Bearer ak_live_...` ($5 / $20 / $50 monthly per-product Stripe plans at [apikeg.com/account](https://apikeg.com/account)).
- **Free Preflight:** Append `?dry_run=true` (or header `X-Dry-Run: true`) to validate any request payload at `$0.00` cost.

## Tools & REST Endpoints
- [`verify_email_batch`](https://domain-deliverability.apikeg.com/tools/verify-email-batch.md) (`POST https://domain-deliverability.apikeg.com/v1/verify-email-batch`) — $0.001 base (up to $0.01 max $0.001 base + $0.0005 per unique domain checked (up to 100 emails, capped at $0.01), x402 variable settlement): Validates a batch of 1 to 100 email addresses for RFC syntax, live MX/Null-MX mail acceptance, ESP provider fingerprint, SPF/DMARC domain posture, disposable/burner domains, role accounts, and free-webmail providers with per-domain DNS deduplication.
- [`audit_sender_domain`](https://domain-deliverability.apikeg.com/tools/audit-sender-domain.md) (`POST https://domain-deliverability.apikeg.com/v1/audit-sender-domain`) — $0.002 USD per sender domain authentication audit (x402 instant micropayment): Performs a deep sender deliverability audit for a domain: MX & ESP provider fingerprinting, recursive RFC 7208 SPF tree evaluation (10-lookup cap, 2-void-lookup cap, cycle & multi-record permerror detection), DMARC policy & alignment, BIMI logo/VMC, and optional DKIM selector key checks, returning a 0-100 score, prioritized issues, and copy-paste DNS remediation records.

## Instant MCP Configuration
```json
{
  "mcpServers": {
    "domain-deliverability": {
      "type": "streamable-http",
      "url": "https://domain-deliverability.apikeg.com/mcp"
    }
  }
}
```

## Common Agent Use Cases
- verify email deliverability batch API
- audit SPF 10 lookup limit permerror
- check DMARC DKIM BIMI MX records MCP
- detect disposable burner email domains
- RFC 7505 null MX email validator

---

## Detailed Tool Specifications

### `verify_email_batch` — Verify Email Deliverability Batch
- **REST Endpoint:** `POST https://domain-deliverability.apikeg.com/v1/verify-email-batch`
- **Tool Doc Page:** https://domain-deliverability.apikeg.com/tools/verify-email-batch
- **MCP Tool Name:** `verify_email_batch`
- **Pricing:** $0.001 base (up to $0.01 max $0.001 base + $0.0005 per unique domain checked (up to 100 emails, capped at $0.01), x402 variable settlement)
- **Side Effects:** readOnly=true, idempotent=true, destructive=false
- **Build vs. Buy ROI:** Deduplicates DoH MX/SPF/DMARC queries across shared domains in a 100-email batch in <50ms for $0.001 + $0.0005/unique domain (capped at $0.01).

#### Input JSON Schema
```json
{
  "type": "object",
  "properties": {
    "emails": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 320,
        "description": "Email address candidate to inspect."
      },
      "minItems": 1,
      "maxItems": 100,
      "description": "Batch of 1 to 100 email addresses to verify with per-domain DNS deduplication."
    },
    "checkSpfDmarc": {
      "type": "boolean",
      "default": true,
      "description": "Inspect SPF and DMARC posture on each unique domain in addition to MX."
    },
    "rejectDisposable": {
      "type": "boolean",
      "default": true,
      "description": "Mark disposable/burner inbox domains as undeliverable."
    },
    "rejectRoleAccounts": {
      "type": "boolean",
      "default": false,
      "description": "Mark role local-parts (e.g. admin@, billing@, support@) as non-deliverable."
    }
  },
  "required": [
    "emails"
  ],
  "additionalProperties": false
}
```

#### Examples
**Mixed B2B, role, and disposable batch** — Checks 3 emails across 2 unique domains, deduplicating acme.com DNS lookups.
```bash
curl -X POST "https://domain-deliverability.apikeg.com/v1/verify-email-batch" \
  -H "Content-Type: application/json" \
  -d '{"emails":["ada@acme.com","billing+q4@acme.com","temp@mailinator.com"],"checkSpfDmarc":true,"rejectDisposable":true,"rejectRoleAccounts":false}'
```
Expected result: Returns deliverable for ada@acme.com, risky (role_account) for billing+q4@acme.com, and undeliverable (disposable_domain) for temp@mailinator.com at $0.002 total.

### `audit_sender_domain` — Audit Sender Domain Authentication
- **REST Endpoint:** `POST https://domain-deliverability.apikeg.com/v1/audit-sender-domain`
- **Tool Doc Page:** https://domain-deliverability.apikeg.com/tools/audit-sender-domain
- **MCP Tool Name:** `audit_sender_domain`
- **Pricing:** $0.002 USD per sender domain authentication audit (x402 instant micropayment)
- **Side Effects:** readOnly=true, idempotent=true, destructive=false
- **Build vs. Buy ROI:** Recursively walks SPF include/redirect graphs with cycle detection and RFC 4408 multi-chunk TXT reassembly in one $0.002 call instead of writing fragile DNS parsers.

#### Input JSON Schema
```json
{
  "type": "object",
  "properties": {
    "domain": {
      "type": "string",
      "minLength": 3,
      "maxLength": 253,
      "pattern": "^[^@\\s/]+\\.[^@\\s/]+$",
      "description": "Sender domain name to audit (e.g. 'acme.com')."
    },
    "dkimSelectors": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 63,
        "pattern": "^[a-zA-Z0-9._-]+$",
        "description": "DKIM selector name (e.g. 'google', 'selector1', 's1', 'k1', 'default')."
      },
      "maxItems": 10,
      "description": "Optional DKIM selectors to probe at <selector>._domainkey.<domain>."
    },
    "bimiSelector": {
      "type": "string",
      "default": "default",
      "minLength": 1,
      "maxLength": 63,
      "pattern": "^[a-zA-Z0-9._-]+$",
      "description": "BIMI selector to inspect at <selector>._bimi.<domain>."
    }
  },
  "required": [
    "domain"
  ],
  "additionalProperties": false
}
```

#### Examples
**Full domain audit with DKIM selectors**
```bash
curl -X POST "https://domain-deliverability.apikeg.com/v1/audit-sender-domain" \
  -H "Content-Type: application/json" \
  -d '{"domain":"acme.com","dkimSelectors":["google","s1"],"bimiSelector":"default"}'
```
Expected result: Returns 0-100 deliverability score, recursive SPF lookup tree, DMARC/DKIM/BIMI status, and copy-paste TXT fixes.
