HTTP API

smpp-kafka-producer provides an HTTP/2 REST API for submitting SMS messages, compatible with 5G SMSF requirements.

Endpoints

Endpoint Method Description

/api/v1/sms

POST

Submit single SMS

/api/v1/sms/batch

POST

Submit batch SMS

/api/v1/sms/status

GET

Query message status

/health

GET

Health check

/health/live

GET

Kubernetes liveness

/health/ready

GET

Kubernetes readiness

/metrics

GET

Prometheus metrics

Submit SMS

Request

POST /api/v1/sms HTTP/2
Content-Type: application/json

{
  "source": "+12025551234",
  "destination": "+12025555678",
  "message": "Hello from HTTP API",
  "registeredDelivery": true
}

Response

{
  "messageId": "1a2b3c4d5e6f",
  "status": "accepted",
  "timestamp": "2024-01-15T10:30:00Z"
}

Fields

Field Type Required Description

source

string

Yes

Source address (sender)

destination

string

Yes

Destination address (recipient)

message

string

Yes

Message content

registeredDelivery

boolean

No

Request delivery receipt

validityPeriod

string

No

Message validity period

priority

integer

No

Priority (0-3)

Submit Batch

Request

POST /api/v1/sms/batch HTTP/2
Content-Type: application/json

{
  "messages": [
    {
      "source": "+12025551234",
      "destination": "+12025555678",
      "message": "Message 1"
    },
    {
      "source": "+12025551234",
      "destination": "+12025559999",
      "message": "Message 2"
    }
  ]
}

Response

{
  "accepted": 2,
  "rejected": 0,
  "results": [
    { "messageId": "1a2b3c4d5e6f", "status": "accepted" },
    { "messageId": "2b3c4d5e6f7g", "status": "accepted" }
  ]
}

Error Responses

400 Bad Request

{
  "error": "validation_error",
  "message": "Invalid destination address format",
  "field": "destination"
}

429 Too Many Requests

{
  "error": "rate_limited",
  "message": "Rate limit exceeded",
  "retryAfter": 60
}

503 Service Unavailable

{
  "error": "service_unavailable",
  "message": "Kafka broker not available"
}

cURL Examples

Send SMS

curl -X POST http://localhost:8080/api/v1/sms \
  -H "Content-Type: application/json" \
  -d '{
    "source": "+12025551234",
    "destination": "+12025555678",
    "message": "Hello World"
  }'

Check Health

curl http://localhost:8080/health

Get Metrics

curl http://localhost:9090/metrics