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

# External rule

> This recipe explains the concept of an external rule, how to configure it with Snag and how to issue rewards to your users.

<head>
  <script type="application/ld+json">
    {JSON.stringify({
            "@context": "https://schema.org",
            "@graph": [
              {
                "@type": "TechArticle",
                "headline": "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.",
                "author": {"@type": "Organization", "name": "Snag Solutions", "url": "https://www.snagsolutions.io/"},
                "publisher": {"@type": "Organization", "name": "Snag Solutions", "url": "https://www.snagsolutions.io/", "logo": {"@type": "ImageObject", "url": "https://assets.snagsolutions.io/public/docs/snag-logo-dark-no-bg.svg"}},
                "mainEntityOfPage": "https://docs.snagsolutions.io/loyalty/external-rules"
              },
              {
                "@type": "BreadcrumbList",
                "itemListElement": [
                  {"@type": "ListItem", "position": 1, "name": "Home", "item": "https://docs.snagsolutions.io/welcome"},
                  {"@type": "ListItem", "position": 2, "name": "Loyalty", "item": "https://docs.snagsolutions.io/loyalty/loyalty-overview"},
                  {"@type": "ListItem", "position": 3, "name": "Loyalty rules", "item": "https://docs.snagsolutions.io/loyalty/available-loyalty-rules"},
                  {"@type": "ListItem", "position": 4, "name": "External rules"}
                ]
              }
            ]
          })}
  </script>
</head>

<Tip>
  **Using an AI coding assistant?** Connect Cursor, Claude, or Copilot to Snag Docs for context-aware help. [Learn how](/ai-coding-assistant).
</Tip>

<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](/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](/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](/loyalty/verifying-rule-completion) recipe.
