{
  "openapi": "3.1.0",
  "info": {
    "title": "Domain & Email Deliverability Inspector",
    "version": "1.0.0",
    "summary": "Verify 100-email batches and audit recursive SPF, DMARC, MX, DKIM & BIMI at the edge.",
    "description": "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).\n\nReplaces 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.",
    "contact": {
      "name": "API Keg",
      "url": "https://apikeg.com"
    }
  },
  "servers": [
    {
      "url": "https://domain-deliverability.apikeg.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Keg Key (ak_live_...)",
        "description": "Optional per-email monthly subscription API key ($5/$20/$50 tiers at https://apikeg.com/account). Omit this header to pay per request inline via HTTP 402 (x402 USDC)."
      }
    }
  },
  "security": [
    {},
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/verify-email-batch": {
      "post": {
        "operationId": "verify_email_batch",
        "summary": "Verify Email Deliverability Batch",
        "description": "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. Why call instead of DIY: 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). 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). Pass ?dry_run=true on REST to validate schema free.",
        "tags": [
          "marketing-ops",
          "crm-automation",
          "security-compliance",
          "developer-tools"
        ],
        "externalDocs": {
          "description": "Verify Email Deliverability Batch Specification & Examples",
          "url": "https://domain-deliverability.apikeg.com/tools/verify-email-batch"
        },
        "x-x402": {
          "version": 2,
          "scheme": "upto",
          "priceUsd": "0.001",
          "maxPriceUsd": "0.01",
          "amountAtomicUnits": "10000",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "extensions": {
            "bazaar": {
              "discoverable": true,
              "category": [
                "marketing-ops",
                "crm-automation",
                "security-compliance",
                "developer-tools"
              ],
              "info": {
                "input": {
                  "type": "http",
                  "method": "POST",
                  "bodyType": "json",
                  "example": {
                    "emails": [
                      "ada@acme.com",
                      "billing+q4@acme.com",
                      "temp@mailinator.com"
                    ],
                    "checkSpfDmarc": true,
                    "rejectDisposable": true,
                    "rejectRoleAccounts": false
                  }
                },
                "output": {
                  "type": "json",
                  "summary": "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."
                }
              },
              "schema": {
                "inputSchema": {
                  "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
                },
                "outputSchema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data",
                    "_meta"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "description": "Deterministic structured tool result payload."
                    },
                    "_meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "durationMs",
                        "chargedUsd",
                        "dryRun"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "durationMs": {
                          "type": "number"
                        },
                        "chargedUsd": {
                          "type": "string"
                        },
                        "dryRun": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "dry_run",
            "in": "query",
            "required": false,
            "description": "Validate request schema for free ($0.00) without executing or settling payment.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "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
              },
              "example": {
                "emails": [
                  "ada@acme.com",
                  "billing+q4@acme.com",
                  "temp@mailinator.com"
                ],
                "checkSpfDmarc": true,
                "rejectDisposable": true,
                "rejectRoleAccounts": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful execution result.",
            "headers": {
              "PAYMENT-RESPONSE": {
                "description": "Base64-encoded x402 v2 payment settlement receipt (when paid).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object"
                    },
                    "_meta": {
                      "type": "object",
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "durationMs": {
                          "type": "number"
                        },
                        "chargedUsd": {
                          "type": "string"
                        },
                        "dryRun": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Schema validation error (unbilled, $0.00)."
          },
          "402": {
            "description": "Payment Required. Decode the Base64 PAYMENT-REQUIRED header and retry with PAYMENT-SIGNATURE.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 PaymentRequired JSON object.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit-sender-domain": {
      "post": {
        "operationId": "audit_sender_domain",
        "summary": "Audit Sender Domain Authentication",
        "description": "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. Why call instead of DIY: 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. Pricing: $0.002 USD per sender domain authentication audit (x402 instant micropayment). Pass ?dry_run=true on REST to validate schema free.",
        "tags": [
          "marketing-ops",
          "crm-automation",
          "security-compliance",
          "developer-tools"
        ],
        "externalDocs": {
          "description": "Audit Sender Domain Authentication Specification & Examples",
          "url": "https://domain-deliverability.apikeg.com/tools/audit-sender-domain"
        },
        "x-x402": {
          "version": 2,
          "scheme": "exact",
          "priceUsd": "0.002",
          "amountAtomicUnits": "2000",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "extensions": {
            "bazaar": {
              "discoverable": true,
              "category": [
                "marketing-ops",
                "crm-automation",
                "security-compliance",
                "developer-tools"
              ],
              "info": {
                "input": {
                  "type": "http",
                  "method": "POST",
                  "bodyType": "json",
                  "example": {
                    "domain": "acme.com",
                    "dkimSelectors": [
                      "google",
                      "s1"
                    ],
                    "bimiSelector": "default"
                  }
                },
                "output": {
                  "type": "json",
                  "summary": "Returns 0-100 deliverability score, recursive SPF lookup tree, DMARC/DKIM/BIMI status, and copy-paste TXT fixes."
                }
              },
              "schema": {
                "inputSchema": {
                  "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
                },
                "outputSchema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data",
                    "_meta"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "description": "Deterministic structured tool result payload."
                    },
                    "_meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "durationMs",
                        "chargedUsd",
                        "dryRun"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "durationMs": {
                          "type": "number"
                        },
                        "chargedUsd": {
                          "type": "string"
                        },
                        "dryRun": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "dry_run",
            "in": "query",
            "required": false,
            "description": "Validate request schema for free ($0.00) without executing or settling payment.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "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
              },
              "example": {
                "domain": "acme.com",
                "dkimSelectors": [
                  "google",
                  "s1"
                ],
                "bimiSelector": "default"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful execution result.",
            "headers": {
              "PAYMENT-RESPONSE": {
                "description": "Base64-encoded x402 v2 payment settlement receipt (when paid).",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object"
                    },
                    "_meta": {
                      "type": "object",
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "durationMs": {
                          "type": "number"
                        },
                        "chargedUsd": {
                          "type": "string"
                        },
                        "dryRun": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Schema validation error (unbilled, $0.00)."
          },
          "402": {
            "description": "Payment Required. Decode the Base64 PAYMENT-REQUIRED header and retry with PAYMENT-SIGNATURE.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 PaymentRequired JSON object.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}