# Security Headers Checker: Bulk Website Header Audit (`somepineapple/security-headers-audit`) Actor

Checks the security headers on a list of websites (HSTS, CSP, X-Frame-Options and the rest) plus cookie flags. Every site gets an A to F grade and a list of what's missing and how to fix it.

- **URL**: https://apify.com/somepineapple/security-headers-audit.md
- **Developed by:** [Ollie Wood](https://apify.com/somepineapple) (community)
- **Categories:** Developer tools, SEO tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.40 / 1,000 url auditeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Security Headers Checker: Bulk Website Header Audit

Security headers are one of the easiest wins on a website, and loads of sites still don't have them. This checks a whole list of sites in one go and grades each one A to F.

You get what's there, what's missing, anything set up badly (like a CSP that allows unsafe-inline), cookies without Secure or HttpOnly, and exactly what to add.

### What it does

- Grades HTTP security headers A-F per URL
- Lists missing headers with specific fixes
- Flags cookies without Secure/HttpOnly/SameSite
- Rejects private/internal addresses
- Reports failures per URL without stopping the run

### Use cases

- Checking all your client or company sites at once instead of one at a time.
- Finding quick security fixes to send over to a web team or host.
- Making sure a deploy didn't quietly drop your headers.
- Adding a security bit to SEO or web audits for prospects.
- Running it on a schedule to catch it if something changes.

### How to use

1. Add website URLs or domains to the list.
2. Hit Start. Each site takes a second or two.
3. Download the table or grab it through the Apify API.

You can also call it from the Apify API, run it on a schedule, or hook it up to Make, Zapier or n8n. AI agents can use it through Apify's MCP server.

### Input

```json
{
  "urls": [
    "https://example.com",
    "https://example.org"
  ]
}
```

### Output

You get one row per result, with these fields: `url`, `finalUrl`, `status`, `grade`, `score`, `present`, `missing`, `issues`, `recommendations`, `error`.

### Pricing

**$0.0024 per url audited.** You only pay for results that work. Anything that fails comes back with an `error` and is free. You can set a max spend per run in the run options.

So 100 URLs cost about $0.24, and 1,000 about $2.40.

### FAQ

**What does the grade mean?**

It's based on which of the important headers are there and whether they're set up properly. A means you're sorted, F means there's basically nothing.

**Does it hack or scan anything?**

No. It just reads the headers a site sends back on a normal visit, nothing more.

**Why do some sites say 'blocked'?**

Some sites block automated visits and send back an error page instead. That page doesn't have the real headers, so it isn't graded and you aren't charged.

**Can it check pages behind a login?**

No, only public pages. Private and internal addresses are refused.

### Limitations

- It checks the page you give it. Other pages on the same site can send different headers.
- A good grade is a good sign, not a full security review.

### Other tools you might like

- [Website Tech Stack Detector](https://apify.com/somepineapple/website-tech-detector-tool): what a website is built with: CMS, frameworks, analytics, hosting.
- [Sitemap URL Extractor & XML Sitemap Checker](https://apify.com/somepineapple/sitemap-extractor-checker-tool): pull every URL out of a site's sitemaps and check them for problems.
- [Package Health Checker](https://apify.com/somepineapple/package-health-checker): check npm and PyPI packages for vulnerabilities, licences and abandonment.

### Support

This Actor is built and maintained by an automated system run by its publisher. If something's wrong, open an
issue and it'll be looked at within 7 days. Please don't put passwords or personal details in an issue.

# Actor input Schema

## `urls` (type: `array`):

Website URLs to audit (max 500 per run).

## `followRedirects` (type: `boolean`):

Audit the final URL after redirects.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "followRedirects": 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 = {
    "urls": [
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("somepineapple/security-headers-audit").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 = { "urls": ["https://example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("somepineapple/security-headers-audit").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 '{
  "urls": [
    "https://example.com"
  ]
}' |
apify call somepineapple/security-headers-audit --silent --output-dataset

```

## MCP server setup

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

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/gBpoKGtEPRoSeLLTf/builds/LlzJC7BcsxSQTFED8/openapi.json
