API Documentation

Integrate CipherGrade into your workflow. The API is free, open, and requires no authentication.

Overview

Base URL
https://api.ciphergrade.app/api/v1

All responses are JSON. Requests that include a body must send Content-Type: application/json.

Rate limiting: Requests are rate-limited per IP address. If you exceed the limit you'll receive a 429 response.

POST

/api/v1/scan

Submit a domain for scanning. Returns immediately with a scan ID you can use to poll for results or subscribe to the SSE stream. If the domain was recently scanned, returns the cached result.

Request Body

FieldTypeDescription
hostnamestringDomain to scan (e.g., example.com). 1–253 characters, valid domain format.
portnumberPort to connect to. 1–65535, defaults to 443.
forcebooleanSet to true to bypass the cache and run a fresh scan.

Response

FieldTypeDescription
scanIdstringUUID of the scan. Use this to fetch results.
statusScanStatusCurrent scan status (e.g., "QUEUED", "COMPLETED").
cachedbooleantrue if the result was served from cache.

Status Codes

StatusMeaning
200Cached result returned
202New scan queued
400Validation error or blocked hostname (localhost, private IPs)
429Rate limited
500Server error

Example

curl -X POST https://api.ciphergrade.app/api/v1/scan \
  -H "Content-Type: application/json" \
  -d '{"hostname": "example.com"}'
{
  "scanId": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
  "status": "QUEUED",
  "cached": false
}
GET

/api/v1/scan/:id

Retrieve the full results of a completed scan including grade, score, per-category breakdowns, and actionable recommendations.

Path Parameters

FieldTypeDescription
idstring (UUID)The scan ID returned by POST /scan.

Response

FieldTypeDescription
scanIdstringScan UUID
hostnamestringScanned domain
portnumberPort scanned
ipAddressstringResolved IP address
gradeGradeLetter grade (e.g., "A+", "B", "F", "T", "M")
scorenumberNumeric score 0–100
subGradesSubGradesPer-category score, grade, findings, and weight
certificateobjectFull certificate chain details
protocolsobjectSupported TLS/SSL protocol versions
cipherSuitesobjectEnumerated cipher suites
keyExchangeobjectKey exchange parameters
vulnerabilitiesobjectVulnerability test results
bestPracticesobjectHSTS, security headers, OCSP stapling results
recommendationsRecommendation[]Actionable fixes sorted by priority
warningsstring[]General informational warnings
scanDurationMsnumberTotal scan time in milliseconds
scannedAtstringISO 8601 timestamp

Status Codes

StatusMeaning
200Scan results returned
404Scan not found
423Scan still in progress — try again or use the SSE stream
500Error during scan

Example

curl https://api.ciphergrade.app/api/v1/scan/a1b2c3d4-5678-90ab-cdef-1234567890ab
{
  "scanId": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
  "hostname": "example.com",
  "port": 443,
  "ipAddress": "93.184.216.34",
  "grade": "A",
  "score": 87,
  "subGrades": {
    "certificate": { "score": 100, "grade": "A+", "weight": 0.3, "findings": [...] },
    "protocol":    { "score": 100, "grade": "A+", "weight": 0.3, "findings": [...] },
    "keyExchange": { "score": 90,  "grade": "A",  "weight": 0.3, "findings": [...] },
    "cipherSuite": { "score": 80,  "grade": "A",  "weight": 0.1, "findings": [...] },
    "vulnerability":  { "score": 100, "grade": "A+", "weight": 0, "findings": [] },
    "bestPractices":  { "score": 70,  "grade": "B",  "weight": 0, "findings": [...] }
  },
  "recommendations": [...],
  "warnings": [],
  "scanDurationMs": 4230,
  "scannedAt": "2026-03-16T12:00:00.000Z"
}
GET

/api/v1/scan/:id/stream

Subscribe to real-time scan progress via Server-Sent Events (SSE). The connection stays open until the scan completes or times out. Each message is a JSON object with the current status and progress.

Message Format

FieldTypeDescription
statusScanStatusCurrent scan phase
progressnumberProgress from 0 to 1
messagestringHuman-readable progress message
scanIdstringThe scan ID

Scan Status Lifecycle

QUEUED→RESOLVING→CONNECTING→SCANNING_CERT→SCANNING_PROTO→SCANNING_CIPHER→SCANNING_KEYEX→SCANNING_HEADERS→SCANNING_DNS→SCANNING_VULN→GRADING→COMPLETED

Example (JavaScript)

const scanId = "a1b2c3d4-5678-90ab-cdef-1234567890ab";
const es = new EventSource(
  `https://api.ciphergrade.app/api/v1/scan/${scanId}/stream`
);

es.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(`[${data.status}] ${data.message} (${Math.round(data.progress * 100)}%)`);

  if (data.status === "COMPLETED" || data.status === "ERROR") {
    es.close();
  }
};
GET

/api/v1/scan

Retrieve paginated scan history. Optionally filter by hostname.

Query Parameters

FieldTypeDescription
pagenumberPage number (default: 1)
pageSizenumberResults per page (default: 20, max: 50)
hostnamestringFilter results by hostname

Response

FieldTypeDescription
scansScanHistoryEntry[]Array of scan summaries (scanId, hostname, port, grade, score, status, scannedAt, durationMs)
totalnumberTotal number of matching scans
pagenumberCurrent page
pageSizenumberPage size used

Example

curl "https://api.ciphergrade.app/api/v1/scan?hostname=example.com&page=1&pageSize=10"
{
  "scans": [
    {
      "scanId": "a1b2c3d4-...",
      "hostname": "example.com",
      "port": 443,
      "grade": "A",
      "score": 87,
      "status": "COMPLETED",
      "scannedAt": "2026-03-16T12:00:00.000Z",
      "durationMs": 4230
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 10
}
GET

/api/v1/health

Check the health of the CipherGrade service and its dependencies.

Response

FieldTypeDescription
status"ok" | "degraded" | "error"Overall service health
servicesobjectHealth of sub-services: database, redis, scanner (each boolean)

Status Codes

StatusMeaning
200All services healthy
503One or more services are down

Example

curl https://api.ciphergrade.app/api/v1/health
{
  "status": "ok",
  "services": {
    "database": true,
    "redis": true,
    "scanner": true
  }
}

Error Format

All error responses follow a consistent JSON shape:

{
  "error": "scan_not_found",
  "message": "No scan found with the given ID.",
  "statusCode": 404
}

Common Error Codes

ErrorHTTPDescription
validation_error400Request body failed validation
invalid_hostname400Hostname is not a valid domain or is blocked
scan_not_found404No scan exists with this ID
scan_in_progress423Scan is still running
rate_limited429Too many requests from this IP
internal_error500Unexpected server error

Data Types Reference

Grade

"A+" | "A" | "A-" | "B" | "C" | "D" | "E" | "F" | "M" | "T"

M = hostname mismatch, T = untrusted certificate

ScanStatus

"QUEUED" | "RESOLVING" | "CONNECTING" | "SCANNING_CERT" |
"SCANNING_PROTO" | "SCANNING_CIPHER" | "SCANNING_KEYEX" |
"SCANNING_HEADERS" | "SCANNING_DNS" | "SCANNING_VULN" |
"GRADING" | "COMPLETED" | "ERROR"

Recommendation

FieldTypeDescription
findingstringShort title of the issue
severity"critical" | "high" | "medium" | "low"Severity level
whatstringWhat the problem is
whystringWhy it matters
fixesRecord<string, string>Server-specific fix snippets (e.g., nginx, apache, haproxy)
prioritynumber1 (most urgent) to 8 (least urgent)
referencesstring[]CVE/RFC/documentation links

SubGrade (per category)

FieldTypeDescription
scorenumberCategory score 0–100
gradeGradeCategory letter grade
labelstringDisplay name
weightnumberWeight in final score (e.g., 0.3 = 30%)
findingsFinding[]Detailed findings for this category