LibOTP API Gateway · Developer reference

API Docs

Prepaid wallet billing. The script sends the key in a header. Responses are plain text. Same steps as the in-app API Gateway.

  1. After login, copy the key at /app/api.
  2. Every request puts that key in the header X-Api-Key.
  3. Do not add api_key to the URL. Opening the base URL in a browser does not call the API.
  4. Buy with getNumber. Read the OTP with getStatus. Cancel with setStatus and status=8.
live

Generate your key after login at /app/api. Keys are never shown on this public page.

Base URL

Method: GET. This is the API address. Do not open it in the browser. A browser click has no X-Api-Key header, so the API cannot run. Copy a curl example below and put your key in that header. action stays in the URL. Cancel uses action=setStatus&status=8.

Authentication

Send your key in the X-Api-Key header. Query params api_key, apiKey, and key are ignored. Invalid key → BAD_KEY.

GET

getBalance

Returns your wallet balance in INR.

Request


              
            

Response

ACCESS_BALANCE:123.45
GET

getCountries

Country list uses the same numeric ids as SMS India (22 = India, 187 = United States). ISO codes like IN still work as aliases.

Request


              
            

Response

22:India
187:United States
16:United Kingdom
…
GET

getServices

Short numeric service codes (e.g. 101, 248) — copy from the browse table. Only these codes work — old s1_* / name aliases are rejected.

Request


              
            

Browse codes

Live catalog. Left = country · Right = service with price & stock. Updates automatically when prices or services change.

Countries country=
Loading…
Code Country
Loading…
Services India · 22
Loading…
Code Name Price ₹ Stock
Loading…
GET

getPrices

Live prices for a country — same numbers as the table above. Plain text serviceCode:price. JSON uses cost for price and count for stock. Default country 22.

Request


                  
                

Response

101:16.08
248:12.50
512:24.06
…
GET

getNumber

Buy a temporary number. Debits the wallet. Each API number stays active for about 21 minutes.

Param Required Notes
service yes From getServices — short numeric code (e.g. 101).
country no Default 22 (India). Same numeric ids as SMS India.
operator no Optional opaque pin s1, s2, s3… These are operators on Server 01, not a second product server. If omitted, the API tries live operators cheapest-first. A raw operator number is rejected (WRONG_OPERATOR).
maxPrice no INR sell cap. Values of 1 or below are ignored (common script default).

Request


              
            

Response

ACCESS_NUMBER:<activationId>:<phoneDigits>
GET

getStatus

Poll for SMS / OTP. Call every 3–5 seconds.

Param Required Notes
id yes Activation id from getNumber

Request


              
            

Response

STATUS_WAIT_CODE
STATUS_OK:123456
STATUS_CANCEL
GET

setStatus

Cancel, finish, or request the next SMS. Cancel is instant when the provider accepts — no LibOTP wait timer. If the provider denies early cancel you get EARLY_CANCEL_DENIED immediately (retry when ready).

status Meaning
8 Cancel (refund when eligible)
6 Finish
3 Request next SMS

Request


              
            

Recommended flow

  1. getBalance — check wallet
  2. getNumber — parse ACCESS_NUMBER:id:phone
  3. Poll getStatus every 3–5s until STATUS_OK:code
  4. Optional: cancel with setStatus=8

API discount (if assigned by admin) applies automatically on getNumber.

Unable to connect at service provider

Some software shows this when the call never reaches a real API result. The API is working when getBalance returns plain text ACCESS_BALANCE: plus your balance.

Wrong URL

Use only https://libotp.online/api/gateway. The website home page is not the API. Do not paste another service provider's URL, and do not add ?api_key= on the end.

Missing or invalid key

Send the key only in the header X-Api-Key. A missing key, a cut-off key, extra spaces, or a rotated key returns BAD_KEY. Many apps show that as this connection error. Create or rotate the key at /app/api. api_key, apiKey, and key in the URL are ignored. A browser tab does not send the header, so it cannot prove the connection.

Wrong country or endpoint

Use country ids from getCountries, such as 22 (India) or 187 (USA). ISO aliases like IN also work. Use service codes from getServices / the browse table (short numbers like 101). Do not call /api/v1.

Firewall

The machine running the software must be allowed to open HTTPS to https://libotp.online on port 443. A firewall, VPN, or host that blocks outbound HTTPS shows the same error. If curl on your computer returns ACCESS_BALANCE: and the software does not, the block is on the software's network.

Mixing an old provider URL

Delete any URL saved for a previous service provider. Paste only https://libotp.online/api/gateway. Do not mix two provider addresses in one field. NO_BALANCE and NO_NUMBERS are not connection errors.

Common errors

Code Meaning
BAD_KEY Invalid or missing API key
NO_BALANCE Wallet too low
NO_NUMBERS No stock for that service/country
MAX_PRICE Sell price is above the maxPrice you sent
WRONG_SERVICE Unknown service code
WRONG_COUNTRY Unknown country code
EARLY_CANCEL_DENIED Provider refused cancel yet — retry the same id (no LibOTP wait)
ERROR_RATE_LIMIT:1 Over 100 req/s on that action group — wait 1s (HTTP 429)
DISABLED API access turned off by admin