POST/v1/sms/orders/:id/cancel

Cancel an order

Cancels a pending order before a code arrives and refunds it in full.

Required scope: sms.purchaseRate limit: 10 rps

Parameters

idstringrequired

The order ID.

Code samples

curl -X POST "https://samaprime.com/api/v1/sms/orders/smsord_01J8X9AABBCCDD/cancel" \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json"

Response

200
{
"data": {
"id": "ord_01J8X9AABBCCDD",
"status": "cancelled",
"refunded_usd": "0.8000"
},
"meta": {
"request_id": "req_abc123",
"timestamp": "2026-08-06T12:00:00Z"
}
}

Errors

StatusCode
404not_found

No order with this ID belongs to this user.

409already_finalized

The order already has a code, or is already in a terminal state.