# MTA-STS, TLS-RPT, BIMI API

Check a domain's MTA-STS policy, TLS reporting and BIMI logo, straight from DNS and the policy file.

`GET /v1/mail-policies`

- Price: Costs 1 credit per call; cached answers cost the same. Calls that fail upstream (502) are free.
- Cache: Answers are cached for up to 15 minutes; send fresh=true to ask the source again.
- MCP tool: `check_mail_policies`

MTA-STS policy and DNS record, TLS-RPT reporting addresses and BIMI logo and mark certificate facts for a domain's mail. Costs 1 credit per call; cached answers cost the same. Calls that fail upstream (502) are free. Answers are cached for up to 15 minutes; send fresh=true to ask the source again. A retry with the same `X-Request-Id` returns the stored result of the first call for 24 hours without charging again, marked with the `X-Replayed: true` header.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | yes | A domain, URL or email address; for an email address only the part after @ is used. |
| `fresh` | boolean | no | Skip the cache and ask the source again; costs the same. |

## Response

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `tool` | string | yes |  |
| `target` | string | yes |  |
| `status` | "ok" | "partial" | "error" | yes |  |
| `fetched_at` | string | no |  |
| `cached` | boolean | no |  |
| `credits_used` | integer | no | Credits this call took from your balance. 0 for free tools, for a replay of an earlier call, and for a free check run on the website without signing in |
| `summary` | string | yes |  |
| `score` | integer or null | no |  |
| `findings` | array of object | no |  |
| `credits_remaining` | integer | yes | Your balance after this call. It can be below zero after a refund; free tools still work then |
| `data` | object | yes | This tool's result |
| `data.name` | string | yes |  |
| `data.unicode` | string | yes |  |
| `data.nxdomain` | boolean | yes |  |
| `data.mx_hosts` | array of string | yes |  |
| `data.mta_sts` | object or null | no |  |
| `data.tls_rpt` | object or null | no |  |
| `data.bimi` | object or null | no |  |
| `data.min_ttl` | integer or null | no |  |

## Errors

- `400` Invalid domain, URL or parameter, a TLD this tool can't check, or an X-Request-Id already used for another call (`invalid_domain`, `invalid_url`, `invalid_request`, `unsupported_tld`)
- `401` Missing, unknown or revoked API key, or one whose creator is no longer a member of the account (`unauthorized`)
- `402` Balance below the call's price (`insufficient_credits`)
- `403` Account suspended, the key's creator is over the plan's seats, or an anonymous check without a valid proof-of-work or for a tool that needs an account, or bulk checks before a first purchase (`account_suspended`, `plan_limit`, `challenge_required`, `sign_in_required`, `bulk_locked`)
- `429` Too many requests, today's free checks are used up, or too many website scans at once; wait for the number of seconds in the Retry-After header (`rate_limited`, `free_limit_reached`, `too_many_jobs`). Not charged
- `500` Unexpected error (`internal_error`)
- `502` Every upstream source failed; not charged (`source_unavailable`). A Retry-After header says how long to wait when the source asked us to

## Example

```sh
curl "https://api.dnssuper.com/v1/mail-policies?domain=example.com" \
  -H "Authorization: Bearer $DNSSUPER_API_KEY"
```

```python
import os

import httpx

client = httpx.Client(
    base_url="https://api.dnssuper.com",
    headers={"Authorization": f"Bearer {os.environ['DNSSUPER_API_KEY']}"},
    timeout=60,
)
response = client.get("/v1/mail-policies", params={
    "domain": "example.com",
})
response.raise_for_status()
result = response.json()
print(result["summary"], result["credits_used"])
```

```ts
const response = await fetch(`https://api.dnssuper.com/v1/mail-policies?${new URLSearchParams({"domain":"example.com"})}`, {
  headers: { Authorization: `Bearer ${process.env.DNSSUPER_API_KEY}` },
});
if (!response.ok) throw new Error((await response.json()).error.message);
const result = await response.json();
console.log(result.summary, result.credits_used);
```

Example response:

```json
{
  "tool": "mta-sts-checker",
  "target": "example.com",
  "status": "ok",
  "fetched_at": "2026-11-14T10:00:00Z",
  "cached": false,
  "credits_used": 1,
  "summary": "MTA-STS is enforced for example.com and TLS reports are requested. BIMI is ready to show a logo.",
  "findings": [
    {
      "id": "mta_sts.enforced",
      "severity": "pass",
      "title": "MTA-STS is enforced",
      "detail": "",
      "fix": "Nothing to do; keep the policy's mx lines in step with your MX records."
    },
    {
      "id": "tls_rpt.valid",
      "severity": "pass",
      "title": "TLS reporting is set up",
      "detail": "",
      "fix": "Nothing to do; read the reports now and then."
    },
    {
      "id": "bimi.valid",
      "severity": "pass",
      "title": "BIMI is set up",
      "detail": "",
      "fix": "Nothing to do; keep the logo and certificate current."
    }
  ],
  "data": {
    "name": "example.com",
    "unicode": "example.com",
    "nxdomain": false,
    "mx_hosts": [
      "mx1.example.com",
      "mx2.example.net"
    ],
    "mta_sts": {
      "verdict": "enforced",
      "record": {
        "present": true,
        "records": [
          "v=STSv1; id=20261101000000"
        ],
        "id": "20261101000000",
        "errors": []
      },
      "policy": {
        "url": "https://mta-sts.example.com/.well-known/mta-sts.txt",
        "fetched": true,
        "status": 200,
        "content_type": "text/plain",
        "size_bytes": 90,
        "version": "STSv1",
        "mode": "enforce",
        "max_age": 604800,
        "mx_patterns": [
          "mx1.example.com",
          "mx2.example.net"
        ],
        "errors": []
      },
      "mx": [
        {
          "host": "mx1.example.com",
          "pattern": "mx1.example.com"
        },
        {
          "host": "mx2.example.net",
          "pattern": "mx2.example.net"
        }
      ],
      "null_mx": false,
      "mx_certificates": "not_checked"
    },
    "tls_rpt": {
      "verdict": "valid",
      "present": true,
      "records": [
        "v=TLSRPTv1; rua=mailto:tls-reports@example.com"
      ],
      "rua": [
        {
          "uri": "mailto:tls-reports@example.com",
          "scheme": "mailto",
          "valid": true
        }
      ]
    },
    "bimi": {
      "verdict": "ready",
      "present": true,
      "record": "v=BIMI1; l=https://bimi.example.com/logo.svg; a=https://bimi.example.com/vmc.pem",
      "logo": {
        "url": "https://bimi.example.com/logo.svg",
        "fetched": true,
        "status": 200,
        "content_type": "image/svg+xml",
        "size_bytes": 237,
        "square": true,
        "profile_ok": true,
        "title_present": true,
        "problems": [],
        "sha256": "14b0dd49f02a91c94261c4bf59e572be83eac371fc85cfe1177a0c633cf861e5"
      },
      "certificate": {
        "url": "https://bimi.example.com/vmc.pem",
        "fetched": true,
        "kind": "vmc",
        "subject_org": "Example Brand Ltd",
        "issuer_org": "DNS Super Test Mark CA",
        "not_before": "2026-10-15T10:00:00Z",
        "not_after": "2027-11-14T10:00:00Z",
        "days_left": 365,
        "domains": [
          "example.com"
        ],
        "covers_domain": true,
        "eku_ok": true,
        "mark_type": "Registered Mark"
      },
      "dmarc": {
        "policy": "reject",
        "pct": 100,
        "testing": false,
        "inherited": false,
        "enforced_for_all": true
      }
    },
    "min_ttl": 3600
  },
  "credits_remaining": 498
}
```

## MCP

```json
{
  "tool": "check_mail_policies",
  "arguments": {
    "domain": "example.com"
  }
}
```

```text
MTA-STS is enforced for example.com and TLS reports are requested. BIMI is ready to show a logo.
MTA-STS: enforced (max_age 604800; 2 of 2 MX hosts covered)
TLS-RPT: reports to mailto:tls-reports@example.com
BIMI: ready (logo SVG Tiny PS, square; VMC for Example Brand Ltd, 365 days left)
DMARC for BIMI: p=reject, enforced for all mail
3 checks passed
Credits: 1 credit used, 498 remaining | fresh | checked 2026-11-14 10:00 UTC
```
