Skip to content
Start here

Get Fraud Detection Settings

client.Fraud.Get(ctx, query) (*FraudSettings, error)
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
query FraudGetParams
ZoneID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type FraudSettings struct{…}
UserProfiles FraudSettingsUserProfilesoptional

Whether Fraud User Profiles is enabled for the zone.

One of the following:
const FraudSettingsUserProfilesEnabled FraudSettingsUserProfiles = "enabled"
const FraudSettingsUserProfilesDisabled FraudSettingsUserProfiles = "disabled"
UsernameExpressions []stringoptional

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

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/fraud"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  fraudSettings, err := client.Fraud.Get(context.TODO(), fraud.FraudGetParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", fraudSettings.UserProfiles)
}
{
  "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\")"
    ]
  }
}