Security Headers Check API

Grade a website’s HTTP security from A+ to F: HTTPS redirect, HSTS (preload), Content-Security-Policy, framing, cookies, CORS, mixed content and version leaks.

GETPOSThttps://apibox.io.vn/v1/security-headers
Security & Crypto▶ Try it online

The security headers API fetches a URL and reviews the protections browsers apply from its response: an HTTPS redirect from http://, Strict-Transport-Security (max-age, includeSubDomains and whether the site is eligible for the HSTS preload list), Content-Security-Policy (flagging unsafe-inline without nonces, unsafe-eval and wildcard script sources), clickjacking protection with X-Frame-Options or frame-ancestors, X-Content-Type-Options, Referrer-Policy, Permissions-Policy and the cross-origin isolation headers.

It also checks the flags of the cookies the page sets (Secure, HttpOnly, SameSite), dangerous CORS combinations (* with credentials), resources loaded over http:// on an https page (mixed content) and headers that reveal software versions. Each finding is a check with a status and a message in English or Vietnamese (lang=vi); the score and grade (A+ when nothing is left to improve) summarise them.

The parsed HSTS and CSP directives, the cookies and all response headers are returned for your own rules. Results are cached for 10 minutes (fresh=true to re-check).

Parameters

NameInTypeRequiredDefault
urlbody|querystringyesPage URL.
langbody|querystringnoenLanguage of the messages: en or vi.
freshbody|querybooleannofalseBypass the 10-minute cache.

Example

curl "https://apibox.io.vn/v1/security-headers?url=https://github.com/" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "url": "https://github.com/",
  "final_url": "https://github.com/",
  "status": 200,
  "score": 100,
  "grade": "A+",
  "summary": {
    "passed": 8,
    "info": 1,
    "warnings": 0,
    "errors": 0
  },
  "hsts": {
    "max_age": 31536000,
    "include_subdomains": true,
    "preload": true,
    "preload_eligible": true
  },
  "csp": {
    "default-src": "'none'",
    "frame-ancestors": "'none'",
    "…": "…"
  },
  "checks": [
    {
      "id": "http_redirect",
      "status": "pass",
      "message": "http:// redirects to https://"
    },
    {
      "id": "hsts",
      "status": "pass",
      "message": "HSTS max-age 365 days, includeSubDomains, preload",
      "value": "max-age=31536000; includeSubdomains; preload"
    },
    {
      "id": "csp",
      "status": "pass",
      "message": "Content-Security-Policy restricts scripts",
      "value": "…"
    },
    "…"
  ]
}

Use cases

  • Security checklists before launching a website
  • Monitor client sites in agencies and MSPs
  • Security scoring in website builders and hosting panels
  • Teach web security with concrete feedback

FAQ

What does A+ mean?

A score of 90 or more with no warning or failure left: HTTPS with redirect, a long HSTS, a script-restricting CSP, framing protection, nosniff and a Referrer-Policy.

Is unsafe-inline always bad?

For scripts it disables most of the XSS protection of CSP, unless nonces or hashes are used (then browsers ignore it). For styles the risk is lower and it is not penalised.

Does it scan for vulnerabilities?

No. It only reads one response like a browser does; it does not probe the site.

Related APIs

Start with 1,000 free requests every month. Get free API key →