> ## Documentation Index
> Fetch the complete documentation index at: https://docs.authsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Customizing rules with custom data points

> Learn how to create custom data points and integrate them into Authsignal rules to create intelligent, policy-driven authentication flows that respond to your unique security requirements

While Authsignal provides a powerful set of predefined data points to create rules with, you may find yourself wanting to create rules based on your own data.

In this guide we will explore how you can create your own custom data points within the rules builder.

Let's create a rule that will challenge a user when they attempt to withdraw funds over a certain amount.

## 1. Create the `withdrawFunds` action

* Create the `withdrawFunds` action
* Head to the **Rules** section and create a new rule called `Challenge large withdrawals`
* Set the **Outcome** to `CHALLENGE`

## 2. Create a custom data point

* In the **Conditions** section, click **Add feature**
* Click **Select feature**, then head to the **Custom** tab
* Click **Create data point** and choose **Action**.
* Fill in the **Name** and **Description** for the data point and choose **Type** as `Number`.

<Frame>
  <img src="https://mintcdn.com/authsignal-23/U9XmxdPe4AWAeEuC/images/docs/actions-rules/create-custom-data.png?fit=max&auto=format&n=U9XmxdPe4AWAeEuC&q=85&s=ddd47390d8c9fa77221a18c0fda59e26" alt="Create custom data" width="1856" height="1162" data-path="images/docs/actions-rules/create-custom-data.png" />
</Frame>

<Info>
  The value you provide to the **Name** field dictates how it must be sent in the track action
  payload.
</Info>

* You should now see a new condition added to your rule. Now, change the operation from `==` to `>` and set the value to `2000`.

<Frame>
  <img src="https://mintcdn.com/authsignal-23/o0kRW78VfDNgNDjk/images/docs/learn/tracking-actions/using-custom-data/condition.png?fit=max&auto=format&n=o0kRW78VfDNgNDjk&q=85&s=7769ee841ec68d7b02e70d82088f40ed" alt="Condition" width="1012" height="494" data-path="images/docs/learn/tracking-actions/using-custom-data/condition.png" />
</Frame>

<Note>
  Any custom data point you create will be saved in the **Custom** section and available
  tenant-wide, i.e. you can use it in any of your actions and rules.
</Note>

<Frame>
  <img src="https://mintcdn.com/authsignal-23/o0kRW78VfDNgNDjk/images/docs/learn/tracking-actions/using-custom-data/custom-data-created.png?fit=max&auto=format&n=o0kRW78VfDNgNDjk&q=85&s=d4832d7b0db08d3ef57662ec3f47ba99" alt="Custom data created" width="910" height="379" data-path="images/docs/learn/tracking-actions/using-custom-data/custom-data-created.png" />
</Frame>

* Finally, click the **Save** button and return to the **Rules** page for your `withdrawFunds` action. You should see your new rule listed.
  <Frame>
    <img src="https://mintcdn.com/authsignal-23/o0kRW78VfDNgNDjk/images/docs/learn/tracking-actions/using-custom-data/rule-created.png?fit=max&auto=format&n=o0kRW78VfDNgNDjk&q=85&s=a3d440d0f2d1b1a063a40dd8ae9299b6" alt="Rule created" width="987" height="204" data-path="images/docs/learn/tracking-actions/using-custom-data/rule-created.png" />
  </Frame>

## 3. Send the custom data in your code

Now that the rule is created, you need to send the `withdrawalAmount` custom data point in the track action payload. When tracking actions, Authsignal allows you to send a `custom` object that contains your custom data points. For our `withdrawFunds` action this will look like:

<CodeGroup>
  ```ts Node.js {9-11} theme={null}
  const request = {
    userId: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
    action: "withdrawFunds",
    attributes: {
      deviceId: "555c17e1-3837-4f13-81bb-131e5597e168",
      userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
      ipAddress: "203.0.113.42",
      redirectUrl: "https://yourapp.com/callback",
      custom: {
        withdrawalAmount: 2001,
      },
    },
  };

  const response = await authsignal.track(request);
  ```

  ```csharp C# {9} theme={null}
  var request = new TrackRequest(
      UserId: user.Id,
      Action: "withdrawFunds",
      Attributes: new TrackAttributes(
          DeviceId: "555c17e1-3837-4f13-81bb-131e5597e168",
          UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
          IpAddress: "203.0.113.42",
          RedirectUrl: "https://yourapp.com/callback",
          Custom: new Dictionary<string, object> { { "withdrawalAmount", 2001 } }
      )
  );

  var response = await authsignal.Track(request);
  ```

  ```java Java {9-11} theme={null}
  TrackRequest request = new TrackRequest();
  request.userId = "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833";
  request.action = "withdrawFunds";
  request.attributes = new TrackAttributes();
  request.attributes.deviceId = "555c17e1-3837-4f13-81bb-131e5597e168";
  request.attributes.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";
  request.attributes.ipAddress = "203.0.113.42";
  request.attributes.redirectUrl = "https://yourapp.com/callback";
  request.attributes.custom = new HashMap<String, Object>() {{
      put("withdrawalAmount", 2001);
  }};

  TrackResponse response = authsignal.track(request).get();
  ```

  ```ruby Ruby {9-11} theme={null}
  response = Authsignal.track({
    user_id: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
    action: "withdrawFunds",
    attributes: {
      device_id: "555c17e1-3837-4f13-81bb-131e5597e168",
      user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
      ip_address: "203.0.113.42",
      redirect_url: "https://yourapp.com/callback",
      custom: {
        withdrawalAmount: 2001,
      },
    }
  })
  ```

  ```python Python {9-11} theme={null}
  response = authsignal.track(
      user_id="dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
      action="withdrawFunds",
      attributes={
          "device_id": "555c17e1-3837-4f13-81bb-131e5597e168",
          "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
          "ip_address": "203.0.113.42",
          "redirect_url": "https://yourapp.com/callback",
          "custom": {
              "withdrawalAmount": 2001,
          },
      }
  )
  ```

  ```php PHP {9-11} theme={null}
  $response = Authsignal::track([
      'userId' => "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
      'action' => "withdrawFunds",
      'attributes' => [
          'device_id' => "555c17e1-3837-4f13-81bb-131e5597e168",
          'user_agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
          'ip_address' => "203.0.113.42",
          'redirect_url' => "https://yourapp.com/callback",
          'custom' => [
              'withdrawalAmount' => 2001,
          ],
      ]
  ]);
  ```

  ```go Go {10-12} theme={null}
  response := client.Track(
      TrackRequest{
          UserId: "dc58c6dc-a1fd-4a4f-8e2f-846636dd4833",
          Action: "withdrawFunds",
          Attributes: &TrackAttributes{
              DeviceId: "555c17e1-3837-4f13-81bb-131e5597e168",
              UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
              IpAddress: "203.0.113.42",
              RedirectUrl: "https://yourapp.com/callback",
              Custom: map[string]interface{}{
                  "withdrawalAmount": 2001,
              },
          },
      },
  )
  ```
</CodeGroup>

That' it! Now when someone tries to withdraw more than \$2000, they'll be challenged. You can verify this worked by checking the Latest activity table in your dashboard.

<Frame>
  <img src="https://mintcdn.com/authsignal-23/o0kRW78VfDNgNDjk/images/docs/learn/tracking-actions/using-custom-data/action-details.png?fit=max&auto=format&n=o0kRW78VfDNgNDjk&q=85&s=55bda93c62cac6be760dfd4992f115e0" alt="Action details" width="1220" height="654" data-path="images/docs/learn/tracking-actions/using-custom-data/action-details.png" />
</Frame>

<Info>
  You can manage all your custom data points in one place at [Settings > Rules > Custom data points](https://portal.authsignal.com/organisations/tenants/custom_data_points) in the Authsignal Portal.
</Info>

## Public custom data points

For app verification methods like [push](/authentication-methods/app-verification/push) and [QR code](/authentication-methods/app-verification/qr-code), you often want the verifying device to display transaction context, such as the amount of a payment, so the user can make an informed decision before they approve or reject a challenge.

To surface a value on the device, mark its custom data point as public. This will make the value available on [getting push challenges](/authentication-methods/app-verification/push#getting-challenges) and [claiming QR code challenges](/authentication-methods/app-verification/qr-code#claiming-challenges).

<Frame>
  <img src="https://mintcdn.com/authsignal-23/K55WcllXqqKOagQD/images/docs/learn/tracking-actions/using-custom-data/public-toggle.png?fit=max&auto=format&n=K55WcllXqqKOagQD&q=85&s=864cb5d416f7b7cc2af1608a0b5e5195" alt="Condition" width="924" height="176" data-path="images/docs/learn/tracking-actions/using-custom-data/public-toggle.png" />
</Frame>
