Getting Started
What is K-OTP?
K-OTP is a comprehensive OTP (One-Time Password) delivery service that helps you secure your applications with reliable verification codes. Whether you need SMS, email, or voice-based authentication, K-OTP provides the infrastructure you need.
Prerequisites
Before you begin, ensure you have:
- A K-OTP account (sign up at k-otp.dev)
- An active subscription plan
- Basic knowledge of REST APIs
- A development environment for testing
Step 1: Create Your Account
- Visit k-otp.dev and click "Sign Up"
- Complete the registration process
- Verify your email address
- Choose a subscription plan that fits your needs
Step 2: Generate API Keys
- Navigate to your dashboard
- Go to Settings > API Keys
- Click "Generate New Key"
- Copy and securely store your API key
- Configure allowed domains/IPs for security
Step 3: Send Your First OTP
Here's a simple example to send an SMS OTP:
const response = await fetch('https://api.k-otp.dev/v1/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
to: '+1234567890',
method: 'sms',
type: 'verification',
template: 'default'
})
});
const result = await response.json();
console.log('OTP ID:', result.id);
Step 4: Verify the OTP
Once the user receives the code, verify it:
const verifyResponse = await fetch('https://api.k-otp.dev/v1/verify', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: result.id,
code: '123456' // Code entered by user
})
});
const verifyResult = await verifyResponse.json();
if (verifyResult.valid) {
console.log('OTP verified successfully!');
}
Testing Your Integration
We recommend testing with our sandbox environment first:
- Use the test API endpoint:
https://api-sandbox.k-otp.dev
- Test phone numbers:
+1555000XXXX
- Test emails:
[email protected]
Common Integration Patterns
User Registration Flow
- User enters phone number/email
- Send OTP for verification
- User enters received code
- Verify OTP and create account
Login with 2FA
- User enters username/password
- Send OTP as second factor
- User enters OTP code
- Verify and grant access
Password Reset
- User requests password reset
- Send OTP to registered contact
- Verify OTP
- Allow password change
Next Steps
- Explore Authentication for detailed security options
- Learn about API Endpoints for complete functionality
- Set up Webhooks for real-time notifications
- Configure Analytics to monitor performance
Need Help?
- Check our FAQ for common questions
- Contact support at [email protected]
- Join our developer community on Discord