Fraud Prevention API

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

Télécharger la spécification 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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Demande de renseignements Paramètres

name
string
exempleVodafone UK

Filter by network name

mcc
string
exemple234

Filter by Mobile Country Code (MCC)

country_code
string
exempleGB

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

plmn
string
exemple23401

Filter by public land mobile network (PLMN)

Réponses
Type de contenu
application/json

Successfully retrieved networks

networks
array
Exigée

List of networks

name
string
Exigée
exempleVodafone UK

Network name

mcc
string
Exigée
exemple234

Mobile Country Code

country_code
string
Exigée
exempleGB

Country code (ISO 3166-1 Alpha-2)

plmns
array
Exigée

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

_links
object
Exigée
self
object
Exigée
href
string
Exigée

URL to the resource

Exemple Réponse

{
   "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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Demande de renseignements Paramètres

product
string
exempleSMS

Find rules for a specific product

Il doit s'agir de l'un d'entre eux :SMSVOICE
mcc
string
exemple234

Find rules for a specific Mobile Country Code (MCC)

country_code
string
exempleGB

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

network_name
string
exempleVodafone UK

Find rules for a specific network name.

plmn
string
exemple23401

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

expire_start_date
string(date)
exemple2025-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)
exemple2025-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
exemple1d

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

Il doit s'agir de l'un d'entre eux :PERMANENT1d12h6h3h2h1h
sort
string
Défautcreated_at
exemplecreated_at

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

Il doit s'agir de l'un d'entre eux :productmcccountry_codenetwork_namecreated_atexpires_at
status
string
Défautactive
exempleactive

Filter by rule status (active or archived).

Il doit s'agir de l'un d'entre eux :activearchived
order
string
Défautdesc

Sort order (asc or desc)

Il doit s'agir de l'un d'entre eux :ascdesc
page
integer
Min1
Défaut1

Page number.

page_size
integer
Min1
Max100
Défaut10

Number of items per page

Réponses
Type de contenu
application/json

Successfully retrieved network rules

_embedded
object
Exigée
rules
array
Exigée
id
string(uuid)
Exigée
exemple3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Unique ID of the traffic rule

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
mcc
string
Exigée
exemple234

Mobile Country Code

network_name
string
Exigée
exempleVodafone UK

Network name

plmns
array
Exigée
reason
string
Exigée
exemplereason for blocks

Reason for the traffic rule action

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

ISO 8601 datetime string in UTC timezone

created_at
string(date-time)
Exigée
exemple2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

ttl
string
Exigée
exemple1d

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

Il doit s'agir de l'un d'entre eux :PERMANENT1d12h6h3h2h1h
archived_at
string(date-time)
exemple2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

_links
object
Exigée
next
object
href
string
Exigée

URL to the resource

prev
object
href
string
Exigée

URL to the resource

self
object
Exigée
href
string
Exigée

URL to the resource

page
integer
Exigée
Min1

Current page number

page_size
integer
Exigée
Min1

Number of items per page

total_items
integer
Exigée

Total number of elements across all pages

total_pages
integer
Exigée

Total number of pages

Exemple Réponse

{
   "_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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Corps de la demande
Type de contenu
application/json

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
plmn
string
Exigée
exemple23401

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

reason
string
Exigée
exemplereason for blocks

Reason for the traffic rule action

ttl
string
Exigée
exemple1d

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

Il doit s'agir de l'un d'entre eux :PERMANENT1d12h6h3h2h1h

Exemple Demande

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

Réponses
Type de contenu
application/json

Rule created

id
string(uuid)
Exigée
exemple3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Unique ID of the traffic rule

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
mcc
string
Exigée
exemple234

Mobile Country Code

network_name
string
Exigée
exempleVodafone UK

Network name

plmns
array
Exigée
reason
string
Exigée
exemplereason for blocks

Reason for the traffic rule action

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

ISO 8601 datetime string in UTC timezone

created_at
string(date-time)
Exigée
exemple2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

ttl
string
Exigée
exemple1d

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

Il doit s'agir de l'un d'entre eux :PERMANENT1d12h6h3h2h1h

Exemple Réponse

{
   "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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

id
string(uuid)
Exigée
exemple3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Corps de la demande
Type de contenu
application/json

reason
string
Exigée
exemplereason for blocks

Reason for the traffic rule action

Exemple Demande

{
   "reason": "reason for blocks"
}

Réponses
Type de contenu
application/json

Rule updated

id
string(uuid)
Exigée
exemple3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Unique ID of the traffic rule

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
mcc
string
Exigée
exemple234

Mobile Country Code

network_name
string
Exigée
exempleVodafone UK

Network name

plmns
array
Exigée
reason
string
Exigée
exemplereason for blocks

Reason for the traffic rule action

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

ISO 8601 datetime string in UTC timezone

created_at
string(date-time)
Exigée
exemple2025-07-01T10:11:22Z

ISO 8601 datetime string in UTC timezone

ttl
string
Exigée
exemple1d

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

Il doit s'agir de l'un d'entre eux :PERMANENT1d12h6h3h2h1h

Exemple Réponse

{
   "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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Trajectoire Paramètres

id
string(uuid)
Exigée
exemple3f8208fb-9aa3-4ea4-9a3f-de52a81e36bb

Réponses

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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Réponses
Type de contenu
application/json

A complete list of country-based traffic rules

rules
array
Exigée

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

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
country_code
string
Exigée
exempleGB

Country code (ISO 3166-1 Alpha-2)

_links
object
Exigée
self
object
Exigée
href
string
Exigée

URL to the resource

Exemple Réponse

{
   "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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Corps de la demande
Type de contenu
application/json

rules
array
Exigée

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

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
country_code
string
Exigée
exempleGB

Country code (ISO 3166-1 Alpha-2)

Exemple Demande

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

Réponses
Type de contenu
application/json

Successfully replaced country rules

rules
array
Exigée

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

product
string
Exigée
exempleSMS

Product type for the traffic rule

Il doit s'agir de l'un d'entre eux :SMSVOICE
country_code
string
Exigée
exempleGB

Country code (ISO 3166-1 Alpha-2)

Exemple Réponse

{
   "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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Réponses
Type de contenu
application/json

Successfully retrieved country data

countries
array
Exigée

Complete list of supported countries with their risk levels

country_code
string
Exigée
exemplePL

Country code (ISO 3166-1 Alpha-2)

continent
string
Exigée
exempleEU

Continent code to which the country belongs:

  • AF - Africa
  • AN - Antarctica
  • AS - Asia
  • EU - Europe
  • NA - North America
  • OC - Oceania
  • SA - South America
Il doit s'agir de l'un d'entre eux :AFANASEUNAOCSA
risk
string
DéfautNONE
exempleHIGH

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

Il doit s'agir de l'un d'entre eux :NONEHIGH
_links
object
Exigée
self
object
Exigée
href
string
Exigée

URL to the resource

Exemple Réponse

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

Erreurs

Voici une liste non exhaustive des codes d'erreur susceptibles de se produire lors de l'utilisation de cette API.

Ces codes s'ajoutent à ceux de notre site codes d'erreur génériques.

CodeInformations
http:error:conflict

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

system:error:internal-error

Something went wrong.