Endpoint

POST https://sms.phones.inc/sms/cancel

Overview

Cancel an active number rental and refund the credits charged for it to your balance. A rental can only be cancelled while it is still active — once a verification code has been received, it can no longer be cancelled.

Request Body

transaction_id
string
required
The transaction ID returned by Rent Number.

Response

ok
boolean
true when the rental was cancelled and the charge refunded.

Errors

StatusErrorMeaning
400Transaction ID is missingNo transaction_id provided
400Transaction already cancelledThe rental was already cancelled
400Can't cancel a transaction that received a codeA code was already delivered
404Transaction not foundUnknown transaction (or it belongs to another account)
502Service temporarily unavailableUpstream failure — retry
curl -X POST https://sms.phones.inc/sms/cancel \
  -H "API-KEY: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"transaction_id": "txn_8f7e6d5c4b3a"}'
{
  "ok": true
}