API Documentation
Integrate CipherGrade into your workflow. The API is free, open, and requires no authentication.
Overview
https://api.ciphergrade.app/api/v1All 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.
/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
| Field | Type | Description |
|---|---|---|
| hostname | string | Domain to scan (e.g., example.com). 1–253 characters, valid domain format. |
| port | number | Port to connect to. 1–65535, defaults to 443. |
| force | boolean | Set to true to bypass the cache and run a fresh scan. |
Response
| Field | Type | Description |
|---|---|---|
| scanId | string | UUID of the scan. Use this to fetch results. |
| status | ScanStatus | Current scan status (e.g., "QUEUED", "COMPLETED"). |
| cached | boolean | true if the result was served from cache. |
Status Codes
| Status | Meaning |
|---|---|
| 200 | Cached result returned |
| 202 | New scan queued |
| 400 | Validation error or blocked hostname (localhost, private IPs) |
| 429 | Rate limited |
| 500 | Server 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
}/api/v1/scan/:id
Retrieve the full results of a completed scan including grade, score, per-category breakdowns, and actionable recommendations.
Path Parameters
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | The scan ID returned by POST /scan. |
Response
| Field | Type | Description |
|---|---|---|
| scanId | string | Scan UUID |
| hostname | string | Scanned domain |
| port | number | Port scanned |
| ipAddress | string | Resolved IP address |
| grade | Grade | Letter grade (e.g., "A+", "B", "F", "T", "M") |
| score | number | Numeric score 0–100 |
| subGrades | SubGrades | Per-category score, grade, findings, and weight |
| certificate | object | Full certificate chain details |
| protocols | object | Supported TLS/SSL protocol versions |
| cipherSuites | object | Enumerated cipher suites |
| keyExchange | object | Key exchange parameters |
| vulnerabilities | object | Vulnerability test results |
| bestPractices | object | HSTS, security headers, OCSP stapling results |
| recommendations | Recommendation[] | Actionable fixes sorted by priority |
| warnings | string[] | General informational warnings |
| scanDurationMs | number | Total scan time in milliseconds |
| scannedAt | string | ISO 8601 timestamp |
Status Codes
| Status | Meaning |
|---|---|
| 200 | Scan results returned |
| 404 | Scan not found |
| 423 | Scan still in progress — try again or use the SSE stream |
| 500 | Error 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"
}/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
| Field | Type | Description |
|---|---|---|
| status | ScanStatus | Current scan phase |
| progress | number | Progress from 0 to 1 |
| message | string | Human-readable progress message |
| scanId | string | The scan ID |
Scan Status Lifecycle
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();
}
};/api/v1/scan
Retrieve paginated scan history. Optionally filter by hostname.
Query Parameters
| Field | Type | Description |
|---|---|---|
| page | number | Page number (default: 1) |
| pageSize | number | Results per page (default: 20, max: 50) |
| hostname | string | Filter results by hostname |
Response
| Field | Type | Description |
|---|---|---|
| scans | ScanHistoryEntry[] | Array of scan summaries (scanId, hostname, port, grade, score, status, scannedAt, durationMs) |
| total | number | Total number of matching scans |
| page | number | Current page |
| pageSize | number | Page 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
}/api/v1/health
Check the health of the CipherGrade service and its dependencies.
Response
| Field | Type | Description |
|---|---|---|
| status | "ok" | "degraded" | "error" | Overall service health |
| services | object | Health of sub-services: database, redis, scanner (each boolean) |
Status Codes
| Status | Meaning |
|---|---|
| 200 | All services healthy |
| 503 | One 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
| Error | HTTP | Description |
|---|---|---|
| validation_error | 400 | Request body failed validation |
| invalid_hostname | 400 | Hostname is not a valid domain or is blocked |
| scan_not_found | 404 | No scan exists with this ID |
| scan_in_progress | 423 | Scan is still running |
| rate_limited | 429 | Too many requests from this IP |
| internal_error | 500 | Unexpected 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
| Field | Type | Description |
|---|---|---|
| finding | string | Short title of the issue |
| severity | "critical" | "high" | "medium" | "low" | Severity level |
| what | string | What the problem is |
| why | string | Why it matters |
| fixes | Record<string, string> | Server-specific fix snippets (e.g., nginx, apache, haproxy) |
| priority | number | 1 (most urgent) to 8 (least urgent) |
| references | string[] | CVE/RFC/documentation links |
SubGrade (per category)
| Field | Type | Description |
|---|---|---|
| score | number | Category score 0–100 |
| grade | Grade | Category letter grade |
| label | string | Display name |
| weight | number | Weight in final score (e.g., 0.3 = 30%) |
| findings | Finding[] | Detailed findings for this category |