# Security Headers Lookup — HSTS, CSP & Header Grade API (`accountable_eel/security-headers-lookup`) Actor

Check any website's security-relevant HTTP response headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and more) and get an A-F letter grade in one request. No key, no browser, just the live headers a browser would see.

- **URL**: https://apify.com/accountable\_eel/security-headers-lookup.md
- **Developed by:** [Adrian Voss](https://apify.com/accountable_eel) (community)
- **Categories:** Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 successful lookups

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Security Headers Lookup

Check any website's security-relevant HTTP response headers — HSTS, Content-Security-Policy,
X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and the two
Cross-Origin isolation headers — and get back a letter grade (A–F), the same manual check
tools like securityheaders.com run one URL at a time. No API key, no browser rendering —
this reads the raw response headers from a single HTTP request.

### Features

- **Full header sweep.** Checks all 8 major security headers in one request: HSTS, CSP,
  X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy,
  Cross-Origin-Opener-Policy, Cross-Origin-Resource-Policy.
- **Letter grade.** `score` / `maxScore` out of 8, converted to an A–F grade based on the
  percentage of headers present.
- **Cookie flags.** Reports whether `Set-Cookie` uses the `Secure` and `HttpOnly` flags.
- **Raw values included.** Every present header's actual value is returned, not just a
  pass/fail flag — useful for spotting a misconfigured-but-present CSP.
- **Pay only for resolved checks.** URLs that don't respond cost nothing — see [Pricing](#pricing).

### How to use Security Headers Lookup — HSTS, CSP & Header Grade API

1. **In the Apify Console.** Open the actor page and click **Start** — the `items` field is already pre-filled with a working example. Results land in the run's dataset as soon as each item is found.
2. **Via the API.** Call it directly with a POST request — no Console needed once you have an API token:
   ```bash
   curl "https://api.apify.com/v2/acts/accountable_eel~security-headers-lookup/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"items":["github.com"]}'
   ```
3. **On a schedule.** Save this actor as an Apify **Task** with the input you want, then add a **Schedule** (hourly, daily, weekly) so it runs on its own — no server of your own required.

### Input

```json
{
  "items": ["github.com", "cloudflare.com"],
  "maxConcurrency": 5,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

`items` is a list of domains or full URLs (a bare domain like `github.com` is normalized to
`https://github.com`). One dataset row is returned per item; rows with `"found": false`
are never charged. `maxConcurrency` (default 5) caps parallel requests — this target has no
browser fallback, so a conservative concurrency avoids getting blocked. `proxyConfiguration`
lets you route through Apify Proxy; residential proxies are recommended for anti-bot-sensitive
targets.

### Output

```json
{
  "query": "github.com",
  "found": true,
  "data": {
    "url": "https://github.com/",
    "statusCode": 200,
    "headers": {
      "hsts": "max-age=31536000; includeSubdomains",
      "contentSecurityPolicy": null,
      "xFrameOptions": "deny",
      "xContentTypeOptions": "nosniff",
      "referrerPolicy": "origin-when-cross-origin",
      "permissionsPolicy": null,
      "crossOriginOpenerPolicy": "same-origin",
      "crossOriginResourcePolicy": "same-origin"
    },
    "score": 5,
    "maxScore": 8,
    "grade": "C",
    "cookiesSetSecure": true,
    "cookiesSetHttpOnly": true
  },
  "scrapedAt": "2026-08-20T14:03:11.000Z"
}
```

A row is only marked `found: true` — and only then billed — once the URL returns an
actual HTTP response the actor can read headers from. A header that isn't set comes back
as `null` rather than being omitted, so you can tell "checked, absent" apart from "not
checked." A missing header only lowers the grade — it never causes a `found: false` row;
that only happens when the request itself fails (DNS error, timeout, connection refused).

### Use cases

- Audit your own production sites for missing security headers before a compliance review.
- Screen a list of vendor or partner domains for baseline header hygiene during due diligence.
- Track header grade over time across a fleet of sites after infrastructure or CDN changes.
- Feed a security dashboard or ticketing pipeline that flags any domain scoring below a
  given grade.
- Spot-check whether a WAF, CDN, or reverse proxy is stripping expected security headers.

### Pricing

$5 per 1,000 results, plus a $0.005 start fee. Misses (`found:false`) are never charged.

### Use it from Clay, n8n, Make, or an AI agent

This actor runs synchronously over plain HTTP — call it directly from a script, a workflow tool, or an AI agent, no Apify Console needed once you have an API token.

```bash
curl "https://api.apify.com/v2/acts/accountable_eel~security-headers-lookup/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"items":["github.com"]}'
```

**n8n.** Add an HTTP Request node: Method `POST`, URL `https://api.apify.com/v2/acts/accountable_eel~security-headers-lookup/run-sync-get-dataset-items?token=<YOUR_TOKEN>`, Body Content Type `JSON`, JSON Body `{"items":["github.com"]}` (swap in an expression from an earlier node for a real value).

**Clay.** Add an "HTTP API" column: Method `POST`, URL `https://api.apify.com/v2/acts/accountable_eel~security-headers-lookup/run-sync-get-dataset-items?token=<YOUR_TOKEN>`, Body `{"items":["{{value}}"]}`, mapping the row's value into the `items` array.

**MCP.** In Claude, Cursor, or any MCP client with the Apify MCP server, ask for "Security Headers Lookup | Apify" — the agent will find and run this actor.

### FAQ

**What counts as "found" vs "not found"?** Any URL that returns an HTTP response (even a
4xx or 5xx status) counts as found, because the headers are still readable and gradable.
Only requests that fail entirely — DNS resolution errors, timeouts, connection refused —
come back as `found: false`.

**Does a missing header fail the whole lookup?** No. Each of the 8 headers is checked
independently; missing ones just lower the score and grade. A site with zero security
headers still returns `found: true` with `grade: "F"`.

**Is CSP or Permissions-Policy content validated?** No — presence is scored, not policy
quality. A `Content-Security-Policy` header with a weak or misconfigured value still counts
as present. Parsing policy correctness is out of scope for a single-fetch actor.

**Does it follow redirects?** Yes, and `data.url` reflects the final URL after any
redirects, which may differ from the input if the target redirects (e.g. HTTP → HTTPS or
apex → www).

**Can I check localhost or internal domains?** No — this actor runs on Apify's
infrastructure and can only reach publicly routable URLs.

**Does it use a browser?** No, this is a plain HTTP request via Cheerio's crawler, not a
headless browser — headers set by client-side JavaScript after page load won't appear,
only headers present on the initial server response.

# Actor input Schema

## `items` (type: `array`):

One item per line — see the item shape and examples below. Only the items we actually find are charged — never per run, and never for a miss.

## `maxConcurrency` (type: `integer`):

Parallel requests. Keep conservative — this target has no browser fallback, so getting blocked costs more than slow-and-steady.

## `proxyConfiguration` (type: `object`):

Apify Proxy config. Residential recommended for anti-bot-sensitive targets.

## Actor input object example

```json
{
  "items": [
    "github.com"
  ],
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "items": [
        "github.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("accountable_eel/security-headers-lookup").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "items": ["github.com"] }

# Run the Actor and wait for it to finish
run = client.actor("accountable_eel/security-headers-lookup").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "items": [
    "github.com"
  ]
}' |
apify call accountable_eel/security-headers-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,accountable_eel/security-headers-lookup"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/jUF9868V4bF49ozXY/builds/WKqqxPbZldrETGgj9/openapi.json
