Detect if a SIM Card Was Recently Swapped

Overview

SIM Swap Detection is used to confirm if a wireless carrier has recently (within 7 days) issued a new SIM to an existing account. This check is important as a legitimate user's account might be hijacked by an attacker and used for fraudulent activities.

Before you get started, sign up for a Vonage API account, if you haven't already.

Detecting SIM Swap Status

curl -X 'POST' \ 'https://api.nexmo.com/v2/ni' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic <token>' \ -d '{ "type": "phone", "phone": "447009000000", "insights": [ "sim_swap" ] }'

Be sure to replace the placeholder <token> in the snippet above with your Base64 encoded API key and secret, joined with a colon.

The SIM Swap request is a POST request with the insight type passed in as the request body.

Response interpretation

{
  "request_id": "3f92ed75-e624-4503-abbd-a93d6b442571",
  "type": "phone",
  "phone": {
    "phone": "16197363066",
    "carrier": "Google (Grand Central) - SVR",
    "type": "VOIP"
  },
  "sim_swap": {
    "status": "completed",
    "swapped": false
  }
}
  • Swapped: This returns true (Boolean) if the phone number in question has been swapped within the last 7 days.
  • Status: This reflects the current state of the request, with complete signifying the completion of the request.

Reference

Visit the API Reference to get a detailed understanding of the request above.