Skip to main content
GET
/
api
/
v1
/
sms
/
status
SMS Service Status
curl --request GET \
  --url https://api.example.com/api/v1/sms/status
{
  "service": "<string>",
  "username": "<string>",
  "api_key_set": true,
  "service_available": true,
  "message": "<string>",
  "timestamp": "<string>"
}

Overview

Returns the current status of the Africa’s Talking SMS service, including configuration details and availability.

Request

No request body or parameters required.

Response

service
string
Service name (always “SMS”)
username
string
Africa’s Talking username configured
api_key_set
boolean
Whether a valid API key is configured
service_available
boolean
Whether the SMS service is ready to send messages
message
string
Human-readable status message
timestamp
string
ISO 8601 timestamp of the status check

Example Request

curl http://localhost:8000/api/v1/sms/status

Example Response (Service Ready)

{
  "service": "SMS",
  "username": "sandbox",
  "api_key_set": true,
  "service_available": true,
  "message": "SMS service ready",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Example Response (Service Unavailable)

{
  "service": "SMS",
  "username": "sandbox",
  "api_key_set": false,
  "service_available": false,
  "message": "SMS service unavailable - check API credentials",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Example Response (Error)

{
  "service": "SMS",
  "status": "error",
  "message": "Configuration error: AT_USERNAME not set",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Status Codes

  • 200 - Status check completed (service may or may not be available)

Use Cases

  • Health Checks: Verify SMS service is operational before sending messages
  • Debugging: Troubleshoot SMS configuration issues
  • Monitoring: Include in application health monitoring dashboards
  • Setup Validation: Confirm Africa’s Talking credentials are configured correctly

Implementation Details

This endpoint checks:
  1. If AT_USERNAME environment variable is set
  2. If AT_API_KEY environment variable is set and valid (length > 10)
  3. If the Africa’s Talking SMS service client is initialized
Source: sms.py:263-290

Troubleshooting

Cause: API key not configured or invalidSolution: Set the AT_API_KEY environment variable with your Africa’s Talking API key
export AT_API_KEY=your_api_key_here
Cause: AT_API_KEY environment variable is not set or emptySolution: Configure the API key in your .env file:
AT_API_KEY=your_sandbox_or_production_key
Cause: AT_USERNAME environment variable is not setSolution: Set the username in your .env file:
AT_USERNAME=sandbox

Send SMS

Send single SMS message

Test SMS

Test SMS integration

Environment Setup

Configure Africa’s Talking credentials

Build docs developers (and LLMs) love