Authentication
This guide walks you through the process of setting up API credentials for our service, including whitelisting IPs and generating API keys.
Accessing Your API Dashboard
- Log in to your account dashboard
- Navigate to the Settings section
- Select the Developer tab
Setting Up API Access
Step 1: Whitelist Your IP Address
Before you can use the API, you need to whitelist the IP addresses that will make API calls:
- In the Developer page, locate the Whitelist IPs section
- Click the Add New IP button
- Enter the IP address from which you'll make API requests
- Select the service type (Recharge, Bill Payment, Smart Payouts)
- Save your changes
Step 2: Generate API Keys
After whitelisting your IP address:
- Scroll down to the API Key section
- Click the Generate Key button
- Select the service you need access to
- Once generated, you'll receive two credentials:
- Client ID: Visible in your dashboard
- Client Secret: Provided once during key generation
caution
Keep your Client Secret safe and secure. It will only be shown once during generation.
Using Your Credentials
Authentication Method
Our API uses Basic Authentication:
Authorization: Basic <base64-encoded-credentials>
Where the credentials are formatted as:
- Username: Your Client ID
- Password: Your Client Secret
Code Example
const apiRequest = async () => {
const clientId = 'your_client_id';
const clientSecret = 'your_client_secret';
// Create Basic Auth header by encoding clientId:clientSecret in base64
const authString = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
const response = await fetch('https://api.example.com/endpoint', {
method: 'POST',
headers: {
'Authorization': `Basic ${authString}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
// Your request data
})
});
const data = await response.json();
return data;
};
Step 3: Set Up Webhook URL (Optional)
If your integration requires webhooks:
- During API key generation, you'll be prompted to add your webhook URL
- Enter the full URL where you want to receive notifications
- Ensure this endpoint is publicly accessible and can handle POST requests
Security Best Practices
- Never share your Client Secret in client-side code or public repositories
- Regularly rotate your API keys for enhanced security
- Use environment variables to store credentials in your application
- Implement proper error handling for authentication failures
- Only whitelist the IP addresses that absolutely need API access
Support
If you encounter any issues with API authentication, please contact our support team at support@example.com or open a support ticket from your dashboard.