Security best practices
Keeping keys safe, preventing abuse and SMS pumping, and verifying correctly.
Keys
- Keys live only on your server, in environment variables. Never in browser code, mobile apps, Git, logs or error messages.
- Use test keys in development and CI; only production has the live key.
- One key per application; revoke a key on the dashboard as soon as it may have leaked.
Verify correctly
- Act only on
valid: truefrom your own server's call to/verify/check. Never trust a "verified" flag, a phone number or a verification id sent by the browser. - Keep
{ verification id, number }on the server (session, signed cookie or database) between send and check. - When the order or account is saved, compare its phone with the number you verified. Otherwise a customer can verify one number and submit another.
- Never log, store or display the code. Never send
test_codeto the browser, even in the sandbox.
Stop abuse and SMS pumping
Every code you send costs money, and public forms attract bots that trigger messages to random or premium numbers ("SMS pumping"). OTP.ps only sends to Palestinian mobiles and limits per number: one code every 30 seconds, 5 an hour and 10 a day; per account: 120 codes a minute (test and live keys are counted separately). Add your own layers:
- A per-IP and per-session limit on your send endpoint (e.g. 5 per 15 minutes).
- A CAPTCHA (or a similar check) on public forms before sending.
- Send only when it's needed: e.g. only for cash-on-delivery, only after the rest of the form is valid.
- Disable the send button while a request is in flight and for 30 seconds after; use an
Idempotency-Keyon retries. - Watch your balance and usage on the dashboard; a sudden jump means abuse.
Spending limits
Every live message counts against limits that stop a bug or an attack from draining your balance. Test keys spend nothing and have none.
| Limit | Set by | Where |
|---|---|---|
| Daily ceiling per account | OTP.ps (500 messages a day for new accounts, raised for trusted high-volume businesses) | Contact OTP.ps |
| Your daily limit | You | Dashboard → Settings → Spending limits |
| Your monthly limit | You | Dashboard → Settings → Spending limits |
| A key's daily limit | You, per key | Dashboard → API keys, when creating the key |
Days and months are in Palestine time. When a limit is reached, sends answer 429 spending_limit_reached with retry_after (seconds until it resets), nothing is charged, and the event appears in your activity log. Limits are counted atomically: parallel requests can't slip past them. GET /api/v1/limits shows them all with what is used.
Set your daily limit a little above your busiest real day; that alone stops most SMS pumping.
Activity log
The dashboard's Activity log lists sign-ins (and wrong passwords), keys created and revoked, settings and limit changes, limits reached, AI tools connected, and every change made by the OTP.ps team, with the time and IP address. If you see something you didn't do, change your password and revoke your keys.
Data
- Numbers are personal data: keep them only as long as needed, and show them masked where possible (the API's
tofield is already masked). - Use HTTPS everywhere, so the session that holds the pending verification is protected.