---
title: 'External rule'
description: 'This recipe explains the concept of an external rule, how to configure it with Snag and how to issue rewards to your users.'
keywords: ["external loyalty rules", "third-party rules", "custom rule integration", "API-driven rules"]
---

> **For AI agents:** the complete documentation index is at [llms.txt](https://docs.snagsolutions.io/llms.txt). Append `.md` to any page URL for its markdown version.

import FeedbackForm from '/snippets/FeedbackForm.mdx'
import AiAssistantCallout from '/snippets/ai-assistant-callout.mdx'

<AiAssistantCallout />

<Frame>
  <img
    src="https://assets.snagsolutions.io/public/docs/rules/external-rule.png"
    alt="External Rule"
  />
</Frame>

## What is an external loyalty rule?

You may wish to track user behaviour in contexts that Snag is unable to obtain a data source for (e.g. in a non-web/blockchain based game). For this and similar cases, Snag provides the concept of external rules.

An external rule is mostly the same as a standard loyalty rule and differs only in that it contains no built-in execution and evaluation logic.
Instead, this is done application-side (e.g. in-game) and, when a rewardable action is identified, Snag's [`POST /api/loyalty/rules/{id}/complete`](https://docs.snagsolutions.io/api-reference/loyalty/complete-loyalty-rule) endpoint can be hit.
This tells Snag that a given rule was completed by the given user(s) and issues the associated reward.
You can get more details on how to complete a rule in the [Submit and verify loyalty rule completion](https://docs.snagsolutions.io/loyalty/verifying-rule-completion) recipe.

The id returned in the response will be used to complete the rule when a user performs the required action.

## Evaluating external rules

Unlike built-in rules, the evaluation of external rules happens within your own system. This means you must track the user behavior (e.g., game milestones or external API interactions) and determine when a rule is completed.

Once a rewardable action is identified, you can programmatically notify Snag by completing the external rule using the API (see next step).

## How to issue points for users who complete an external rule

To issue points for a user who completes an external rule, use the [`POST /api/loyalty/rules/{id}/complete`](https://docs.snagsolutions.io/api-reference/loyalty/complete-loyalty-rule) endpoint. This endpoint informs Snag that the rule has been satisfied for a specific user and triggers the reward.
You can get more details on how to complete a rule in the [Submit and verify loyalty rule completion](https://docs.snagsolutions.io/loyalty/verifying-rule-completion) recipe.

Once the request is processed, Snag will issue the reward to the user based on the rule’s configuration.

## Summary Workflow

1. Create the External Rule: Use our admin dashboard to create the rule.

2. Track Behavior: Use your application to monitor user actions that meet the rule’s criteria.

3. Complete the Rule: When a user completes the action, submit the rule completion to Snag using the API, more details can be found in the [Submit and verify loyalty rule completion](https://docs.snagsolutions.io/loyalty/verifying-rule-completion) recipe.
