Free Numbers Pricing Reviews Feedback Terms & Policy API Docs Blog About
Log in Get Started
0 views 2 min read
Back to Blog
API & Developers

OtpGet API Error Codes: What Each Reply Means and How to Handle It

OtpGet API Error Codes: What Each Reply Means and How to Handle It

Good integrations are not the ones that never fail. They are the ones that fail clearly and recover correctly. OtpGet returns explicit error replies so your code can decide what to do. The SMS actions return them as plain text, so compare the raw reply body with the values below.

Authentication and account errors

ReplyMeaningAction
BAD_KEYMissing or invalid API keyCheck the key, remove spaces
IP_NOT_ALLOWEDYour server IP is not on the allowed listAdd the IP in API Access Control
ACCOUNT_BLOCKEDAccount is suspendedContact support
ACCOUNT_NOT_VERIFIEDEmail or phone not completed yetFinish the account details once

Request errors

  • BAD_COUNTRY, BAD_SERVICE, BAD_TYPE, BAD_ID, BAD_STATUS - a required value is missing or has no match. Re-fetch your lists and check the parameters.
  • BAD_CURRENCY - unsupported currency code. Call getCurrencies.
  • NO_SERVICE - that service does not exist for the server and country you asked for.

Purchase errors

  • NO_BALANCE - not enough funds. Show a recharge prompt.
  • NO_NUMBERS - nothing in stock right now. Try another server or country.
  • NO_BALANCE_FOR_NEW_PRICE - the live price rose above your balance while you were buying. The number is released and nothing is charged.

Status errors

  • NO_ACTIVATION - the order id does not exist for your account.
  • STATUS_ALREADY_CHANGED - the order was already finished or cancelled. Treat it as done and do not loop.

A simple handling pattern

reply = call_api(...)
if reply == "BAD_KEY":        alert_admin()
elif reply == "NO_BALANCE":   show_recharge()
elif reply == "NO_NUMBERS":   try_next_server()
elif reply.startswith("STATUS_OK:"): use_code(reply.split(":",1)[1])
else:                         log(reply)

Log every unknown reply together with the request that caused it. Unexpected text in your logs is the fastest way to find a bug.

Start building with OtpGet

Create a free account at otpget.com, copy your API key from the dashboard and open the API documentation. Our support team is available 24/7 if you get stuck.

Tags

#API error codes #BAD_KEY #NO_BALANCE #NO_NUMBERS #IP_NOT_ALLOWED #OtpGet API
Contact us