Back to Resources
Getting Started Guide
Learn how to integrate ContactVerify into your application in under 10 minutes.
1. Get Your API Key
Sign up for a ContactVerify account and navigate to the API Keys section in your dashboard. Create a new API key and keep it secure.
Your API key should be stored securely and never exposed in client-side code. Use environment variables to manage your keys.
2. Send an Email OTP
Use the following endpoint to send an OTP to a user's email address.
POST /v1/contact/send-email-otp
// Send Email OTP
const response = await fetch('https://api.contactverify.io/v1/contact/send-email-otp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
email: 'user@example.com',
user_id: 'user_123',
purpose: 'registration',
otp_length: 6,
expiry_minutes: 10
})
});
const data = await response.json();
console.log(data.request_id); // Store this for verification3. Verify the OTP
Once the user receives the OTP and enters it, verify it using this endpoint.
POST /v1/contact/verify-email-otp
// Verify Email OTP
const response = await fetch('https://api.contactverify.io/v1/contact/verify-email-otp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
request_id: 'req_abc123',
otp_code: '123456'
})
});
const data = await response.json();
if (data.verified) {
console.log('Email verified successfully!');
}4. SMS OTP (Optional)
You can also send OTPs via SMS using a similar API structure.
POST /v1/contact/send-sms-otp
// Send SMS OTP
const response = await fetch('https://api.contactverify.io/v1/contact/send-sms-otp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
phone_number: '+14155551234',
country_code: 'US',
user_id: 'user_123',
purpose: 'login'
})
});
const data = await response.json();Next Steps
Configure Rate Limits
Set up rate limiting to protect against abuse.
Set Up Webhooks
Receive real-time notifications for OTP events.
Custom Branding
Customize email templates with your brand.
Analytics Dashboard
Monitor OTP delivery and verification rates.