SDK Examples
Node.js
const axios = require('axios');
const NOPARAM_API_KEY = 'your_api_key';
const baseURL = 'https://noparam.com/api/v1';
// Single email verification
async function verifyEmail(email) {
try {
const response = await axios.post(
`${baseURL}/verify`,
{ email },
{
headers: {
'Authorization': `Bearer ${NOPARAM_API_KEY}`,
'Content-Type': 'application/json'
}
}
);
return response.data;
} catch (error) {
console.error('Verification failed:', error.response?.data || error.message);
throw error;
}
}
// Bulk email verification
async function verifyEmails(emails) {
try {
const response = await axios.post(
`${baseURL}/verify/bulk`,
{ emails },
{
headers: {
'Authorization': `Bearer ${NOPARAM_API_KEY}`,
'Content-Type': 'application/json'
}
}
);
return response.data;
} catch (error) {
console.error('Bulk verification failed:', error.response?.data || error.message);
throw error;
}
}
// Example usage
(async () => {
// Verify a single email
try {
const result = await verifyEmail('example@domain.com');
console.log('Verification result:', result);
} catch (error) {
// Handle error
}
// Verify multiple emails
try {
const results = await verifyEmails([
'example1@domain.com',
'example2@domain.com'
]);
console.log('Bulk verification results:', results);
} catch (error) {
// Handle error
}
})();
Python
import requests
NOPARAM_API_KEY = 'your_api_key'
BASE_URL = 'https://noparam.com/api/v1'
headers = {
'Authorization': f'Bearer {NOPARAM_API_KEY}',
'Content-Type': 'application/json'
}
# Single email verification
def verify_email(email):
try:
response = requests.post(
f'{BASE_URL}/verify',
json={'email': email},
headers=headers
)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Verification failed: {e}')
if hasattr(e, 'response') and e.response:
print(e.response.json())
raise
# Bulk email verification
def verify_emails(emails):
try:
response = requests.post(
f'{BASE_URL}/verify/bulk',
json={'emails': emails},
headers=headers
)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Bulk verification failed: {e}')
if hasattr(e, 'response') and e.response:
print(e.response.json())
raise
# Example usage
if __name__ == '__main__':
# Verify a single email
try:
result = verify_email('example@domain.com')
print(f'Verification result: {result}')
except Exception:
# Handle error
pass
# Verify multiple emails
try:
results = verify_emails([
'example1@domain.com',
'example2@domain.com'
])
print(f'Bulk verification results: {results}')
except Exception:
# Handle error
pass
Last updated