---
title: Get Fraud Detection Settings
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Fraud](https://developers.cloudflare.com/api/go/resources/fraud)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Get Fraud Detection Settings

client.Fraud.Get(ctx, query) (\*[FraudSettings](<https://developers.cloudflare.com/api/go/resources/fraud#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)>), error)

GET/zones/{zone\_id}/fraud\_detection/settings

Retrieve Fraud Detection settings for a zone.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



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

**Example:**<code>X-Auth-Email: user@example.com</code>

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

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Fraud Detection Read``Fraud Detection Write`

##### ParametersExpand Collapse

<details>

<summary>

query FraudGetParams

</summary>

ZoneID param.Field\[string]

Identifier.

maxLength32

<a href="#(resource)%20fraud%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20zone_id">Link to this property</a>

</details>

[Link to this property](<#(resource)%20fraud%20%3E%20(method)%20get%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type FraudSettings struct{…}

</summary>

<details>

<summary>

AuthenticationSettings FraudSettingsAuthenticationSettingsOptional

Configuration for classifying login authentication outcomes based on the origin response. Requires <code>user_profiles</code> to be enabled.

- Success and failure criteria are independently updatable — sending only <code>success_criteria</code> leaves failure codes untouched, and vice versa.
- Omit <code>authentication_settings</code> entirely to leave both unchanged.
- Status codes must not overlap between success and failure criteria.

</summary>

<details>

<summary>

FailureCriteria FraudSettingsAuthenticationSettingsFailureCriteriaOptional

Criterion for identifying failed login responses.

</summary>

Kind FraudSettingsAuthenticationSettingsFailureCriteriaKind

The type of criterion. Currently only <code>status_code</code> is supported.

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings%20%3E%20(property)%20failure_criteria%20%3E%20(property)%20kind">Link to this property</a>

StatusCodes \[]int64Optional

HTTP status codes to match against the origin response.

- Maximum of 10 codes per criterion.
- Each code must be a valid HTTP status code (100-599).
- Codes are deduplicated and sorted on save.
- Omit to leave unchanged on update.
- Provide an empty array <code>[]</code> to clear codes on update.

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings%20%3E%20(property)%20failure_criteria%20%3E%20(property)%20status_codes">Link to this property</a>

</details>

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings%20%3E%20(property)%20failure_criteria">Link to this property</a>

<details>

<summary>

SuccessCriteria FraudSettingsAuthenticationSettingsSuccessCriteriaOptional

Criterion for identifying successful login responses.

</summary>

Kind FraudSettingsAuthenticationSettingsSuccessCriteriaKind

The type of criterion. Currently only <code>status_code</code> is supported.

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings%20%3E%20(property)%20success_criteria%20%3E%20(property)%20kind">Link to this property</a>

StatusCodes \[]int64Optional

HTTP status codes to match against the origin response.

- Maximum of 10 codes per criterion.
- Each code must be a valid HTTP status code (100-599).
- Codes are deduplicated and sorted on save.
- Omit to leave unchanged on update.
- Provide an empty array <code>[]</code> to clear codes on update.

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings%20%3E%20(property)%20success_criteria%20%3E%20(property)%20status_codes">Link to this property</a>

</details>

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings%20%3E%20(property)%20success_criteria">Link to this property</a>

</details>

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20authentication_settings">Link to this property</a>

<details>

<summary>

UserProfiles FraudSettingsUserProfilesOptional

Whether Fraud User Profiles is enabled for the zone.

</summary>

One of the following:

const FraudSettingsUserProfilesEnabled FraudSettingsUserProfiles = "enabled"

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20user_profiles%20%3E%20(member)%200">Link to this property</a>

const FraudSettingsUserProfilesDisabled FraudSettingsUserProfiles = "disabled"

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20user_profiles%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20user_profiles">Link to this property</a>

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 <code>[]</code> to clear all expressions on update.
- Invalid expressions will result in a 10400 Bad Request with details in the <code>messages</code> array.

<a href="#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)%20%3E%20(property)%20username_expressions">Link to this property</a>

</details>

[Link to this property](<#(resource)%20fraud%20%3E%20(model)%20fraud_settings%20%3E%20(schema)>)

### Get Fraud Detection Settings

Go

HTTPTypeScriptPythonGoTerraform

```
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.AuthenticationSettings)
}
```

200 example

```
{
  "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": {
    "authentication_settings": {
      "failure_criteria": {
        "kind": "status_code",
        "status_codes": [
          200,
          201
        ]
      },
      "success_criteria": {
        "kind": "status_code",
        "status_codes": [
          200,
          201
        ]
      }
    },
    "user_profiles": "disabled",
    "username_expressions": [
      "http.request.body.form[\"username\"][0]",
      "lookup_json_string(http.request.body.raw, \"username\")"
    ]
  }
}
```

##### Returns Examples

200 example

```
{
  "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": {
    "authentication_settings": {
      "failure_criteria": {
        "kind": "status_code",
        "status_codes": [
          200,
          201
        ]
      },
      "success_criteria": {
        "kind": "status_code",
        "status_codes": [
          200,
          201
        ]
      }
    },
    "user_profiles": "disabled",
    "username_expressions": [
      "http.request.body.form[\"username\"][0]",
      "lookup_json_string(http.request.body.raw, \"username\")"
    ]
  }
}
```