Skip to Content

Environments

Compare test keys and live keys on the SMS Pro API.

View Markdown (.md)

SMS Pro has one API, https://api.smspro.com. The key you send chooses simulated delivery or carrier delivery.


Key comparison

Test keys and live keys

sk_test_sk_live_
Base URLhttps://api.smspro.comhttps://api.smspro.com
DeliverySimulated. No handset is contacted.Sent to the carrier.
WalletNot charged.Charged per segment.
Result202 with status ACCEPTED_SANDBOX and a sim_ message id.202 and a later delivery status.
Magic numbersSelect a specific simulated outcome.The same four numbers are still simulated, even on a live key.
Sender IDA test name is accepted.A custom name must be approved.

Test keys

A test key checks authentication, scopes, and the request body, then returns a simulated acceptance. It also posts a simulated delivery webhook when you have a webhook URL.

curl -X POST "https://api.smspro.com/api/v1/public/sms/send" \
  -H "X-Api-Key: sk_test_example" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+233200000001",
    "senderId": "SMSPRO",
    "message": "Testing from local environment."
  }'

Read the magic-number outcomes in Testing in Sandbox.


Live keys

A live key sends to the carrier and uses wallet credit.

curl -X POST "https://api.smspro.com/api/v1/public/sms/send" \
  -H "X-Api-Key: sk_live_example" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+233241234567",
    "senderId": "MYAPP",
    "message": "Your verification code is 491029."
  }'

Before live traffic:

  1. Keep a prepaid balance.
  2. Use an approved senderId, or the platform default.
  3. Send only to people who have opted in.

Configuring Your Environment

We recommend decoupling the gateway URL and API key from your application logic using environment variables.

Local Development (.env.local)

.env.local
SMSPRO_BASE_URL=https://api.smspro.com
SMSPRO_API_KEY=sk_test_948f293048a1b2c3d4e5f60718a2b3c4

Production Deployment (.env.production)

.env.production
SMSPRO_BASE_URL=https://api.smspro.com
SMSPRO_API_KEY=sk_live_891024ab9012cd34ef560718a2b3c4d5

Dynamic Client Initialization Example

sms-client.ts
const baseUrl = process.env.SMSPRO_BASE_URL || 'https://api.smspro.com';
const apiKey = process.env.SMSPRO_API_KEY;

if (!apiKey) {
  throw new Error('Missing SMSPRO_API_KEY configuration.');
}

export async function sendSms(to: string, senderId: string, message: string) {
  const response = await fetch(`${baseUrl}/api/v1/public/sms/send`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Api-Key': apiKey,
      'Idempotency-Key': crypto.randomUUID(),
    },
    body: JSON.stringify({ to, senderId, message }),
  });

  return response.json();
}

Next Step

Make your very first live API call in Your First API Request.

On this page