Authentication
All API requests to PayVanta must be authenticated using Base64 encoded API credentials. This ensures secure access to your account and its resources.
Getting API Credentials
- Log in to your PayVanta dashboard
- Navigate to Settings > API Keys
- Generate a new API key pair
- Store your credentials securely

Authentication Method
To authenticate your requests:
- Combine your API key and secret with a colon:
api_key:api_secret - Encode the combined string in Base64
- Add the encoded string as a Bearer token in the Authorization header
Example
# Original credentials
api_key:api_secret
# After Base64 encoding
YXBpX2tleTphcGlfc2VjcmV0
# Final Authorization header
Authorization: Bearer YXBpX2tleTphcGlfc2VjcmV0Implementation Examples
cURL
curl -X POST https://api.payvanta.in/v1/endpoint \
-H "Authorization: Basic ${BASE64_ENCODED_CREDENTIALS}" \
-H "Content-Type: application/json" \
-d '{"key": "value"}'Python
import requests
import base64
# Generate Bearer token
api_key = "your_api_key"
api_secret = "your_api_secret"
credentials = f"{api_key}:{api_secret}"
token = base64.b64encode(credentials.encode()).decode()
# Make API request
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
response = requests.post("https://api.payvanta.in/v1/endpoint", headers=headers, json={"key": "value"})Node.js
const axios = require('axios');
// Generate Bearer token
const apiKey = 'your_api_key';
const apiSecret = 'your_api_secret';
const credentials = `${apiKey}:${apiSecret}`;
const token = Buffer.from(credentials).toString('base64');
// Make API request
const headers = {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
};
axios.post('https://api.payvanta.in/v1/endpoint', { key: 'value' }, { headers });Security Best Practices
- Never share your API credentials
- Store credentials securely
- Use environment variables for API credentials
- Rotate API credentials periodically
- Use HTTPS for all API requests
- Monitor API usage for suspicious activity
Error Responses
If authentication fails, you'll receive a 401 Unauthorized response:
{
"success": false,
"message": "UNAUTHORIZED",
"error": "Invalid authentication credentials"
}IP Whitelisting
For enhanced security, you can whitelist IP addresses that are allowed to make API requests:
- In the Dev Settings tab, find the "IP Whitelist" section
- Add your server IPs
- Wait for approval (usually instant)
- Verify whitelist status