GET /api/v1/historyΒΆ
Get historical snapshots for a domain showing how security scores have changed over time.
GET
/api/v1/history
OverviewΒΆ
View historical security check results for a domain. Perfect for: - Tracking improvements after implementing fixes - Detecting regressions when configurations change - Compliance reporting with historical data - Trend analysis over days, weeks, or months
Results are saved automatically when using /api/v1/check with save_snapshot=true (default).
RequestΒΆ
Query ParametersΒΆ
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
domain |
string | β Yes | - | Domain to get history for |
limit |
integer | β No | 30 |
Number of snapshots to return (1-365) |
days |
integer | β No | null |
Only return snapshots from last N days |
HeadersΒΆ
ResponseΒΆ
Success Response (200 OK)ΒΆ
{
"domain": "example.com",
"snapshots": [
{
"timestamp": "2025-10-21T10:00:00Z",
"score": 85,
"spf_present": true,
"dkim_present": true,
"dmarc_present": true,
"dmarc_policy": "quarantine",
"critical_issues": 0,
"high_issues": 1
},
{
"timestamp": "2025-10-20T14:30:00Z",
"score": 75,
"spf_present": true,
"dkim_present": true,
"dmarc_present": true,
"dmarc_policy": "none",
"critical_issues": 0,
"high_issues": 2
}
],
"total_snapshots": 45,
"date_range": {
"first": "2025-09-01T08:00:00Z",
"last": "2025-10-21T10:00:00Z"
},
"meta": {
"latency_ms": 120
}
}
Error ResponsesΒΆ
404 Not Found - No history found for domain
ExamplesΒΆ
cURLΒΆ
Last 30 Snapshots:
curl -X GET "https://api.reputeapi.com/api/v1/history?domain=example.com" \
-H "X-API-Key: your-api-key"
Last 7 Days:
curl -X GET "https://api.reputeapi.com/api/v1/history?domain=example.com&days=7" \
-H "X-API-Key: your-api-key"
Last 100 Snapshots:
curl -X GET "https://api.reputeapi.com/api/v1/history?domain=example.com&limit=100" \
-H "X-API-Key: your-api-key"
PythonΒΆ
Basic History:
import requests
response = requests.get(
"https://api.reputeapi.com/api/v1/history",
params={"domain": "example.com"},
headers={"X-API-Key": "your-api-key"}
)
result = response.json()
print(f"Total snapshots: {result['total_snapshots']}")
print(f"\nRecent scores:")
for snapshot in result['snapshots'][:10]:
print(f" {snapshot['timestamp']}: {snapshot['score']}/100")
Trend Analysis:
import requests
from datetime import datetime
def analyze_trend(domain: str, days: int = 30):
"""Analyze security score trends"""
response = requests.get(
"https://api.reputeapi.com/api/v1/history",
params={"domain": domain, "days": days},
headers={"X-API-Key": "your-api-key"}
)
result = response.json()
snapshots = result['snapshots']
if len(snapshots) < 2:
print("Not enough data for trend analysis")
return
# Calculate trend
first_score = snapshots[-1]['score']
last_score = snapshots[0]['score']
change = last_score - first_score
print(f"Domain: {domain}")
print(f"Period: Last {days} days")
print(f"First Score: {first_score}/100")
print(f"Latest Score: {last_score}/100")
print(f"Change: {change:+d} points")
if change > 0:
print("β Score improved!")
elif change < 0:
print("β Score declined!")
else:
print("β Score unchanged")
# Show issue trend
first_critical = snapshots[-1]['critical_issues']
last_critical = snapshots[0]['critical_issues']
print(f"\nCritical Issues: {first_critical} β {last_critical}")
analyze_trend("example.com", days=30)
Plot Chart:
import requests
import matplotlib.pyplot as plt
from datetime import datetime
def plot_score_history(domain: str):
"""Plot security score over time"""
response = requests.get(
"https://api.reputeapi.com/api/v1/history",
params={"domain": domain, "limit": 90},
headers={"X-API-Key": "your-api-key"}
)
result = response.json()
snapshots = result['snapshots']
# Extract data
dates = [datetime.fromisoformat(s['timestamp'].replace('Z', '+00:00'))
for s in snapshots]
scores = [s['score'] for s in snapshots]
# Plot
plt.figure(figsize=(12, 6))
plt.plot(dates, scores, marker='o', linewidth=2)
plt.axhline(y=90, color='g', linestyle='--', label='Excellent (90+)')
plt.axhline(y=75, color='y', linestyle='--', label='Good (75+)')
plt.axhline(y=50, color='r', linestyle='--', label='Fair (50+)')
plt.xlabel('Date')
plt.ylabel('Security Score')
plt.title(f'Mailflow Security Score History - {domain}')
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig(f'{domain}_history.png')
plt.show()
plot_score_history("example.com")
JavaScriptΒΆ
async function getHistory(domain, days = null) {
const params = new URLSearchParams({ domain });
if (days) params.append('days', days);
const response = await fetch(
`https://api.reputeapi.com/api/v1/history?${params}`,
{
headers: { 'X-API-Key': 'your-api-key' }
}
);
const result = await response.json();
console.log(`Total snapshots: ${result.total_snapshots}`);
console.log(`\nRecent scores:`);
result.snapshots.slice(0, 10).forEach(snapshot => {
console.log(` ${snapshot.timestamp}: ${snapshot.score}/100`);
});
return result;
}
getHistory('example.com', 30);
Response FieldsΒΆ
| Field | Type | Description |
|---|---|---|
domain |
string | Domain queried |
snapshots |
array | List of historical snapshots (newest first) |
total_snapshots |
integer | Total number of snapshots in database |
date_range.first |
string | Timestamp of oldest snapshot |
date_range.last |
string | Timestamp of newest snapshot |
meta.latency_ms |
integer | Response time in milliseconds |
Snapshot ObjectΒΆ
| Field | Type | Description |
|---|---|---|
timestamp |
string | When the check was performed (ISO 8601) |
score |
integer | Mailflow Security Score at that time |
spf_present |
boolean | SPF record was present |
dkim_present |
boolean | DKIM records were found |
dmarc_present |
boolean | DMARC record was present |
dmarc_policy |
string | DMARC policy: none, quarantine, or reject |
critical_issues |
integer | Number of critical issues |
high_issues |
integer | Number of high severity issues |
Use CasesΒΆ
1. Compliance ReportingΒΆ
def generate_compliance_report(domain: str, days: int = 90):
"""Generate quarterly compliance report"""
response = requests.get(
"https://api.reputeapi.com/api/v1/history",
params={"domain": domain, "days": days},
headers={"X-API-Key": "your-api-key"}
)
result = response.json()
snapshots = result['snapshots']
# Calculate metrics
avg_score = sum(s['score'] for s in snapshots) / len(snapshots)
min_score = min(s['score'] for s in snapshots)
max_score = max(s['score'] for s in snapshots)
above_threshold = sum(1 for s in snapshots if s['score'] >= 75)
compliance_rate = (above_threshold / len(snapshots)) * 100
print(f"""
Quarterly Security Report - {domain}
Period: Last {days} days
Score Metrics:
Average: {avg_score:.1f}/100
Minimum: {min_score}/100
Maximum: {max_score}/100
Compliance:
Target: 75/100 or higher
Compliance Rate: {compliance_rate:.1f}%
({above_threshold}/{len(snapshots)} checks above threshold)
""")
2. Regression DetectionΒΆ
def detect_regressions(domain: str):
"""Alert if score has dropped recently"""
response = requests.get(
"https://api.reputeapi.com/api/v1/history",
params={"domain": domain, "limit": 10},
headers={"X-API-Key": "your-api-key"}
)
snapshots = response.json()['snapshots']
if len(snapshots) < 2:
return
latest = snapshots[0]
previous = snapshots[1]
score_change = latest['score'] - previous['score']
if score_change < -5: # Score dropped by 5+ points
print(f"β REGRESSION DETECTED for {domain}!")
print(f"Score dropped from {previous['score']} to {latest['score']}")
print(f"Critical issues: {previous['critical_issues']} β {latest['critical_issues']}")
# Send alert via email/Slack/etc.
3. Progress TrackingΒΆ
def track_improvement_progress(domain: str, days: int = 30):
"""Track security improvements over time"""
response = requests.get(
"https://api.reputeapi.com/api/v1/history",
params={"domain": domain, "days": days},
headers={"X-API-Key": "your-api-key"}
)
snapshots = response.json()['snapshots']
# Reverse to chronological order
snapshots.reverse()
milestones = {
50: "Fair security",
75: "Good security",
90: "Excellent security"
}
for milestone, description in milestones.items():
milestone_reached = next(
(s for s in snapshots if s['score'] >= milestone),
None
)
if milestone_reached:
print(f"β Reached {milestone}/100 ({description}) on {milestone_reached['timestamp']}")
else:
print(f"β Not yet reached {milestone}/100 ({description})")
Data RetentionΒΆ
- Snapshots are stored indefinitely by default
- You can request deletion via support if needed
- Each domain can have up to 10,000 snapshots
- Older snapshots are automatically archived after 1 year
Related EndpointsΒΆ
- GET /api/v1/check - Create new snapshot
- GET /api/v1/score - Quick score without saving snapshot
- POST /api/v1/recommendations - Get improvement recommendations