Fraud Prevention API

The Fraud Prevention API is a set of APIs supporting Fraud detection including managing own fraud rules.

Descargar la especificación OpenAPI

Retrieves all networks

Returns a complete list of networks. Supports filtering by name, mcc, country code or PLMN. If both mcc and country_code are provided, mcc takes precedence.

gethttps://api.nexmo.com/v2/fraud-defender/networks

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Consulta Parámetros

name
string
ejemploVodafone UK

Filter by network name

mcc
string
ejemplo234

Filter by Mobile Country Code (MCC)

country_code
string
ejemploGB

Filter by ISO country code - alternative to MCC for identifying country

plmn
string
ejemplo23401

Filter by public land mobile network (PLMN)

Respuestas
Tipo de contenido
application/json

Successfully retrieved networks

networks
array
Requerido

List of networks

name
string
Requerido
ejemploVodafone UK

Network name

mcc
string
Requerido
ejemplo234

Mobile Country Code

country_code
string
Requerido
ejemploGB

Country code (ISO 3166-1 Alpha-2)

plmns
array
Requerido

List of all Public Land Mobile Network codes, including primary and all aliases

_links
object
Requerido
self
object
Requerido
href
string
Requerido

URL to the resource

Ejemplo Respuesta

{
   "networks": [
      {
         "name": "Vodafone UK",
         "mcc": "234",
         "country_code": "GB",
         "plmns": [
            "23401",
            "23402"
         ]
      }
   ],
   "_links": {
      "self": {
         "href": "string"
      }
   }
}

Retrieve all network traffic rules

Returns a paginated list of network rules. Network rules define blocking rules for specific mobile networks within countries.

gethttps://api.nexmo.com/v2/fraud-defender/rules/networks

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Consulta Parámetros

product
string
ejemploSMS

Find rules for a specific product

Debe ser uno de:SMSVOICE
mcc
string
ejemplo234

Find rules for a specific Mobile Country Code (MCC)

country_code
string
ejemploGB

Find rules for a specific ISO country code - alternative to MCC for identifying country

network_name
string
ejemploVodafone UK

Find rules for a specific network name.

plmn
string
ejemplo23401

Find rules for a specific public land mobile network (PLMN). Valid only with status=active, otherwise returns 400 error.

expire_start_date
string(date)
ejemplo2025-08-26

Find rules that expire on or after a specific date (YYYY-MM-DD) in UTC timezone. Valid only with status=active, otherwise returns 400 error.

expire_end_date
string(date)
ejemplo2025-08-26

Find rules that expire on or before a specific date (YYYY-MM-DD) in UTC timezone. Valid only with status=active, otherwise returns 400 error.

ttl
string
ejemplo1d

Find rules by time to live (TTL). Valid only with status=active, otherwise returns 400 error.

Debe ser uno de:PERMANENT1d12h6h3h2h1h
sort
string
Por defectocreated_at
ejemplocreated_at

Sort by field (product, mcc, country_code, network_name, created_at, expires_at)

Debe ser uno de:productmcccountry_codenetwork_namecreated_atexpires_at
status
string
Por defectoactive
ejemploactive

Filter by rule status (active or archived).

Debe ser uno de:activearchived
order
string
Por defectodesc

Sort order (asc or desc)

Debe ser uno de:ascdesc
page
integer
Min1
Por defecto1

Page number.

page_size
integer
Min1
Max100
Por defecto10

Number of items per page

Respuestas
Tipo de contenido
application/json

Successfully retrieved network rules

_embedded
object
Requerido
rules
array
Requerido
id
string(uuid)
Requerido
ejemplo3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Unique ID of the traffic rule

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
mcc
string
Requerido
ejemplo234

Mobile Country Code

network_name
string
Requerido
ejemploVodafone UK

Network name

plmns
array
Requerido
reason
string
Requerido
ejemploreason for blocks

Reason for the traffic rule action

expires_at
string(date-time)
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

created_at
string(date-time)
Requerido
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

ttl
string
Requerido
ejemplo1d

Time to live for the traffic rule. After this period, the rule will expire and no longer block traffic.

Debe ser uno de:PERMANENT1d12h6h3h2h1h
archived_at
string(date-time)
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

_links
object
Requerido
next
object
href
string
Requerido

URL to the resource

prev
object
href
string
Requerido

URL to the resource

self
object
Requerido
href
string
Requerido

URL to the resource

page
integer
Requerido
Min1

Current page number

page_size
integer
Requerido
Min1

Number of items per page

total_items
integer
Requerido

Total number of elements across all pages

total_pages
integer
Requerido

Total number of pages

Ejemplo Respuesta

{
   "_embedded": {
      "rules": [
         {
            "product": "SMS",
            "mcc": "234",
            "network_name": "Vodafone UK",
            "plmns": [
               "23477",
               "23491"
            ],
            "reason": "reason for blocks",
            "expires_at": "2025-08-01T10:11:22Z",
            "created_at": "2025-07-01T10:11:22Z",
            "ttl": "1d",
            "id": "3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb",
            "archived_at": "2025-07-01T10:11:22Z"
         }
      ]
   },
   "_links": {
      "next": {
         "href": "string"
      },
      "prev": {
         "href": "string"
      },
      "self": {
         "href": "string"
      }
   },
   "page": 1,
   "page_size": 1,
   "total_items": 0,
   "total_pages": 0
}

Create a new traffic rule for a network

posthttps://api.nexmo.com/v2/fraud-defender/rules/networks

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Cuerpo de la solicitud
Tipo de contenido
application/json

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
plmn
string
Requerido
ejemplo23401

Unique network identifier consisting of Mobile Country Code (MCC) and Mobile Network Code (MNC) with no separators in between

reason
string
Requerido
ejemploreason for blocks

Reason for the traffic rule action

ttl
string
Requerido
ejemplo1d

Time to live for the traffic rule. After this period, the rule will expire and no longer block traffic.

Debe ser uno de:PERMANENT1d12h6h3h2h1h

Ejemplo Solicitar

{
   "product": "SMS",
   "plmn": "23401",
   "reason": "reason for blocks",
   "ttl": "1d"
}

Respuestas
Tipo de contenido
application/json

Rule created

id
string(uuid)
Requerido
ejemplo3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Unique ID of the traffic rule

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
mcc
string
Requerido
ejemplo234

Mobile Country Code

network_name
string
Requerido
ejemploVodafone UK

Network name

plmns
array
Requerido
reason
string
Requerido
ejemploreason for blocks

Reason for the traffic rule action

expires_at
string(date-time)
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

created_at
string(date-time)
Requerido
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

ttl
string
Requerido
ejemplo1d

Time to live for the traffic rule. After this period, the rule will expire and no longer block traffic.

Debe ser uno de:PERMANENT1d12h6h3h2h1h

Ejemplo Respuesta

{
   "id": "3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb",
   "product": "SMS",
   "mcc": "234",
   "network_name": "Vodafone UK",
   "plmns": [
      "23401"
   ],
   "reason": "reason for blocks",
   "expires_at": "string",
   "created_at": "string",
   "ttl": "1d"
}

Update an existing network traffic rule

Updates the details of a specific network traffic rule identified by id. Only the reason for the rule can be modified.

patchhttps://api.nexmo.com/v2/fraud-defender/rules/networks/:id

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Ruta Parámetros

id
string(uuid)
Requerido
ejemplo3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Cuerpo de la solicitud
Tipo de contenido
application/json

reason
string
Requerido
ejemploreason for blocks

Reason for the traffic rule action

Ejemplo Solicitar

{
   "reason": "reason for blocks"
}

Respuestas
Tipo de contenido
application/json

Rule updated

id
string(uuid)
Requerido
ejemplo3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Unique ID of the traffic rule

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
mcc
string
Requerido
ejemplo234

Mobile Country Code

network_name
string
Requerido
ejemploVodafone UK

Network name

plmns
array
Requerido
reason
string
Requerido
ejemploreason for blocks

Reason for the traffic rule action

expires_at
string(date-time)
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

created_at
string(date-time)
Requerido
ejemplo2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

ttl
string
Requerido
ejemplo1d

Time to live for the traffic rule. After this period, the rule will expire and no longer block traffic.

Debe ser uno de:PERMANENT1d12h6h3h2h1h

Ejemplo Respuesta

{
   "id": "3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb",
   "product": "SMS",
   "mcc": "234",
   "network_name": "Vodafone UK",
   "plmns": [
      "23401"
   ],
   "reason": "reason for blocks",
   "expires_at": "string",
   "created_at": "string",
   "ttl": "1d"
}

Archive a network rule

Archives a specific network traffic rule identified by id. Archived rules become inactive and no longer block traffic. Still, a maximum of 50 archived rules remain accessible during 90 days for record-keeping and can be retrieved using the GET endpoint with the filter status=archived.

deletehttps://api.nexmo.com/v2/fraud-defender/rules/networks/:id

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Ruta Parámetros

id
string(uuid)
Requerido
ejemplo3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Respuestas

Rule archived (no content returned)

Retrieve all country traffic rules

Returns a complete list of country rules. Country rules define which country-product combinations should have their traffic blocked.

gethttps://api.nexmo.com/v2/fraud-defender/rules/countries

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Respuestas
Tipo de contenido
application/json

A complete list of country-based traffic rules

rules
array
Requerido

Complete list of country rules defining which country-product combinations should have their traffic blocked.

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
country_code
string
Requerido
ejemploGB

Country code (ISO 3166-1 Alpha-2)

_links
object
Requerido
self
object
Requerido
href
string
Requerido

URL to the resource

Ejemplo Respuesta

{
   "rules": [
      {
         "product": "SMS",
         "country_code": "PL"
      }
   ],
   "_links": {
      "self": {
         "href": "string"
      }
   }
}

Replace country rules

Replaces the country rules with the provided list. Country rules define which country-product combinations should have their traffic blocked. The rules array must always contain a complete list of rules - any existing rules not present in this request will be removed.

puthttps://api.nexmo.com/v2/fraud-defender/rules/countries

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Cuerpo de la solicitud
Tipo de contenido
application/json

rules
array
Requerido

Complete list of country rules which should block the traffic. Any existing rules not present in this array will be removed.

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
country_code
string
Requerido
ejemploGB

Country code (ISO 3166-1 Alpha-2)

Ejemplo Solicitar

{
   "rules": [
      {
         "product": "SMS",
         "country_code": "PL"
      }
   ]
}

Respuestas
Tipo de contenido
application/json

Successfully replaced country rules

rules
array
Requerido

Complete list of country rules defining which country-product combinations should have their traffic blocked.

product
string
Requerido
ejemploSMS

Product type for the traffic rule

Debe ser uno de:SMSVOICE
country_code
string
Requerido
ejemploGB

Country code (ISO 3166-1 Alpha-2)

Ejemplo Respuesta

{
   "rules": [
      {
         "product": "SMS",
         "country_code": "PL"
      }
   ]
}

Retrieve all supported countries

Retrieves all supported countries along with their risk levels for fraud detection.

gethttps://api.nexmo.com/v2/fraud-defender/countries

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Respuestas
Tipo de contenido
application/json

Successfully retrieved country data

countries
array
Requerido

Complete list of supported countries with their risk levels

country_code
string
Requerido
ejemploPL

Country code (ISO 3166-1 Alpha-2)

continent
string
Requerido
ejemploEU

Continent code to which the country belongs:

  • AF - Africa
  • AN - Antarctica
  • AS - Asia
  • EU - Europe
  • NA - North America
  • OC - Oceania
  • SA - South America
Debe ser uno de:AFANASEUNAOCSA
risk
string
Por defectoNONE
ejemploHIGH

Risk level for fraud detection. When not specified, defaults to NONE. Countries with HIGH risk will have their traffic blocked by default.

Debe ser uno de:NONEHIGH
_links
object
Requerido
self
object
Requerido
href
string
Requerido

URL to the resource

Ejemplo Respuesta

{
   "countries": [
      {
         "country_code": "ZM",
         "continent": "AF",
         "risk": "HIGH"
      }
   ],
   "_links": {
      "self": {
         "href": "string"
      }
   }
}

Errores

La siguiente es una lista no exhaustiva de códigos de error que pueden producirse al utilizar esta API.

Estos códigos se suman a cualquiera de nuestros códigos de error genéricos.

CódigoInformación
http:error:conflict

Rule couldn't be added as conflicts with currently existing rules

system:error:internal-error

Something went wrong.