Documentation menu

Scheduling

Queue a message for later by adding one field, and cancel it any time before it sends.

Schedule a message

Add scheduledAt as an ISO 8601 timestamp. The message is reserved now and sent when it is due.

curl
curl https://api.sms.pesarails.com/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "254712345678",
    "sender": "PESARAILS",
    "message": "Reminder: your appointment is tomorrow at 10am",
    "scheduledAt": "2026-11-01T07:00:00Z"
  }'

The message comes back with status scheduled.

Note

Credit is reserved when you schedule, not when it sends, so a scheduled message cannot fail later for lack of funds. Cancel it and the credit is refunded.

Cancel a scheduled message

Delete it any time before it sends. Only messages still in scheduled state can be cancelled.

curl
curl -X DELETE https://api.sms.pesarails.com/v1/messages/a1b2c3 \
  -H "Authorization: Bearer YOUR_API_KEY"
200 OK
{
  "message": { "id": "a1b2c3", "status": "cancelled" }
}

Trying to cancel a message that has already sent returns 409 Conflict.