SIM swap detection
SIM swap detection API
A SIM swap API tells you whether the SIM card behind a phone number was recently replaced, so you can step up authentication or block a transaction before an account is taken over. The Telebase SIM swap detection API returns SWAPPED, NO_SWAP or UNKNOWN for a fixed 10-day window, with the time of the swap where the provider supplies it. Carrier, country, number type and number validity come back in the same call. This page covers what SIM swap detection is, what the API returns, how to integrate it and how to choose between providers.
What is SIM swap detection?
SIM swap detection is a check that tells you whether the SIM card behind a phone number was recently replaced. It matters because an attacker who moves a victim's number onto a SIM they control receives the victim's SMS codes. Run before a one-time password or a sensitive action, the check lets you step up authentication or block the action.
You send a phone number in E.164 format. The check returns whether the SIM associated with that number was replaced within a fixed window, using carrier network data. In Telebase the window is 240 hours (ten days), returned with every definite answer as simSwapPeriod: "PT240H". Where the provider supplies it, the response also carries the time of the swap in simSwapAt.
The three possible answers
| Answer | What it means | Charged |
|---|---|---|
SWAPPED | The SIM was replaced within the 240-hour window. | Yes, €0.20 |
NO_SWAP | No replacement was found within the 240-hour window. | Yes, €0.20 |
UNKNOWN | The provider gave no answer for that number. This is not evidence that no swap happened. | No |
Errors, invalid numbers and sandbox lookups are also free. Treat UNKNOWN as "signal unavailable" and fall back to your other risk signals.
What a SIM swap check does not tell you
- It does not say who holds the number or whether the person using it is the account owner.
- It is not a fraud verdict. People also swap SIMs for ordinary reasons such as a replacement SIM or a move to eSIM, so weigh the answer with other signals. How to read swap age covers this in detail.
- A null
simSwapAtdoes not imply NO_SWAP.
What the API returns
A single call to the Telebase lookup endpoint returns all available signals for the queried number. The SIM swap field is the headline signal for fraud and authentication use cases.
| Field | Type | Description |
|---|---|---|
simSwap | string | SWAPPED, NO_SWAP, or UNKNOWN. SWAPPED and NO_SWAP are definite answers for the fixed 10-day window. UNKNOWN means the provider had no answer and does not mean no swap. |
simSwapAt | string | null | ISO 8601 timestamp of the swap, present only when the provider sends it. Can be null. |
simSwapPeriod | string | null | The window the answer covers, as an ISO 8601 duration: PT240H (10 days) for a definite answer, null when simSwap is UNKNOWN. |
active | boolean | null | true when the provider confirms the number's format is valid, otherwise null. Never false. |
carrier | string | null | The network operator currently serving the number. |
country | string | null | ISO 3166-1 alpha-2 country code. |
numberType | string | null | One of: mobile, landline, tollFree, premium. Null when it cannot be determined. VoIP and virtual numbers return null. |
Every field is defined in the response field reference.
Example call
GET https://app.telebase.io/v1/lookup?phone=%2B447700900002 Authorization: Bearer tb_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
{
"phoneNumber": "+447700900002",
"active": true,
"carrier": "Telebase Test Carrier",
"country": "GB",
"numberType": "mobile",
"simSwap": "NO_SWAP",
"simSwapAt": "2026-09-22T09:16:03.003Z",
"simSwapPeriod": "PT240H",
"_meta": { "environment": "test", "activeSource": "SYNTHETIC" },
"chargedCents": 0,
"currency": "EUR"
}
A free sandbox account returns simulated results with no funds or provider credentials. Three test numbers cover each outcome:
| Test number | Returns |
|---|---|
+447700900001 | SWAPPED |
+447700900002 | NO_SWAP |
+447700900003 | UNKNOWN |
How to integrate
- Send numbers in E.164 format; national formats are rejected. The leading
+must be URL-encoded as%2Bin the query string. - Authenticate with
Authorization: Bearer tb_test_.... Create your own API keys in your dashboard after sign-up: tb_test_ for the sandbox, tb_live_ for live access. - On a
200response, readsimSwapfirst. IfSWAPPED, a swap happened within the fixed 10-day window (simSwapPeriod). ReadsimSwapAtfor recency when it is present; it can benull. A recent swap shortly before authentication is the highest-risk scenario. - On
UNKNOWN, the signal is unavailable for that number. Do not treat it asNO_SWAP. Fall back to your other risk signals. - Errors return a JSON body with
errorandmessagefields, plus"chargedCents": 0on every error except 402 and 500. See the full error reference at telebase.io/skills-md.
Where to use it
- Before sending an SMS OTP, so a one-time code never reaches an attacker's SIM.
- Account takeover prevention, as a signal at login and password reset.
- Account recovery and phone number changes, before a code goes to a number you are about to trust.
- High-value transactions and crypto withdrawals, before funds move.
For the background on the attack itself, see SIM swap fraud explained for risk teams.
How to choose a SIM swap API
When comparing providers, ask the same six questions of each, and ask to see a real response for every outcome.
A SIM swap answer is only meaningful against a defined window. If it is shorter than your risk period you miss recent swaps; if it is longer you flag people who changed SIM months ago. Telebase covers a fixed 240-hour window and returns it as simSwapPeriod with every definite answer, so the window is stated in the data, not assumed.
This is the most important question. An API that returns a negative result when it simply has no data creates false confidence, and the fraud it misses is invisible. Telebase returns three states, and UNKNOWN is never a hidden NO_SWAP.
Ask whether failed, invalid and unanswerable requests are billed. Telebase charges €0.20 only for a definite SWAPPED or NO_SWAP answer, and each response reports the actual debit in chargedCents and currency, so billing can be checked call by call.
You should see real response shapes before any commercial conversation. A Telebase sandbox account is free, starts straight after sign-up and returns simulated results for the three test numbers above. Production access is approved before live keys are issued, with a prepaid balance, no annual commitment and no monthly fee.
Fraud decisions rarely rest on one field. Carrier, country, number type and number validity come back alongside the SIM swap answer at no extra charge. Number validity is a format check, not proof that a line is active or reachable.
If a fraud decision is made by code or by an agent, field definitions must be unambiguous. Telebase publishes a machine-readable manual at skills.md with every field, value and limit defined. Default limits are 200 lookups per key and 1,000 per account in any rolling 24 hours.
| Question | Telebase |
|---|---|
| Window covered | Fixed 240 hours, stated in every response |
| No swap vs no answer | NO_SWAP and UNKNOWN are separate |
| Billing on no answer | Not charged |
| Testing | Free sandbox, three test numbers |
| Same-call context | Carrier, country, number type, number validity |
| Contract | Documented in skills.md and the field reference |
To see how the check fits into a login flow, start with how to detect a SIM swap before sending an OTP.
Get sandbox access