Sendexa LogoDocs

API Authentication

Secure access to the Sendexa SMS API using Basic Authentication with your API credentials.

Authentication Format

The dashboard provides a precomputed Base64 token for your API credentials. Copy it and add it directly to the request header as shown below.

Step 1: Copy base64 token from dashboard

ZXhhXzFhMmIzYzo0ZDVlNmY3ZzhoOWk=

Step 2: Use in header

Authorization: Basic ZXhhXzFhMmIzYzo0ZDVlNmY3ZzhoOWk=
Quick Examples

JavaScript

const token = 'ZXhhXzFhMmIzYzo0ZDVlNmY3ZzhoOWk=';
const headers = {
'Authorization': 'Basic ' + token,
'Content-Type': 'application/json'
};

Python

token = 'ZXhhXzFhMmIzYzo0ZDVlNmY3ZzhoOWk='
headers = {
'Authorization': f'Basic {token}',
'Content-Type': 'application/json'
}

cURL

curl -H "Authorization: Basic ZXhhXzFhMmIzYzo0ZDVlNmY3ZzhoOWk=" ...
Complete API Request Example

Here's a complete example showing how to send an SMS with authentication:

curl -X POST "https://api.sendexa.co/v1/sms/send" \
-H "Authorization: Basic $(echo -n 'exa_1a2b3c:4d5e6f7g8h9i' | base64)" \
-H "Content-Type: application/json" \
-d '{
"recipient": "0244123456",
"message": "Hello from Sendexa API!",
"senderId": "MyApp"
}'
Note: Replace exa_1a2b3c:4d5e6f7g8h9i with your actual API key and secret from the dashboard.
Security Best Practices

🔐 Protect Your Credentials

  • Never commit API secrets to version control
  • Use environment variables for storage
  • Rotate keys every 3-6 months
  • Different keys for development/production

🛡️ Secure Implementation

  • Always use HTTPS endpoints
  • Validate phone numbers before sending
  • Implement rate limiting in your application
  • Monitor your API usage and credits
Troubleshooting

❌ 401 Unauthorized

Check that your API key and secret are correct and properly base64 encoded.

❌ 403 Forbidden

Verify that your API key is active and has the necessary permissions (sms:send).

🔍 Testing Your Credentials

Use this command to test your authentication:

# Test authentication
curl -H "Authorization: Basic YOUR_BASE64_CREDENTIALS" \
https://api.sendexa.co/v1/health