Login required.

API Documentation

Server Overview

LegitSMS provides three activation servers so you can choose the best stock, pricing, and availability for each request.

Server IDDescriptionBest For
1Global / Huge Stock The lowest prices. Great for bulk accounts and common services.
2Premium / Expensive If Server 1 and Server 3 do not send a code, try premium numbers.
3Global / Huge Stock Massive inventory from 180+ countries. Useful as a backup when other servers are out of stock.

Base URL

https://api.legitsms.com/api/handler/?

Authentication

Every API request requires your API Key. You can find your API key in your LegitSMS account dashboard.

Parameter: api_key

API Rate Limits

LegitSMS uses action-specific rate limits. Different API actions have different limits based on their workload.

ActionRate Limit
getStatus1 request per second per activation ID
getPricesUp to approximately 4 requests per second
getCountries, getServices, getOperators Up to approximately 2 requests per second per action
getNumberUp to approximately 2 requests per second
setStatus1 request per second
createDeposit1 request every 10 seconds
getDepositStatus1 request per second per deposit
If the API returns HTTP 429 Too Many Requests, wait for the indicated period before retrying.

Automated API Deposits

API users can fund their LegitSMS balance programmatically without logging into the dashboard. A payment address is generated through the API and the wallet is credited automatically after payment confirmation.

Supported CurrencyUSDT
Supported NetworkBSC / BEP-20
Minimum Deposit$5.00
Minimum Monthly TurnoverNone

Deposit Flow

  1. Create a deposit using createDeposit.
  2. Receive a unique USDT BEP-20 payment address.
  3. Send the requested amount before the invoice expires.
  4. Monitor the payment using getDepositStatus.
  5. The LegitSMS wallet is credited automatically after confirmation.

Create Deposit

GET / POST createDeposit

Creates a new USDT BEP-20 deposit invoice and returns the payment address, deposit ID, status, and expiry time.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=createDeposit&amount=5&currency=USDT&network=BSC

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to createDeposit. Yes createDeposit
amount Deposit amount in USD. Minimum deposit is $5.00. Yes 5
currency Currently USDT only. Optional USDT
network BSC, BEP20 and BEP-20 are accepted. Optional BSC

Response Example

{
    "success": true,
    "deposit_id": "DEP_ABC123456789",
    "amount": "5.00",
    "currency": "USDT",
    "network": "BSC",
    "network_name": "BEP-20",
    "address": "0x...",
    "status": "pending",
    "created_at": "2026-10-14T21:23:44+00:00",
    "expires_at": "2026-10-14T22:23:44+00:00"
}
Rate limit: one createDeposit request every 10 seconds per API account.
Important: Send payment before expires_at. Always use BSC / BEP-20 for this deposit.

Check Deposit Status

GET / POST getDepositStatus

Returns the current payment and wallet-credit status for a deposit created using createDeposit.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getDepositStatus&deposit_id=DEP_ABC123456789

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getDepositStatus. Yes getDepositStatus
deposit_id The deposit ID returned by createDeposit. Yes DEP_ABC123456789

Response Example

{
    "success": true,
    "deposit_id": "DEP_ABC123456789",
    "status": "pending",
    "amount_requested": "5.00",
    "amount_received_usd": "0.00",
    "amount_credited": "0.00",
    "currency": "USDT",
    "network": "BSC",
    "network_name": "BEP-20",
    "address": "0x...",
    "txid": null,
    "transfer_id": null,
    "created_at": "2026-10-14T21:23:44+00:00",
    "paid_at": null,
    "credited_at": null,
    "expires_at": "2026-10-14T22:23:44+00:00"
}

Status Values

StatusMeaning
pending Deposit created and waiting for payment.
confirming Payment detected and wallet crediting is being finalized.
credited Payment confirmed and the LegitSMS wallet has been credited.
Rate limit: one getDepositStatus request per second per deposit.

Get Supported Countries

GET getCountries

Returns the available countries for the selected activation server. Country identifiers differ between servers.

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getCountries. Yes getCountries
server Activation server ID. Yes 1

Server 1

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getCountries&server=1

Use the returned id value when purchasing a number.

[
  {
    "id": 0,
    "rus": "Россия",
    "eng": "Russia",
    "chn": "俄罗斯",
    "visible": 1
  },
  {
    "id": 187,
    "rus": "США",
    "eng": "USA",
    "chn": "美国",
    "visible": 1
  }
]

Server 2

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getCountries&server=2

Use the returned uppercase ID value.

[
  {
    "ID": 1,
    "name": "United States",
    "short_name": "US",
    "cc": "1",
    "region": "North America"
  },
  {
    "ID": 2,
    "name": "United Kingdom",
    "short_name": "UK",
    "cc": "44",
    "region": "Europe"
  }
]

Server 3

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getCountries&server=3

Server 3 uses the country key/slug as the country parameter.

{
  "afghanistan": {
    "iso": { "af": 1 },
    "prefix": { "+93": 1 },
    "text_en": "Afghanistan",
    "text_ru": "Афганистан"
  },
  "usa": {
    "iso": { "us": 1 },
    "prefix": { "+1": 1 },
    "text_en": "USA",
    "text_ru": "США"
  }
}
Example for Server 3: to purchase an Afghanistan number, use country=afghanistan.

Get Supported Services

GET getServices

Returns the services available for activation. Each server uses a different service identifier.

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getServices. Yes getServices
server Activation server ID. Yes 1
country Required for Server 3. Conditional usa

Server 1

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getServices&server=1

Use the returned code value when purchasing.

{
  "status": "success",
  "services": [
    { "code": "wa", "name": "Whatsapp" },
    { "code": "ig", "name": "Instagram+Threads" },
    { "code": "go", "name": "Google,youtube,Gmail" }
  ]
}

Server 2

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getServices&server=2

Use the numeric uppercase ID.

[
  { "ID": 1, "name": "1688" },
  { "ID": 28, "name": "Airbnb" },
  { "ID": 39, "name": "Amazon" }
]

Server 3

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getServices&server=3&country=usa

Use the returned object key as the service name.

{
  "whatsapp": {
    "Category": "activation",
    "Qty": 450,
    "Price": 1.20
  },
  "amazon": {
    "Category": "activation",
    "Qty": 120,
    "Price": 0.50
  }
}

Quick Reference

ServerService IdentifierExample
1codeservice=wa
2IDservice=39
3Object keyservice=whatsapp

Check Prices & Stock

GET getPrices

Checks live inventory and the calculated price before purchasing a number.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getPrices&server=SERVER_ID&service=SERVICE_CODE&country=COUNTRY_ID

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getPrices. Yes getPrices
service Service identifier. Optional wa
country Country identifier. Optional 187
server Server to scan. Yes 1

Response Example

{
    "status": "SUCCESS",
    "server": 1,
    "service": "wa",
    "country": "187",
    "price": "5.00",
    "quantity": 526388
}

Bulk Price Dump

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getPrices&server=SERVER_ID

If service and country are omitted, the API returns the available catalog for that server.

Out of Stock Example

{
  "status": "ERROR",
  "message": "Out of stock or unavailable."
}

Buy a Number

GET getNumber

Purchases a new virtual number for the selected service, country, and server.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getNumber&service=SERVICE_CODE&country=COUNTRY_ID&server=SERVER_ID

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getNumber. Yes getNumber
service Service identifier for the selected server. Yes wa
country Country identifier for the selected server. Yes 187
server Server ID: 1, 2, or 3. Yes 1
max_price Maximum price you are willing to pay. Optional 0.20
operator Specific telecom/operator pool. Optional virtual21

Success Response

The API returns a plain-text response:

ACCESS_NUMBER:ORDER_ID:PHONE_NUMBER

Example:

ACCESS_NUMBER:12345678:15550199999
  • 12345678 is the order ID used with getStatus.
  • 15550199999 is the phone number.

Common Errors

NO_NUMBERS No numbers are currently available for the selected service/country.
NO_NUMBERS_INCREASE_MAX_PRICE No numbers are available under the requested max_price.
NO_BALANCE Wallet balance is insufficient.
BAD_SERVICE Invalid service identifier.

Get Available Operators

GET getOperators

Returns available telecom/operator pools that can be passed to the operator parameter of getNumber.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getOperators&country=187&server=1

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getOperators. Yes getOperators
country Country identifier. Yes 187
server Activation server. Yes 1

Carrier names should be lowercase with no spaces when passed into getNumber.

Examples

ServerExample Operators
1 tmobile, verizon, att, sprint, o2, vodafone, ee, three
3 tmobile, verizon, att, virtual, lycamobile, o2, vodafone

Check SMS Status

GET getStatus

Checks whether the SMS verification code has arrived for an activation order.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=getStatus&id=THE_ORDER_ID

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to getStatus. Yes getStatus
id Order ID returned by getNumber. Yes 12345678
ResponseMeaningAction
STATUS_WAIT_CODESMS has not arrived yet.Wait and retry.
STATUS_OK:XXXXXXSMS code received.Use the returned code.
STATUS_CANCELOrder expired or was cancelled.Stop checking.
Use a sensible polling delay instead of sending continuous requests.

Cancel or Activate

GET setStatus

Cancels/refunds an activation if no code was received, or marks an activation as complete.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=setStatus&id=ORDER_ID&status=STATUS_CODE

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to setStatus. Yes setStatus
id Activation order ID. Yes 12345678
status Status code to apply. Yes 8

Status Options

StatusAction
8 Cancel number and refund if no code was received.
6 Mark activation as complete.
You must wait at least 2 minutes after purchase before cancelling a number.

Example Workflow

A basic activation flow using the LegitSMS API.

Step 1: Check Price

GET /api/handler/?api_key=YOUR_API_KEY&action=getPrices&service=wa&country=187&server=1

Step 2: Buy a Number

GET /api/handler/?api_key=YOUR_API_KEY&action=getNumber&service=wa&country=187&server=1

Example: ACCESS_NUMBER:550011:13215551234

Step 3: Check for SMS

GET /api/handler/?api_key=YOUR_API_KEY&action=getStatus&id=550011

Waiting: STATUS_WAIT_CODE

Success: STATUS_OK:889922

Step 4: Cancel if Necessary

GET /api/handler/?api_key=YOUR_API_KEY&action=setStatus&status=8&id=550011

Successful cancellation: ACCESS_CANCEL

Event-Driven Webhooks

For high-speed automation, LegitSMS can push the SMS code to your webhook URL instead of requiring constant getStatus polling.

How to Setup

  1. Go to your Developer API Dashboard.
  2. Enter your server listening URL in the Webhook Setup field and save it.
  3. Order numbers normally and wait for the POST request from LegitSMS.

Webhook Payload

Content-Type: application/json

{
  "activationId": "84729104",
  "service": "wa",
  "phone": "1234567890",
  "code": "5555",
  "status": "STATUS_OK"
}

PHP Receiver Example

<?php
$json = file_get_contents("php://input");
$data = json_decode($json, true);

if ($data && isset($data["code"])) {
    $sms_code = $data["code"];
    http_response_code(200);
}
?>

Node.js / Express Example

app.post("/webhook", express.json(), (req, res) => {
    const { activationId, code } = req.body;

    if (code) {
        console.log(`Received code: ${code}`);
        res.status(200).send("OK");
    }
});

Rental API Overview

The Rental API allows you to rent phone numbers for extended periods, read incoming SMS messages, prolong active rentals, and manage rental orders programmatically.

Base URL

https://api.legitsms.com/api/rental/?

All rental API requests must include your api_key.

Check Rental Price

GET rentGetPrice

Fetches the live calculated price of a rental number before purchasing.

Request URL

https://api.legitsms.com/api/rental/?api_key=YOUR_API_KEY&action=rentGetPrice&country=UK&service=opt132&unit=week&time=1

Request Parameters

ParameterDescriptionRequired?Example
api_key Your account API key. Yes YOUR_API_KEY
country 2-letter country code. Yes UK
service Rental service code. Yes opt132
unit Duration type: week or month. Yes week
time Number of units. Yes 1

Response Example

{
    "status": "success",
    "data": {
        "service": "opt132",
        "country": "UK",
        "unit": "week",
        "time": 1,
        "price": "2.50"
    }
}

Rent a New Number

GET rentNumber

Purchases a new rental number. The cost is automatically deducted from your wallet balance.

Request URL

https://api.legitsms.com/api/rental/?api_key=YOUR_API_KEY&action=rentNumber&country=UK&service=opt132&unit=week&time=1

Request Parameters

ParameterDescriptionRequired?Example
api_key Your account API key. Yes YOUR_API_KEY
country 2-letter country code. Yes UK
service Rental service code. Yes opt132
unit Duration type: week or month. Yes week
time Number of units. Yes 1

Response Example

{
    "status": "success",
    "data": {
        "id": 915448,
        "number": "5491123456789",
        "cost": 2.5,
        "expires": "2026-04-09 15:30:00"
    }
}

Example Errors

{
  "status": "error",
  "message": "Insufficient wallet balance."
}
{
  "status": "error",
  "message": "Service out of stock."
}

Get SMS Inbox

GET rentGetStatus

Retrieves text messages sent to your rented number. If no message has arrived yet, the API returns a pending status.

Request URL

https://api.legitsms.com/api/rental/?api_key=YOUR_API_KEY&action=rentGetStatus&id=ORDER_ID

Request Parameters

ParameterDescriptionRequired?Example
api_key Your account API key. Yes YOUR_API_KEY
id Rental order ID. Yes 915448

SMS Received

{
  "status": "success",
  "messages": [
    {
      "sender": "Service",
      "text": "Code: 123456",
      "date": "2026-04-02"
    }
  ]
}

Waiting for SMS

{
  "status": "pending",
  "message": "WAITING_FOR_SMS"
}

Prolong a Rental

GET rentProlong

Extends the expiration date of an active rental. The extension cost is deducted automatically from your wallet.

Request URL

https://api.legitsms.com/api/rental/?api_key=YOUR_API_KEY&action=rentProlong&id=914104&unit=week&count=1

Request Parameters

ParameterDescriptionRequired?Example
id Rental order ID. Yes 914104
unit Duration type: week or month. Yes week
count Amount of time to add. Yes 1

Response Example

{
    "status": "success",
    "message": "PROLONGED",
    "cost": 1.82,
    "new_end_time": "2026-04-15 05:26:00"
}

Example Error

{
  "status": "error",
  "message": "PROVIDER_ERROR: Incorrect duration type. Available types: week, month"
}

Restore an Expired Number

GET rentRestore

Attempts to restore a recently expired or canceled rental if the provider still has the number available.

Request URL

https://api.legitsms.com/api/rental/?api_key=YOUR_API_KEY&action=rentRestore&id=ORDER_ID

Request Parameters

ParameterDescriptionRequired?Example
id Expired rental order ID. Yes 915448

Success Response

{
  "status": "success",
  "message": "RESTORED",
  "cost": 2.50
}

Error Example

{
  "status": "error",
  "message": "Time to restore has expired"
}

Complete List of Error Codes

Common error responses returned by the LegitSMS API.

Error CodeMeaningHow to Fix
BAD_KEYInvalid API Key.Check your API key.
ERROR_SQLServer error.Contact support.
NO_ACTIVATIONOrder ID not found.Check the order ID.
NO_BALANCEInsufficient funds.Fund your account.
NO_NUMBERSOut of stock.Try another server or country.
BAD_SERVICEInvalid service code.Check the service list.
ERROR_WAIT_2_MINUTESCancellation attempted too early.Wait until the 2-minute timer finishes.

Rental Reference Codes

Common country and service codes used by the Rental API.

Common Country Codes

United KingdomUK
United StatesUS
FranceFR
GermanyDE
SpainES
ItalyIT
CanadaCA
ArgentinaAR

Common Service Codes

Google / Gmailopt1
Facebookopt2
LinkedInopt8
Tinderopt9
Instagramopt16
WhatsAppopt20
Telegramopt29
X / Twitteropt41
OpenAI APIopt132
This is only a partial reference list. Use the available service/country listing endpoints when you need the current full catalog.

Full Rent API Overview

The Full Rent API lets an authenticated LegitSMS API customer check available full-rental countries and durations, rent a new number, retrieve its latest SMS status, and cancel or finish a rental. These actions use the public API handler and are separate from the legacy Rental API under /api/rental/.

Base URL

https://api.legitsms.com/api/handler/

Authentication

Include your LegitSMS API key as the api_key query parameter on every request. Keep the key private and do not expose it in public client-side code.

Available actions

ActionPurpose
fullRentGetPricesReturns available countries, durations, quantity, and retail prices.
fullRentNumberPurchases a Full Rent number and deducts the displayed price from the LegitSMS wallet.
fullRentGetStatusReturns the local rental state and the latest SMS status/message.
fullRentSetStatusCancels an eligible rental or finishes a rental after its purchased duration expires.

Important ID distinction

fullRentNumber returns a LegitSMS local rental id. Use that value in fullRentGetStatus and fullRentSetStatus. Do not substitute the phone number or the provider activation ID.

Currency and prices

Full Rent prices and wallet charges are returned in USD. Check prices immediately before purchasing because availability and pricing can change.

Feature scope

The public Full Rent API currently documents availability/prices, purchase, latest SMS status, cancellation, and finishing an expired rental. Rental extension endpoints are not yet available through the LegitSMS public API.

Get Full Rent Prices

GET fullRentGetPrices

Returns the Full Rent options currently available through LegitSMS. Each country contains duration tiers with current quantity and the customer-facing price in USD. You may request all available countries or filter the result to one country.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentGetPrices

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to fullRentGetPrices. Yes fullRentGetPrices
country_id Optional positive numeric country ID. If omitted, returns all available countries. Optional 6

Response Example

{
    "success": true,
    "currency": "USD",
    "countries": [
        {
            "country_id": 6,
            "country_name": "Example Country",
            "durations": [
                {
                    "duration_hours": 24,
                    "quantity": 123,
                    "price": "2.62",
                    "currency": "USD"
                },
                {
                    "duration_hours": 72,
                    "quantity": 42,
                    "price": "5.40",
                    "currency": "USD"
                }
            ]
        }
    ]
}

Example: Filter to one country

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentGetPrices&country_id=6

The quantity value indicates current availability for that duration. The price is the retail amount the customer pays, not the upstream provider cost.

Price/availability calls are rate-limited. Cache results briefly on your side and refresh before purchasing; do not assume a previously returned quantity or price is still available.

Rent a Full Rent Number

GET fullRentNumber

Purchases one Full Rent number for the selected country and duration in hours. LegitSMS rechecks the current tier and wallet balance, deducts the rental price, requests the number from the provider, and stores a local rental record. Use Get Full Rent Prices first to obtain valid country IDs, available durations, and current prices.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentNumber&country_id=6&duration=24

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to fullRentNumber. Yes fullRentNumber
country_id Positive numeric country ID returned by fullRentGetPrices. Yes 6
duration Rental duration in hours. Must match an available duration returned by fullRentGetPrices for the selected country. Yes 24
request_token Optional client-generated idempotency token containing 24–64 hexadecimal characters. Reuse the same token when retrying the same purchase attempt. If omitted, LegitSMS generates an internal token and repeated requests are treated as new purchase attempts. Optional 0123456789abcdef0123456789abcdef

Response Example

{
    "success": true,
    "data": {
        "id": 20,
        "phone_number": "15550199999",
        "country_id": 6,
        "country_name": "Example Country",
        "duration_hours": 24,
        "amount_paid": "2.62",
        "currency": "USD",
        "expires_at": "2026-10-29 10:10:37",
        "status": "active"
    }
}

Purchase guidance

  1. Call fullRentGetPrices and select an available country and duration.
  2. Send fullRentNumber with that country_id and duration.
  3. Save the returned local rental data.id. Use this ID for later status and cancellation/finish requests.
  4. Store the returned phone number and expiry time in your application.

Optional request_token

For robust client retries, generate a unique random hexadecimal token per intentional purchase and reuse it only when retrying that exact request. Without a client token, calling the purchase URL again can create another rental and another wallet charge.

Important: A PURCHASE_RESULT_UNKNOWN or PURCHASE_SAVE_REVIEW response means you must not automatically submit a fresh purchase. Follow the returned message and contact LegitSMS support when instructed.

Check Full Rent Status and SMS

GET fullRentGetStatus

Checks the local rental record and asks HeroSMS for the latest SMS available for the activation. The response includes the rental state, whether a message has been received, the latest message when present, the purchased duration, expiry time, amount paid, and currency. This endpoint returns the latest SMS exposed by the provider endpoint; it is not a complete historical inbox.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentGetStatus&id=20

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to fullRentGetStatus. Yes fullRentGetStatus
id The local rental ID returned as data.id by fullRentNumber. Do not use the phone number or provider activation ID. Yes 20

Response Example

{
    "success": true,
    "data": {
        "id": 20,
        "status": "active",
        "sms_received": false,
        "quantity": 0,
        "messages": [],
        "duration_hours": 24,
        "expires_at": "2026-10-29 10:10:37",
        "amount_paid": "2.62",
        "currency": "USD"
    }
}

When an SMS has arrived

{
  "success": true,
  "data": {
    "id": 20,
    "status": "active",
    "sms_received": true,
    "quantity": 1,
    "messages": [
      {
        "sender": "Service",
        "text": "Your verification code is 123456",
        "date": "2026-10-28T10:15:00.000000Z"
      }
    ],
    "duration_hours": 24,
    "expires_at": "2026-10-29 10:10:37",
    "amount_paid": "2.62",
    "currency": "USD"
  }
}

Important behavior

  • sms_received: false means the latest-status check did not find an SMS.
  • messages is an array and may be empty. When an SMS is found, the response includes the sender, message text, and date when available.
  • For a rental that is no longer active, the response may return its local status and rental details without the live quantity and messages fields.
Status checks are rate-limited per rental ID. Poll at a sensible interval rather than continuously. A STATUS_UNAVAILABLE response means the provider status could not be confirmed; do not interpret it as an empty inbox.

Cancel or Finish a Full Rent Rental

GET fullRentSetStatus

Applies an action to an existing Full Rent rental. Use status=8 to request cancellation and a wallet refund during the eligible cancellation window, or status=6 to finish a rental after its purchased duration has expired. Cancellation is only refunded after the provider confirms cancellation and the SMS check confirms that no message has arrived.

Request URL

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentSetStatus&id=20&status=8

Request Parameters

ParameterDescriptionRequired?Example
api_key Your LegitSMS API key. Yes YOUR_API_KEY
action Must be set to fullRentSetStatus. Yes fullRentSetStatus
id The local rental ID returned as data.id by fullRentNumber. Yes 20
status 8 requests cancellation and an eligible refund. 6 finishes the rental after its purchased duration expires. No other value is accepted. Yes 8

Status Values

StatusMeaning
8 Request cancellation. Refund is conditional on the eligible time window, confirmed empty inbox, confirmed provider cancellation, and successful wallet refund.
6 Finish the rental after the purchased duration has expired. No refund is issued by this action.

Cancel a rental (status=8)

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentSetStatus&id=20&status=8

The cancellation window opens 2 minutes after purchase and closes 20 minutes after purchase. Cancellation is blocked if an SMS has arrived or if the provider status cannot be confirmed. The wallet refund is issued only after HeroSMS confirms cancellation.

Successful cancellation response

{
  "success": true,
  "data": {
    "id": 20,
    "status": "cancelled",
    "refunded": true
  }
}

Finish an expired rental (status=6)

https://api.legitsms.com/api/handler/?api_key=YOUR_API_KEY&action=fullRentSetStatus&id=20&status=6

Status 6 is accepted only after the rental duration has expired. Finishing does not issue a cancellation refund.

Successful finish response

{
  "success": true,
  "data": {
    "id": 20,
    "status": "finished"
  }
}

Safe client behavior

  • Check the status before requesting cancellation.
  • If the response says SMS_STATUS_UNCONFIRMED, do not assume the inbox is empty and do not automatically retry cancellation.
  • If the response says CANCELLATION_RESULT_UNKNOWN, reuse the same local rental ID to reconcile the existing cancellation. Do not purchase another number to replace it automatically.
  • Do not request a cancellation refund after a message has arrived or after the 20-minute window has closed.
Never issue a client-side refund. The LegitSMS API manages the wallet refund. A failed or ambiguous cancellation response must be handled using its returned error and message.

Full Rent Errors and Rate Limits

Full Rent endpoints return JSON responses. When success is false, use the error code and message to decide whether the request can be corrected, retried, or requires support.

Common error responses

ErrorTypical meaningRecommended action
INVALID_PARAMETERSA required parameter is missing or invalid.Check action parameters and use a positive country ID, valid duration, local rental ID, and allowed status code.
INVALID_COUNTRY_IDThe country_id filter is not a positive integer.Use a country ID returned by fullRentGetPrices.
FULL_RENT_UNAVAILABLEThe Full Rent rental table/service is not ready.Retry later; contact support if persistent.
INVENTORY_UNAVAILABLECurrent provider inventory could not be verified.Request prices again later. Do not assume old prices are current.
NO_STOCK_OR_INVALID_TIERThe selected country/duration is unavailable or invalid.Fetch current prices and select an available duration.
INSUFFICIENT_BALANCEThe LegitSMS wallet does not cover the rental price.Fund the wallet, then submit a new intentional purchase.
PURCHASE_IN_PROGRESS / WALLET_BUSYA purchase or wallet operation is already in progress.Wait and check the existing rental before trying again.
REQUEST_PENDING_REVIEW / PURCHASE_RESULT_UNKNOWNThe purchase outcome needs reconciliation.Do not submit another purchase. Use the indicated rental ID and contact support if directed.
RENTAL_NOT_FOUNDThe local rental ID was not found for the authenticated account.Use the data.id value returned by fullRentNumber and the same API account.
STATUS_UNAVAILABLEThe latest SMS state could not be confirmed.Do not treat this as an empty inbox. Retry later at a sensible interval.
CANCEL_TOO_EARLYThe first 2 minutes after purchase have not elapsed.Wait until the cancellation window opens.
CANCEL_WINDOW_CLOSEDThe 20-minute cancellation window has ended.Cancellation/refund is no longer available through this action.
SMS_ALREADY_RECEIVEDThe rental has received a message.Cancellation for a refund is not available.
SMS_STATUS_UNCONFIRMEDThe API could not verify whether a message arrived.No cancellation/refund is processed; check status again later.
CANCELLATION_RESULT_UNKNOWNThe provider cancellation result was ambiguous.Use the same local rental ID to reconcile. Do not create a replacement rental automatically.
REFUND_PENDINGCancellation was recorded but the wallet refund needs review.Contact LegitSMS support. Do not request another refund manually.
RENTAL_NOT_EXPIREDThe rental duration has not yet elapsed.Wait until the purchased duration ends before status=6.

Rate limits

The main API handler also applies a global minimum interval of 2 seconds per client IP. This global limit can be more restrictive than the action-specific intervals below. Honor HTTP 429 Too Many Requests and the Retry-After header when present.

ActionLimiter in the current handler
fullRentGetPrices0.5-second interval per API-key/action bucket.
fullRentNumber1-second interval per API key, in addition to purchase/wallet locks.
fullRentGetStatus1-second interval per API key and local rental ID.
fullRentSetStatus1-second interval per API key and local rental ID.
The effective rate limit is the strictest applicable limit. The API handler may reject requests sooner when the global IP limiter or an action-specific limiter is reached. If the live handler limits change, update this reference to match the deployed code.

Full Rent Example Workflow

Example end-to-end flow for an API client managing one Full Rent rental.

Step 1 — Fetch available prices

GET /api/handler/?api_key=YOUR_API_KEY&action=fullRentGetPrices

Step 2 — Purchase one number

GET /api/handler/?api_key=YOUR_API_KEY&action=fullRentNumber&country_id=6&duration=24

Save the returned data.id as your local rental ID.

Step 3 — Check the latest SMS

GET /api/handler/?api_key=YOUR_API_KEY&action=fullRentGetStatus&id=20

Repeat at a sensible interval until an SMS arrives or the rental ends. Use the returned messages array when an SMS is available.

Step 4 — Cancel during the eligible window, if no SMS arrived

GET /api/handler/?api_key=YOUR_API_KEY&action=fullRentSetStatus&id=20&status=8

Cancellation is available from 2 minutes after purchase until before 20 minutes have elapsed, only when no SMS has arrived and the provider confirms cancellation.

Alternative — Finish after expiry

GET /api/handler/?api_key=YOUR_API_KEY&action=fullRentSetStatus&id=20&status=6

Use this only after the purchased rental duration has expired.

Confirm Purchase

Service:

Country:

Amount:

Scroll to Top
×
Service: ...
Country: ...
Operator:
Amount: $0.00
Quantity:
×

Confirm Purchase

Service: ...

Country: ...

...