API Documentation
Complete guide to integrating KeyClaim Challenge Validation API into your application
Overview
KeyClaim provides a simple API for challenge-response validation. No authentication systems, no dashboards, just API validation. Perfect for building secure applications without the complexity.
Create Challenge
Generate a new challenge token for validation. Each challenge is unique and expires after the specified TTL.
/api/challenge/createcURL (Copy to Postman)
curl -X POST https://keyclaim.org/api/challenge/create \
-H "Content-Type: application/json" \
-d '{
"key": "kc_your_api_key_here",
"ttl": 30
}'Request Body
{
"key": "kc_your_api_key_here",
"ttl": 30
}Response
{
"challenge": "random_hex_string",
"expires_in": 30
}Code Examples
curl -X POST https://keyclaim.org/api/challenge/create \
-H "Content-Type: application/json" \
-d '{
"key": "kc_your_api_key_here",
"ttl": 30
}'Validate Response
Validate a challenge-response pair. Returns validation result and optional signature for Pro/Business plans.
/api/challenge/validatecURL (Copy to Postman)
curl -X POST https://keyclaim.org/api/challenge/validate \
-H "Content-Type: application/json" \
-d '{
"key": "kc_your_api_key_here",
"challenge": "challenge_from_create",
"response": "hmac_sha256_response_here"
}'Request Body
{
"key": "kc_your_api_key_here",
"challenge": "challenge_from_create",
"response": "response_value"
}Response
{
"valid": true,
"signature": "signed_verdict_hex"
}Response Generation Examples
curl -X POST https://keyclaim.org/api/challenge/validate \
-H "Content-Type: application/json" \
-d '{
"key": "kc_your_api_key_here",
"challenge": "challenge_from_create",
"response": "hmac_sha256_response_here"
}'Error Codes
invalid_keyAPI key is invalid or inactive
expired_challengeChallenge has expired
replayed_challengeChallenge has already been used
invalid_signatureResponse signature is invalid
rate_limitedRate limit exceeded
RSA Public-Private Key Encryption
Enhance security with RSA encryption! Generate a key pair, keep the private key on your client, and let the server encrypt challenges with your public key. Perfect for maximum MITM protection.
How It Works
- • Generate public-private key pair
- • Keep private key on client (never send to server)
- • Server encrypts challenges with public key
- • Client decrypts with private key
- • Continue with normal HMAC validation
Benefits
- • Encrypted challenges (useless if intercepted)
- • Enhanced MITM protection
- • Forward secrecy
- • Works with all platforms
⚠️ Important: Your private key must be kept secure on the client side. Never send it to the server or commit it to version control.
Response Generation (Backend Keys)
For backend API keys, you need to generate a response using HMAC-SHA256. The response must be computed from the challenge using your API key as the secret.
For Testing
Use the playground to test responses
For Production
Use HMAC-SHA256(challenge, apiKey)
Platform Guides
Learn how to integrate KeyClaim in your preferred platform:
Web Frameworks
Mobile Platforms
Backend Documentation
Learn how to integrate KeyClaim in your preferred programming language:
Node.js
JavaScript/TypeScript integration guide
Python
Python 3.7+ integration guide
PHP
PHP 7.4+ integration guide
Java
Java 8+ integration guide
Kotlin
Kotlin/JVM integration guide
C#
.NET/C# integration guide
Go
Go 1.18+ integration guide