Skip to content
Start here

Get Fraud Detection Settings

client.fraud.get(FraudGetParams { zone_id } params, RequestOptionsoptions?): FraudSettings { user_profiles, username_expressions }
GET/zones/{zone_id}/fraud_detection/settings

Retrieve Fraud Detection settings for a zone.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Fraud Detection ReadFraud Detection Write
ParametersExpand Collapse
params: FraudGetParams { zone_id }
zone_id: string

Identifier.

maxLength32
ReturnsExpand Collapse
FraudSettings { user_profiles, username_expressions }
user_profiles?: "enabled" | "disabled"

Whether Fraud User Profiles is enabled for the zone.

One of the following:
"enabled"
"disabled"
username_expressions?: Array<string>

List of expressions to detect usernames in write HTTP requests.

  • Maximum of 10 expressions.
  • Omit or set to null to leave unchanged on update.
  • Provide an empty array [] to clear all expressions on update.
  • Invalid expressions will result in a 10400 Bad Request with details in the messages array.

Get Fraud Detection Settings

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const fraudSettings = await client.fraud.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' });

console.log(fraudSettings.user_profiles);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "user_profiles": "disabled",
    "username_expressions": [
      "http.request.body.form[\"username\"][0]",
      "lookup_json_string(http.request.body.raw, \"username\")"
    ]
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "user_profiles": "disabled",
    "username_expressions": [
      "http.request.body.form[\"username\"][0]",
      "lookup_json_string(http.request.body.raw, \"username\")"
    ]
  }
}