API Reference
Complete documentation for the ECURTIY verification API. All endpoints use JSON.
Base URL
https://your-ecurtiy-domain.comUse the ECURTIY cloud service URL for your API calls.
Authentication
Site Key (Public)
eck_live_...Used in the widget, safe to expose in client-side code.
Secret Key (Private)
ecs_live_...Used for server-side validation. Never expose publicly.
Verification Endpoints
/api/challengeGenerate Challenge
Create a new Proof of Work challenge for the widget to solve.
Authentication
Site Key (Public)
Request Body
{
"siteKey": "eck_live_your_site_key"
}Response
{
"challengeId": "ch_abc123...",
"prefix": "random_prefix_string",
"difficulty": 16,
"expiresAt": "2024-12-08T12:05:00Z",
"mode": "checkbox"
}Notes
- •Challenge expires after 5 minutes
- •Difficulty ranges from 14-18 bits
- •Mode is determined by site configuration
/api/verifyVerify Solution
Submit the Proof of Work solution and behavioral data to get a verification token.
Authentication
None (Widget calls this)
Request Body
{
"challengeId": "ch_abc123...",
"nonce": 12345678,
"solveTimeMs": 1850,
"fingerprint": "sha256_hash_of_browser_data",
"behavioral": {
"mouseEntropy": 4.2,
"interactionCount": 15,
"sessionDuration": 3500
}
}Response
{
"success": true,
"token": "ect_verification_token...",
"expiresAt": "2024-12-08T12:05:00Z"
}Notes
- •Token is valid for 5 minutes
- •Token can only be used once
- •Risk score must be below 0.7 to pass
/api/validateValidate Token
Server-side validation of a verification token. Call this from your backend.
Authentication
Secret Key (Private)
Request Body
{
"token": "ect_verification_token...",
"secretKey": "ecs_live_your_secret_key"
}Response
{
"success": true,
"data": {
"passed": true,
"riskScore": 0.15,
"solveTimeMs": 1850,
"createdAt": "2024-12-08T12:00:00Z"
}
}Notes
- •Always validate tokens server-side
- •Tokens are marked as used after validation
- •Returns detailed verification data
Site Management Endpoints
These endpoints require authentication via NextAuth session. Used by the dashboard.
/api/sitesGet all sites for the authenticated user.
/api/sitesCreate a new site with generated API keys.
/api/sites/[id]Get details for a specific site.
/api/sites/[id]Update site settings (name, domain, mode, difficulty).
/api/sites/[id]Delete a site and all associated data.
/api/sites/[id]/regenerate-keysGenerate new site key and secret key.
Analytics Endpoint
/api/analytics/[siteId]Get Site Analytics
Retrieve verification analytics for a specific site.
Query Parameters
period- One of: 24h, 7d, 30d, 90dResponse Fields
summary.totalVerifications- Total count in periodsummary.passedVerifications- Successful verificationssummary.failedVerifications- Failed verificationssummary.passRate- Success percentagesummary.avgSolveTimeMs- Average solve timesummary.avgRiskScore- Average risk scorechartData- Daily breakdown arrayrecentVerifications- Last 10 verifications
Error Codes
INVALID_SITE_KEYThe provided site key is invalid or inactive
SITE_INACTIVEThe site has been deactivated
QUOTA_EXCEEDEDMonthly verification limit exceeded
CHALLENGE_EXPIREDThe challenge has expired (5 min TTL)
INVALID_SOLUTIONThe PoW solution is incorrect
HIGH_RISK_SCORERisk score exceeded threshold (0.7)
TOKEN_EXPIREDThe verification token has expired
TOKEN_USEDThe token has already been validated
INVALID_SECRET_KEYThe secret key is invalid
RATE_LIMITEDToo many requests, try again later