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

# Rotation Rules

> Cycle through multiple secret values automatically to keep workflows fresh and secure.

# 🔁 Rotation Rules

Rotation rules let you define a single key with multiple values that Nota rotates on a schedule.\
Use them for expiring tokens, limited-use test accounts, promo codes, or any data that should change over time.

***

## Key Concepts

| Setting        | Description                                             | Example                                   |
| -------------- | ------------------------------------------------------- | ----------------------------------------- |
| **Key**        | The name you reference in workflows.                    | `API_KEY`, `QA_USER_EMAIL`                |
| **Values**     | A list of values Nota cycles through.                   | `["sk_test_a", "sk_test_b", "sk_test_c"]` |
| **Start Date** | When rotation begins; nothing rotates before this date. | `2025-06-01`                              |
| **Interval**   | How often Nota advances to the next value.              | Hourly, Daily, Weekly, Monthly, Custom    |

***

## Supported Intervals

| Interval    | When it advances                             |
| ----------- | -------------------------------------------- |
| **Hourly**  | At the top of each hour                      |
| **Daily**   | Every calendar day                           |
| **Weekly**  | Every 7 days                                 |
| **Monthly** | Same day each month                          |
| **Custom**  | Specify the number of days between rotations |

> 📅 **Start Date Matters:** Nota uses the start date as the anchor point when calculating which value should be active at runtime.

***

## Create or Edit a Rule

1. Go to **Settings → Rotation Rules**.
2. Click **➕ Add Rule** or select an existing rule to adjust.
3. Enter the **Key**, list of **Values**, **Start Date**, and **Interval**.
4. Save—Nota immediately begins serving the correct value based on the schedule.

***

## Bulk Upload via JSON

Upload multiple rules at once using a JSON file. Each rule follows this structure:

```json theme={null}
[
  {
    "key": "API_KEY",
    "values": ["sk_test_key_1", "sk_test_key_2", "sk_test_key_3"]
  },
  {
    "key": "EMAIL_ACCOUNT",
    "values": ["qa+user1@example.com", "qa+user2@example.com"]
  }
]
```

Review mappings before saving to avoid accidentally overwriting existing schedules.

***

## Real-World Example

<img src="https://mintcdn.com/notaai/xJ1WAvzVpMDznN3Q/images/rotation_rules.png?fit=max&auto=format&n=xJ1WAvzVpMDznN3Q&q=85&s=9a26028dba58d4e7b6a5b2ef646a1542" alt="Rotation rules configuration" width={1200} height={600} data-path="images/rotation_rules.png" />

This setup rotates an email API key every month starting June 1—perfect for credentials that expire or get rate-limited.

***

## Best Practices

* **Pair with Environment Variables:** Store the rotation key once, then consume it via environment variables in workflows.
* **Test ahead of time:** Use a closer start date in staging to validate behavior before mirroring in production.
* **Document ownership:** Note who maintains each rule so rotations stay coordinated with downstream systems.
