# HTTP and security headers API

Grade a website's HTTPS redirects, HSTS, Content-Security-Policy, cookies and other security headers.

`GET /v1/http`

- Price: Costs 2 credits 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_http`

How a site answers on http and https with and without www, its redirects, security headers, HSTS, CSP and cookies, graded. Costs 2 credits 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 |
| --- | --- | --- | --- |
| `url` | string | yes | A domain or URL; only the site (scheme and host) 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.host` | string | yes |  |
| `data.alternate_host` | string or null | yes |  |
| `data.reachable` | boolean | yes |  |
| `data.no_website` | boolean | no |  |
| `data.entry_points` | array of object | yes |  |
| `data.entry_points.start_url` | string | yes |  |
| `data.entry_points.final_url` | string or null | yes |  |
| `data.entry_points.final_status` | integer or null | yes |  |
| `data.entry_points.hops` | array of object | yes |  |
| `data.entry_points.outcome` | "ok" | "loop" | "too_many" | "no_address" | "connect" | "refused" | "tls_failed" | "timeout" | "blocked" | "ipv6_only" | "error" | yes |  |
| `data.primary_url` | string or null | yes |  |
| `data.primary_status` | integer or null | yes |  |
| `data.http_version` | string or null | yes |  |
| `data.headers` | object | yes |  |
| `data.hsts` | object | yes |  |
| `data.hsts.present` | boolean | yes |  |
| `data.hsts.max_age` | integer or null | yes |  |
| `data.hsts.include_subdomains` | boolean | yes |  |
| `data.hsts.preload` | boolean | yes |  |
| `data.hsts.problems` | array of string | yes |  |
| `data.preload` | object | yes |  |
| `data.preload.eligible` | boolean | yes |  |
| `data.preload.applicable` | boolean | yes |  |
| `data.preload.missing` | array of string | yes |  |
| `data.csp` | array of object | yes |  |
| `data.csp.source` | "header" | "meta" | yes |  |
| `data.csp.report_only` | boolean | yes |  |
| `data.csp.directives` | object | yes |  |
| `data.csp.weaknesses` | array of string | yes |  |
| `data.csp.upgrade_insecure_requests` | boolean | yes |  |
| `data.framing` | "frame-ancestors" | "x-frame-options" | "none" | yes |  |
| `data.referrer_policy` | string or null | yes |  |
| `data.permissions_policy` | array of string | yes |  |
| `data.coop` | string or null | yes |  |
| `data.coep` | string or null | yes |  |
| `data.corp` | string or null | yes |  |
| `data.cookies` | array of object | yes |  |
| `data.cookies.name` | string | yes |  |
| `data.cookies.domain` | string or null | yes |  |
| `data.cookies.path` | string or null | yes |  |
| `data.cookies.secure` | boolean | yes |  |
| `data.cookies.http_only` | boolean | yes |  |
| `data.cookies.same_site` | string or null | yes |  |
| `data.cookies.session` | boolean | yes |  |
| `data.cookies.prefix_ok` | boolean | yes |  |
| `data.cookies.over_https` | boolean | yes |  |
| `data.disclosed` | array of object | yes |  |
| `data.disclosed.header` | string | yes |  |
| `data.disclosed.value` | string | yes |  |
| `data.disclosed.version` | string | yes |  |
| `data.http2` | boolean or null | yes |  |
| `data.http3_advertised` | boolean | yes |  |

## 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
- `503` Too many open event streams on this server, the checked site is getting too many checks, or the browser or link checker is busy; try again after the seconds in the Retry-After header (`busy`, `site_busy`, `browser_busy`, `crawl_busy`). Not charged

## Example

```sh
curl "https://api.dnssuper.com/v1/http?url=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/http", params={
    "url": "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/http?${new URLSearchParams({"url":"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": "security-headers",
  "target": "https://example.com/",
  "status": "ok",
  "fetched_at": "2026-11-14T10:00:00Z",
  "cached": false,
  "credits_used": 2,
  "summary": "Grade A (100/100) for example.com. HTTPS, redirects and the main security headers are in place.",
  "score": 100,
  "findings": [],
  "data": {
    "host": "example.com",
    "alternate_host": "www.example.com",
    "reachable": true,
    "no_website": false,
    "entry_points": [
      {
        "start_url": "http://example.com/",
        "final_url": "https://www.example.com/",
        "final_status": 200,
        "hops": [
          {
            "url": "http://example.com/",
            "status": 301,
            "location": "https://example.com/",
            "elapsed_ms": 12,
            "cookie_names": [],
            "kind": "http"
          },
          {
            "url": "https://example.com/",
            "status": 301,
            "location": "https://www.example.com/",
            "elapsed_ms": 12,
            "cookie_names": [],
            "kind": "http"
          },
          {
            "url": "https://www.example.com/",
            "status": 200,
            "elapsed_ms": 12,
            "cookie_names": [
              "__Host-session"
            ],
            "kind": "http"
          }
        ],
        "outcome": "ok"
      },
      {
        "start_url": "https://example.com/",
        "final_url": "https://www.example.com/",
        "final_status": 200,
        "hops": [
          {
            "url": "https://example.com/",
            "status": 301,
            "location": "https://www.example.com/",
            "elapsed_ms": 12,
            "cookie_names": [],
            "kind": "http"
          },
          {
            "url": "https://www.example.com/",
            "status": 200,
            "elapsed_ms": 12,
            "cookie_names": [
              "__Host-session"
            ],
            "kind": "http"
          }
        ],
        "outcome": "ok"
      },
      {
        "start_url": "http://www.example.com/",
        "final_url": "https://www.example.com/",
        "final_status": 200,
        "hops": [
          {
            "url": "http://www.example.com/",
            "status": 301,
            "location": "https://www.example.com/",
            "elapsed_ms": 12,
            "cookie_names": [],
            "kind": "http"
          },
          {
            "url": "https://www.example.com/",
            "status": 200,
            "elapsed_ms": 12,
            "cookie_names": [
              "__Host-session"
            ],
            "kind": "http"
          }
        ],
        "outcome": "ok"
      },
      {
        "start_url": "https://www.example.com/",
        "final_url": "https://www.example.com/",
        "final_status": 200,
        "hops": [
          {
            "url": "https://www.example.com/",
            "status": 200,
            "elapsed_ms": 12,
            "cookie_names": [
              "__Host-session"
            ],
            "kind": "http"
          }
        ],
        "outcome": "ok"
      }
    ],
    "primary_url": "https://www.example.com/",
    "primary_status": 200,
    "http_version": "HTTP/1.1",
    "headers": {
      "strict-transport-security": "max-age=63072000; includeSubDomains; preload",
      "content-security-policy": "default-src 'self'; script-src 'self' 'nonce-r4nd0m'; object-src 'none'; base-uri 'none'; frame-ancestors 'self'",
      "x-frame-options": "SAMEORIGIN",
      "x-content-type-options": "nosniff",
      "referrer-policy": "strict-origin-when-cross-origin",
      "permissions-policy": "camera=(), microphone=(), geolocation=()",
      "cross-origin-opener-policy": "same-origin",
      "server": "nginx",
      "alt-svc": "h3=\":443\"; ma=86400"
    },
    "hsts": {
      "present": true,
      "max_age": 63072000,
      "include_subdomains": true,
      "preload": true,
      "problems": []
    },
    "preload": {
      "eligible": true,
      "applicable": true,
      "missing": []
    },
    "csp": [
      {
        "source": "header",
        "report_only": false,
        "directives": {
          "default-src": [
            "'self'"
          ],
          "script-src": [
            "'self'",
            "'nonce-r4nd0m'"
          ],
          "object-src": [
            "'none'"
          ],
          "base-uri": [
            "'none'"
          ],
          "frame-ancestors": [
            "'self'"
          ]
        },
        "weaknesses": [],
        "upgrade_insecure_requests": false
      }
    ],
    "framing": "frame-ancestors",
    "referrer_policy": "strict-origin-when-cross-origin",
    "permissions_policy": [
      "camera",
      "microphone",
      "geolocation"
    ],
    "coop": "same-origin",
    "cookies": [
      {
        "name": "__Host-session",
        "path": "/",
        "secure": true,
        "http_only": true,
        "same_site": "lax",
        "session": true,
        "prefix_ok": true,
        "over_https": true
      }
    ],
    "disclosed": [],
    "http2": true,
    "http3_advertised": true
  },
  "credits_remaining": 498
}
```

## MCP

```json
{
  "tool": "check_http",
  "arguments": {
    "url": "example.com"
  }
}
```

```text
Grade A (100/100) for example.com. HTTPS, redirects and the main security headers are in place.
Score: 100/100
http://example.com/ -> 301 -> 301 -> https://www.example.com/ 200
https://example.com/ -> 301 -> https://www.example.com/ 200
http://www.example.com/ -> 301 -> https://www.example.com/ 200
https://www.example.com/ 200
Present: HSTS, CSP, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, framing protection; HTTP/2, HTTP/3 advertised
No issues found.
Credits: 2 credits used, 498 remaining | fresh | checked 2026-11-14 10:00 UTC
```
