Start a project

Site Audit · Developers

Site Audit API and white label

Run full website audits from your own code, get signed webhooks when they finish, and put your own brand and domain on the reports.

Quick start

Base URL: https://leej.uk/audit/api/v1. JSON in, JSON out. Create an API key in the dashboard (Pro and Agency plans), then:

curl -s -X POST https://leej.uk/audit/api/v1/sites \
  -H "Authorization: Bearer $LEEJ_AUDIT_KEY" -H "content-type: application/json" \
  -d '{"url":"https://example.com","schedule":"weekly"}'

curl -s -X POST https://leej.uk/audit/api/v1/sites/site_xxxxxxxx/audits -H "Authorization: Bearer $LEEJ_AUDIT_KEY"

curl -s https://leej.uk/audit/api/v1/audits/au_xxxxxxxx -H "Authorization: Bearer $LEEJ_AUDIT_KEY"
curl -s "https://leej.uk/audit/api/v1/audits/au_xxxxxxxx/report?format=csv" -H "Authorization: Bearer $LEEJ_AUDIT_KEY" -o issues.csv

An audit moves through the stages discover, crawl, site, resources and finalise, then its status becomes done (or failed with an error). Poll /audits/{id} every 15 to 30 seconds, or use a webhook.

Authentication

Send Authorization: Bearer <token>. API keys start lak_; they are shown once, stored only as a hash, and can be revoked in the dashboard. Dashboard sessions start lst_, last 30 days and come from the emailed one-time code (POST /auth/start then POST /auth/verify; codes expire after 10 minutes and allow 5 tries). API keys can't create keys or change billing.

Endpoints

MethodPathWhat it doesAuth
GET/API name, version and docs link.none
GET/plansPlans, limits and whether billing is open.none
GET/checksEvery check: id, group, severity, scope, fix and the tools that check it.none
POST/auth/startEmail a one-time sign-in code: {"email"}.none
POST/auth/verifySwap {"email","code"} for a session token.none
GET/meAccount, plan, usage and branding.key or dashboard
GET/usageThis month's audits, sites, clients, webhooks and today's API calls.key or dashboard
GET/sitesSites with their latest audit. ?archived=1 includes archived ones.key or dashboard
POST/sitesAdd a site: {"url", "label"?, "client_id"?, "schedule"?, "max_pages"?, "notify"?}.key or dashboard
GET/sites/{id}One site, with its verification options.key or dashboard
PATCH/sites/{id}Change label, schedule (off, daily, weekly, monthly), max_pages, notify or client_id; {"archived":false} restores.key or dashboard
DELETE/sites/{id}Archive (history is kept).key or dashboard
POST/sites/{id}/verifyCheck the DNS TXT record, file or meta tag.key or dashboard
POST/sites/{id}/auditsStart an audit. 202 with the audit; 409 if one is already running; 429 over the monthly limit.key or dashboard
GET/sites/{id}/auditsAudit history for a site.key or dashboard
GET/auditsLatest 100 audits across the account.key or dashboard
GET/audits/{id}Status, stage, pages done, score, counts, group scores, diff and report links.key or dashboard
GET/audits/{id}/reportThe full report. ?format=json (default), html, csv (&type=pages for the page list) or pdf.key or dashboard
GET/audits/{id}/diff?against={id}Compare with any earlier audit of the same site.key or dashboard
GET / POST/clientsList or add client accounts (Agency).key or dashboard
GET / PATCH / DELETE/clients/{id}Read, update or archive a client.key or dashboard
GET / POST/webhooksList or add webhooks; the signing secret is shown once.key or dashboard
POST/webhooks/{id}/testSend a test audit.completed event.key or dashboard
GET/webhooks/{id}/deliveriesLast 50 deliveries with status codes.key or dashboard
DELETE/webhooks/{id}Disable a webhook.key or dashboard
GET / PUT/brandingWhite-label name, logo_url, primary, footer, website, hide_leej (Agency).key or dashboard
PUT/branding/domainSet a report domain: {"domain":"reports.example.com"}.key or dashboard
POST/branding/domain/checkCheck its CNAME.key or dashboard
GET / POST / DELETE/keys, /keys/{id}API keys (dashboard sign-in only).dashboard
POST/billing/checkout, /billing/portalStripe Checkout and the billing portal (dashboard sign-in only).dashboard

Reports

The JSON report holds scores (overall, grade and one entry per group), counts (P0, P1, P2), checks (all 150, each with status pass, fail, not_measured or na, affected, applicable, score and up to 50 evidence items of {url, detail}), pages (status, depth, title, words, response time, size, inlinks), performance (PageSpeed lab and field data when available), site_info (detected stack, DNS), notMeasured and diff against the previous audit (newIssues, fixed, worse, better, regressed).

Every finished audit also has a private share link that works without signing in: /audit/r/<audit>.<token>, with .json, .csv and .pdf versions. Links are unguessable, not indexed, and expire with the report after 400 days.

The check list is public at /checks, so you can map check ids to your own wording.

Webhooks

Events: audit.started, audit.completed, audit.failed, audit.regressed. audit.regressed fires as well as audit.completed when a new P0 or P1 issue appears, a P0 gets worse, or the score drops 5 points or more. Deliveries are POSTs to your https URL, retried with backoff for up to six attempts; any 2xx counts as delivered.

POST /your/hook
content-type: application/json
leej-audit-event: audit.completed
leej-audit-delivery: evt_...
leej-audit-signature: t=1795635742,v1=5f2b...

{"id":"evt_...","type":"audit.completed","created":1795635742,"data":{"audit":{"id":"au_...","site_id":"site_...","origin":"https://example.com/","score":87,"grade":"B","counts":{"P0":0,"P1":2,"P2":5},"report":{"html":"...","json":"...","csv":"...","pdf":"..."}}}}

Check the signature before trusting the body: HMAC-SHA256 of t + "." + rawBody with your webhook secret, compared with v1, and reject timestamps more than five minutes old.

import crypto from "node:crypto";
export function verify(secret, header, rawBody) {
  const p = Object.fromEntries(header.split(",").map((x) => x.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(p.t)) > 300) return false;
  const mac = crypto.createHmac("sha256", secret).update(`${p.t}.${rawBody}`).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(p.v1 || ""));
}

White label

On the Agency plan, PUT /branding with {"name","logo_url","primary","footer","website","hide_leej":true} rebrands the HTML and PDF reports and the audit emails. hide_leej removes the leej.uk name, links and tool suggestions from reports.

Report links on your own domain

  1. PUT /branding/domain with {"domain":"reports.youragency.com"} (a subdomain, not the bare domain).
  2. At your DNS host add CNAME reports.youragency.com → reports.leej.uk. On Cloudflare, leave it DNS only (grey cloud).
  3. POST /branding/domain/check. When the CNAME resolves the status becomes dns_ok_awaiting_activation; the certificate is then issued for your hostname and the status turns active. From then on report links use your domain, and only report links are served there.

Clients

POST /clients with {"name","contact_email","notes"}, then pass client_id when adding sites. Each client's sites, audits and usage stay grouped, and archiving a client keeps its history.

Limits and errors

Plan£/monthSitesPages per auditAudits a monthAPI calls a dayWebhooksClients
Free£01504–––
Starter£19330030–––
Pro£49101,0001201,0003–
Agency (white label)£149502,50050010,0001050

Unverified sites are audited up to 25 pages. One audit runs per site at a time. API-key calls count towards the daily limit, which resets at midnight UTC.

Errors are JSON: {"error":{"code":"site_limit","message":"..."}} with a matching status: 400 bad input, 401 not signed in, 403 not on your plan, 404 not found, 409 already running or not ready, 429 over a limit, 5xx our side (safe to retry).

Site Audit and plans · The LeejAudit crawler · Dashboard · Developer tools