Skip to Content
API ReferenceAuthentication

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

  1. Never expose API keys in client-side code or public repositories
  2. Use environment variables to store keys
  3. Rotate keys regularly
  4. Use the principle of least privilege
  5. Monitor API usage for unexpected activity
Last updated on