Authentication
API Keys
- SendAfrica: Keys start with prefix
SA-(e.g.,SA-9f8a...) - MailAfrica: Keys start with prefix
MA-(e.g.,MA-3b1c...)
Generate API keys in the SendAfrica Dashboard under Developer > API Keys.
Authentication Methods
X-API-Key Header
curl -X GET https://api.sendafrica.online/v1/credits/balance \
-H "X-API-Key: SA-your-api-key-here"Authorization Bearer Token
curl -X GET https://api.sendafrica.online/v1/credits/balance \
-H "Authorization: Bearer your-jwt-token"Code Examples
Python
from sendafrica import SendAfrica
client = SendAfrica(api_key="SA-your-api-key-here")Node.js / TypeScript
import { SendAfrica } from 'sendafrica';
const client = new SendAfrica({ apiKey: 'SA-your-api-key-here' });PHP
$client = new SendAfrica\Client(['api_key' => 'SA-your-api-key-here']);Security Best Practices
- Never expose API keys in client-side code or public repositories
- Use environment variables to store keys
- Rotate keys regularly
- Use the principle of least privilege
- Monitor API usage for unexpected activity
Last updated on