Documentation
Getting Started
API Reference
SMS API
Contacts API
OTP API
Voice API
MMS API
WhatsApp API
Viber API
HTTP API
HTTP Endpoints
HTTP SMS API
Authentication Guide
Learn how to authenticate your API requests securely.
API Key Authentication
All API requests require an API key for authentication. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Getting Your API Key
- Log in to your OpenSMS account
- Go to Settings → API Keys
- Click "Generate New Key"
- Copy your API key and keep it safe
Using Your API Key
Example Request
curl -X GET https://api.opensms.co.ke/v3/account \
-H "Authorization: Bearer sk_live_abc123xyz789"
Security Best Practices
- Never share your API key publicly
- Store API keys in environment variables, not in code
- Rotate your API keys regularly
- Use HTTPS for all API requests
- Revoke keys that are no longer needed
Revoking API Keys
If your API key is compromised, revoke it immediately:
- Log in to your account
- Go to Settings → API Keys
- Click "Revoke" next to the key
- Generate a new API key
Environment Variables Example
PHP (.env file)
OPENSMS_API_KEY=sk_live_abc123xyz789
Python (.env file)
OPENSMS_API_KEY=sk_live_abc123xyz789
Node.js (.env file)
OPENSMS_API_KEY=sk_live_abc123xyz789