Secure Site Health Report API
A read-only REST API that exposes a WordPress site’s Site Health diagnostics as JSON, authenticated with a revocable API key. Built for third-party applications (audit tools, monitoring dashboards, AI agents) to pull site data on demand — no WordPress login involved.
Overview
This API is provided by the Secure Site Health Report WordPress plugin, installed on the site you want to inspect. Once installed and a key is generated, your application calls two endpoints:
| Endpoint | Purpose |
|---|---|
GET /wp-json/sshr/v1/ping | Verify a key works, get basic site info |
GET /wp-json/sshr/v1/report | Get the full Site Health report as JSON |
1. Generate an API key
This step is done once by whoever administers the WordPress site — not by your application.
- In WordPress admin, go to Tools → Health Report API.
- Enter a label (e.g. the name of your application) and click Generate key.
- The raw key is shown once. Copy it immediately — it cannot be retrieved again afterwards, only revoked and replaced.
2. Make your first request
Confirm the key works with the lightweight /ping endpoint before pulling the full report:
curl https://example-site.com/wp-json/sshr/v1/ping \
-H "Authorization: Bearer <YOUR_API_KEY>"A working key returns 200 OK with basic site info (see /ping reference). From there, call /report the same way to get the full payload.
Authentication
Every request must include the API key as a Bearer token in the Authorization header:
Authorization: Bearer <YOUR_API_KEY>| Rule | Detail |
|---|---|
| Header only | The key must be sent in the Authorization header. It is never accepted as a query parameter — this keeps it out of server access logs and browser history. |
| Transport | Requests must be made over HTTPS. Sending a key over plain HTTP exposes it in transit. |
| Lifetime | Keys do not expire automatically. They remain valid until manually revoked in wp-admin. |
| Scope | A key grants read-only access to the report data. It cannot modify anything on the site. |
GET /ping
Verifies the API key and returns minimal site info. Use this to test a connection without pulling the full report.
Request
curl https://example-site.com/wp-json/sshr/v1/ping \
-H "Authorization: Bearer <YOUR_API_KEY>"Response 200 OK
{
"status": "ok",
"site": "Example Site",
"site_url": "https://example-site.com",
"wp_version": "6.8.5",
"server_time": "2026-07-04T09:12:03+00:00"
}GET /report
Returns the full Site Health report — the same diagnostic data shown in WordPress’s own Tools → Site Health → Info screen, structured as JSON.
Request
curl https://example-site.com/wp-json/sshr/v1/report \
-H "Authorization: Bearer <YOUR_API_KEY>"Response 200 OK
{
"generated_at": "2026-07-04T09:12:03+00:00",
"site_url": "https://example-site.com",
"info": {
"wp-core": {
"label": "WordPress",
"fields": {
"version": { "label": "Version", "value": "6.8.5" },
"https_status": { "label": "HTTPS status", "value": "true" }
// ...additional fields per section
}
},
"wp-plugins-active": { "label": "Active plugins", "fields": { /* ... */ } },
"wp-server": { "label": "Server", "fields": { /* ... */ } }
// ...additional sections: themes, database, media, filesystem, etc.
},
"sizes": {
"wordpress_size": { "label": "WordPress directory size", "size": "180 MB" },
"uploads_size": { "label": "Uploads directory size", "size": "1.2 GB" }
// ...
}
}Response shape
| Field | Type | Description |
|---|---|---|
generated_at | string (ISO 8601) | Timestamp the report was generated, in UTC |
site_url | string | The site’s home URL |
info | object | Sections keyed by WordPress core’s internal debug-data IDs (e.g. wp-core, wp-plugins-active, wp-server, wp-database). Each section has a label and a fields object of key/value diagnostic entries. |
sizes | object | Directory/database size breakdown (WordPress core, uploads, plugins, themes, database, total) |
info mirrors whatever WordPress core’s WP_Debug_Data class reports, which can vary slightly by WordPress version and installed plugins. Don’t hard-code an exact list of sections/fields — iterate over whatever keys are present.Errors
Errors are returned as JSON with a non-2xx HTTP status:
{
"code": "sshr_invalid_key",
"message": "Invalid or revoked API key.",
"data": { "status": 401 }
}| Status | Code | Meaning |
|---|---|---|
| 401 | sshr_missing_key | No Authorization: Bearer header was sent |
| 401 | sshr_invalid_key | The key doesn’t match any active key, or has been revoked |
| 429 | sshr_locked_out | Too many failed attempts from this IP recently — see rate limits |
Rate limits
There’s no cap on requests made with a valid key. Limits only apply to repeated invalid attempts, to deter guessing:
| Rule | Value |
|---|---|
| Failed attempts allowed | 5, within a 10-minute window |
| Lockout duration | 15 minutes, per source IP |
While locked out, every request from that IP — even with a valid key — returns 429 until the lockout window passes. Design your integration to fail gracefully (back off and retry later) rather than retrying immediately on a 429.
Code examples
cURL
curl https://example-site.com/wp-json/sshr/v1/report \
-H "Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx"JavaScript (fetch)
async function getSiteHealthReport(siteUrl, apiKey) {
const response = await fetch(`${siteUrl}/wp-json/sshr/v1/report`, {
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
if (!response.ok) {
const error = await response.json();
throw new Error(`${error.code}: ${error.message}`);
}
return response.json();
}Python (requests)
import requests
def get_site_health_report(site_url, api_key):
response = requests.get(
f"{site_url}/wp-json/sshr/v1/report",
headers={"Authorization": f"Bearer {api_key}"},
timeout=15,
)
response.raise_for_status()
return response.json()PHP
$response = wp_remote_get( "{$site_url}/wp-json/sshr/v1/report", array(
'headers' => array(
'Authorization' => "Bearer {$api_key}",
),
) );
$report = json_decode( wp_remote_retrieve_body( $response ), true );Notes for AI agents
If you’re an AI agent implementing this integration on someone’s behalf, the practical checklist is:
- Confirm the human has already generated a key in wp-admin (Tools → Health Report API) — you cannot generate one yourself via the API. There is no endpoint for key creation; it’s an intentionally human, in-admin step.
- Never ask the user to paste the key into chat, a shared doc, or anywhere outside your application’s own credential storage.
- Call
/pingfirst to validate the key before wiring up anything that depends on/report. - Treat a 401 as “check the key,” and a 429 as “back off and retry later” — not as reasons to retry immediately in a loop, which would extend the lockout for the site’s IP-based limiter.
- Do not attempt to brute-force, enumerate, or guess a key. Keys are 256-bit random values — this is by design infeasible, and repeated attempts will trigger the lockout described above.
- Parse
infoandsizesdefensively (iterate over keys present, don’t assume a fixed schema) — see the callout in the /report reference.
Security practices
- Store the key like a password. Environment variable or secrets manager — never in source control, client-side JavaScript, or logs.
- Use one key per integration. Makes it possible to revoke access for a single application without affecting others.
- Revoke unused keys. Remove keys in wp-admin for integrations you’re no longer running.
- Always use HTTPS. The API does not protect the key if it’s sent over plain HTTP.
- Treat the report data as sensitive. It includes server paths, software versions, and configuration details — useful for legitimate diagnostics, but also useful to an attacker. Don’t log or display it somewhere less protected than the key itself.
FAQ
Can a key be restricted to a specific IP address?
Not in the current version. This is planned as an optional, per-key setting for a future release.
Does the key expire?
No — keys are valid until manually revoked in wp-admin. There is currently no auto-expiry option.
Can I create or revoke keys through the API?
No. Key management is intentionally an in-admin, human action only. There is no endpoint for creating, listing, or revoking keys.
What happens if a key is revoked while my app is using it?
The next request with that key returns 401 sshr_invalid_key immediately. There’s no grace period.
Is there a sandbox or test mode?
No — every key reads live data from the real site it was generated on. There’s no separate test environment.