API Endpoints
Complete reference for all MAGEN API endpoints. Click on any endpoint to expand and see request/response details.
REST API v1
Base URL: https://api.magentrust.ai/v1
POST /v1/verify
Request a verification token based on behavioral data. Send sessionId, behavioralData (mouseMovements, keystrokes, clicks, scrollEvents, formInteractionTime), and endpoint. Auth: Bearer PUBLIC_API_KEY. Response 200: verified, token, entropyScore, riskLevel, expiresAt. Response 403: bot detected.
const res = await fetch("https://api.magentrust.ai/v1/verify", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MAGEN_PUBLIC_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"sessionId": "sess_abc123xyz789",
"endpoint": "/signup",
"behavioralData": {
"mouseMovements": 142,
"keystrokes": 38,
"clicks": 6,
"scrollEvents": 12,
"formInteractionTime": 18400
}
}),
});
if (!res.ok) throw new Error(`MagenTrust ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);POST /v1/validate-token
Validate a verification token (server-side only). Body: {"token": "eyJ..."}. Auth: Bearer SECRET_KEY. Response 200: valid, sessionId, entropyScore, issuedAt, expiresAt. Response 403: invalid or expired.
const res = await fetch("https://api.magentrust.ai/v1/validate-token", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MAGEN_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"token": "eyJhbGciOiJFUzI1NiIs..."
}),
});
if (!res.ok) throw new Error(`MagenTrust ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);GET /v1/analytics
Retrieve verification analytics. Auth: Bearer SECRET_KEY. Query params for date range and filters. Returns aggregate stats and time series.
const res = await fetch("https://api.magentrust.ai/v1/analytics?from=2026-09-01&to=2026-09-25", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.MAGEN_SECRET_KEY}`,
},
});
if (!res.ok) throw new Error(`MagenTrust ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);POST /v1/thresholds
Update entropy thresholds per endpoint. Body: endpoint, thresholds: { low, medium, high }. Auth: Bearer SECRET_KEY.
const res = await fetch("https://api.magentrust.ai/v1/thresholds", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MAGEN_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"endpoint": "/checkout",
"thresholds": {
"low": 0.3,
"medium": 0.6,
"high": 0.85
}
}),
});
if (!res.ok) throw new Error(`MagenTrust ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);GET /v1/blocked-sessions
List blocked sessions. Auth: Bearer SECRET_KEY. Query params for pagination and date range.
const res = await fetch("https://api.magentrust.ai/v1/blocked-sessions?page=1&limit=50", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.MAGEN_SECRET_KEY}`,
},
});
if (!res.ok) throw new Error(`MagenTrust ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);Verification Flow (Legacy)
Public endpoints for human verification. No API key required.
Entropy Deployment
Deploy entropy challenges to increase verification difficulty. Used to distinguish humans from sophisticated bots through behavioral adaptation testing.
Agent Bypass Integration
Trusted agents with a valid X-Agent-Token header bypass entropy challenges automatically.
// Agent Bypass Integration
// When a trusted agent calls any endpoint with valid X-Agent-Token:
if (isValidAgentToken(req)) {
return {
entropyLevel: 0,
exempt: true,
reason: "trusted_agent"
};
}Automatic Escalation Triggers
The system automatically deploys entropy when trust signals indicate suspicious behavior.
// Automatic Escalation Triggers
// The system auto-deploys entropy based on trust signals:
trustScore < 0.3 → Level 3 (mild friction)
trustScore < 0.2 + botSig → Level 7 (moderate challenge)
honeypot.triggered → Level 10 (death zone)Session Management
Authenticated endpoints for managing verification sessions. Requires API key.
Utility
Additional utility endpoints for token generation and monitoring.