Sandbox Mode
Test your integration without sending real messages or incurring charges. Sandbox mode provides realistic mock responses for all API endpoints.
API Key Types
Test Keys
sc_test_- ✓ Mock responses returned
- ✓ No real messages sent
- ✓ No balance deducted
- ✓ Full validation applied
Live Keys
sc_live_- → Real messages sent
- → Balance deducted
- → Production metrics
- → Webhooks triggered
Getting Test Keys
- 1
Go to Dashboard → API Keys
Navigate to your API keys management page
- 2
Click "Create API Key"
Open the key creation modal
- 3
Toggle "Sandbox Mode" ON
Enable test mode for this key
- 4
Copy your test key
Your key will start with
sc_test_
Example Request
curl -X POST https://api.sendcomms.com/api/v1/sms/send \
-H "Authorization: Bearer sc_test_YOUR_TEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+233540800994",
"message": "Hello from sandbox mode!"
}'Sandbox Response
{
"success": true,
"data": {
"transaction_id": "sms_test_mji01l2o_g8pamf65",
"message_id": "SMtest1c7pkfx8z",
"status": "sent",
"to": "+233540800994",
"from": "SendComms",
"message_length": 24,
"segments": 1,
"price": {
"amount": 0.029,
"currency": "USD"
},
"provider": "sandbox",
"country": {
"code": "233",
"name": "Ghana"
},
"region": "africa",
"_sandbox": {
"mode": "test",
"message": "This is a test transaction. No real SMS was sent.",
"note": "Switch to a live API key (sc_live_) to send real messages."
}
}
}Note the _sandbox object in the response indicating test mode.
Supported Services
| Service | Endpoint | Sandbox |
|---|---|---|
| SMS | /api/v1/sms/send | Supported |
| /api/v1/email/send | Supported | |
| Email Batch | /api/v1/email/batch | Supported |
| Data Bundles | /api/v1/data/purchase | Supported |
| Airtime | /api/v1/airtime/purchase | Coming Soon |
What Gets Validated
Sandbox mode performs the same validation as production. If your request works in sandbox, it will work in production.
✓ Validated in Sandbox
- • API key authentication
- • Request body format
- • Phone number format (E.164)
- • Email address format
- • Required fields
- • Message length limits
- • Network validation
- • Rate limiting
✗ Skipped in Sandbox
- • Balance check
- • Actual message delivery
- • Provider API calls
- • Real charges
Detecting Sandbox Mode
All sandbox responses include a _sandbox object. Check for this to confirm you're in test mode:
if (response.data._sandbox) {
console.log('⚠️ Running in sandbox mode');
// Handle test mode logic
}Switching to Production
When you're ready to go live, simply swap your test key for a live key:
# Development
SENDCOMMS_API_KEY=sc_test_xxx
# Production
SENDCOMMS_API_KEY=sc_live_xxxImportant
Ensure you have sufficient balance before switching to production. Live requests will charge your account.
Best Practices
Use Environment Variables
Store different keys for development and production environments
Add Production Checks
Verify you're not using test keys in production environments
Test All Scenarios
Test successful sends, validation errors, and edge cases
Log Sandbox Responses
Check for _sandbox in responses to verify test mode
