API & Developers
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
| Reply | Meaning | Action |
|---|---|---|
| BAD_KEY | Missing or invalid API key | Check the key, remove spaces |
| IP_NOT_ALLOWED | Your server IP is not on the allowed list | Add the IP in API Access Control |
| ACCOUNT_BLOCKED | Account is suspended | Contact support |
| ACCOUNT_NOT_VERIFIED | Email or phone not completed yet | Finish 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. CallgetCurrencies.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.