SMSOnline API Doc
  1. Manage phone numbers
SMSOnline API Doc
  • Preparation
  • FAQ
  • V3
    • Customer API
      • Payments
        • Cryptocurrency via Cryptomus
          • Create new payment
          • Get direct wallet
          • Get transaction status
        • Credit Card via Pay4bit
          • Create new payment
      • Favourites
        • Get favourite services
        • Toggle favourite status
      • Get Account Balance
      • Get invoices
      • Get Coupons
    • Phones API
      • Lookup API
        • Get service list by country and carrier
        • Get service detail by country and carrier
      • Inventory API
        • Get inventory
      • Order API
        • Order a number
        • Get order data
        • Change order status
      • Get Popular list
      • Get all available countries/carriers
    • Statistics API
      • Get statistics
  • V2(Deprecated)
    • Warning: V2 API is deprecated
    • Account
      • Get Balance
      • Make a top-up with crypto
      • (Get direct wallet address) Make a top-up with crypto
    • Lookup
      • Get Available Countries
      • Get Available Services
      • Get Service Details
      • Get the country stats with success rates
    • Manage phone numbers
      • Purchase Number
        POST
      • Return Number
        POST
      • Request Another SMS
        POST
      • Get Status of A Single Number
        GET
      • Get Bulk Status of Numbers With Conditions
        GET
  1. Manage phone numbers

Purchase Number

POST
https://api.smsonline.cloud/cs/purchase
Executes the purchase of a phone number for the specified country and service combination.
The purchase price will not exceed the amount specified by maximumPrice, and it may be lower depending on availability.
Hint:
If phone numbers are temporarily out of stock, a NO_NUMBERS error will be returned. However, numbers are typically restocked within a few minutes, so you can automatically retry the order after an interval of about 20–30 seconds.
There is no need to change the values of maximumPrice or Hash(m,n) when retrying the purchase.
If an Additional user action required error occurs, it usually means that the phone number price has been updated.
You can use the getServiceDetail endpoint again to retrieve the latest pricing information.
Typically, phone number prices are updated every 5 minutes based on demand.

Request

Body Params application/json
userId
string 
required
User Id linked to API key
key
string 
required
API key
country
string 
required
Country Code
service
string 
required
Service Code
maximumPrice
string 
required
Minimum Order Price provided by the Lookup API.
m
string 
required
Hash value (m) provided by the Lookup API.
n
string 
required
Hash value (n) provided by the Lookup API.
carrier
string 
required
Carrier Name, provided at /cs/getListByCountry
Example
{
    "userId": "string",
    "key": "string",
    "country": "string",
    "service": "string",
    "maximumPrice": "string",
    "m": "string",
    "n": "string",
    "carrier": "string"
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.smsonline.cloud/cs/purchase' \
--header 'Content-Type: application/json' \
--data-raw '{
    "userId": "string",
    "key": "string",
    "country": "string",
    "service": "string",
    "maximumPrice": "string",
    "m": "string",
    "n": "string",
    "carrier": "string"
}'

Responses

🟢200Success
application/json
If the request is completed successfully, a 200 response code is returned.
Body
error
boolean 
required
If the request fails, the status will be true.
orderId
string 
required
Order ID. It is required when you request refund / another SMS
phoneNumber
string 
required
E.164 Phone number that assigned to you
expiredAtUTC
string 
required
Estimated time to be expired
purchasePrice
number 
required
Actual paid amount to get the number
Example
{
    "error": false,
    "orderId": "17934774",
    "phoneNumber": "447508190549",
    "expiredAtUTC": "2025-02-15 16:40:27",
    "purchasePrice": 0.16
}
🟠401Unauthorized
🟠403Forbidden
🔴500Server Error
Modified at 2025-04-16 13:54:39
Previous
Get the country stats with success rates
Next
Return Number
Built with