> ## 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.

# Updating & reseting balances

> This recipe explains how to manually update user loyalty points balances (i.e. not as part of a rule completion or spend action; an example use-case is to reset all user point balances to 0).

<head>
  <script type="application/ld+json">
    {JSON.stringify({
            "@context": "https://schema.org",
            "@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": "Features", "item": "https://docs.snagsolutions.io/loyalty/updating-balances"},
              {"@type": "ListItem", "position": 4, "name": "Updating & reseting balances"}
            ]
          })}
  </script>
</head>

## Overview

In some cases, you may need to manually update loyalty point balances outside the context of automated rules or spend actions. For example:

* Resetting all user balances to zero.
* Crediting or debiting points manually for a specific promotion or adjustment.

Snag provides two approaches for handling this: a no-code solution via the admin dashboard and a programmatic solution using the API.

***

## Approaches

### Admin Dashboard (recommended)

We provide a no-code solution for this via the admin dashboard. Note: this approach supports up to 250,000 balance changes per CSV upload.

#### Steps:

1. Go to the admin dashboard: [https://admin.snagsolutions.io](https://admin.snagsolutions.io).
2. Navigate to the `Loyalty` page from the left-side menu.
3. Click `Update Balances` (this opens the modal for updating user balances and provides a CSV template for uploading balance changes).
4. Download and fill out the CSV template with the relevant balance changes.
5. Upload the completed CSV file in the modal.
6. Click `Add` to queue the balance changes. A rule will be created to represent the queued changes. If it does not appear immediately, refresh the page.
7. Verify execution:
   * Click the eye icon on the created rule.
   * Compare the `Rewards` count to the number of rows in your CSV file. If they match, execution is complete.

***

### API

For programmatic updates, use the endpoint to create a loyalty transaction and update balances.

#### Endpoint:

**Request Body:**

```json theme={null}
{
  "description": "An explanation for the manual balance adjustment",
  "loyaltyCurrencyId": "string",
  "entries": [
    {
      "walletAddress": "0x00",
      "direction": "debit",
      "amount": 0
    },
    {
      "walletAddress": "0x01",
      "direction": "credit",
      "amount": 100
    }
  ]
}
```

* `description`: Explanation for the adjustment (e.g., “Reset balances to zero”).
* `loyaltyCurrencyId`: The ID of the loyalty currency to update.
* `entries`: A list of transactions specifying:
  * `walletAddress`: The wallet of the user whose balance is being adjusted.
  * `direction`: Either credit to add points or debit to remove points.
  * `amount`: The number of points to credit or debit.

**Example Response:**

```json theme={null}
{
  "code": 200,
  "message": "Values updated successfully."
}
```

#### Steps

1. Prepare the JSON payload with your required adjustments.
2. Send a POST request to the endpoint with your payload.
3. Verify the response to ensure the transaction was processed successfully.

## Summary

For flexibility and simplicity:

* Use the Admin Dashboard for batch updates and non-technical workflows.
* Use the API for programmatic and highly customized updates.

Both approaches ensure your loyalty balances are kept up to date with minimal effort.

***

## Point Reset Options

Snag admins have access to a **Reset Balances** feature, which allows for resetting loyalty balances in different ways. This feature provides three reset options:

1. Reset all balances
   * Reset all user balances to zero
   * The currency itself, ledger data and existing rules remain unchanged
2. Reset all balances and ledger data
   * Resets all user balances to zero and resets the ledger data
   * The ledger reset is done by cloning the exisitng currency and all associated rules
3. Reset all balances, ledger data and rules
   * Reset all user balances to zero
   * Clones the currency and deletes all associated rules without recreating them

### Important Notes

* This feature is only available to **Snag admins**. If other users require access to this functionality, they should contact Snag support.
* Resetting balances cannot be undone, so proceed with cauting when using these options.
