> For the complete documentation index, see [llms.txt](https://lethium.gitbook.io/lethium-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lethium.gitbook.io/lethium-docs/gameplay/codes.md).

# Promo codes

Promo codes: create them in game or in the file, rewards, limits and expiry.

File: `plugins/ClickEmCore/modules/codes.yml`. Module id: `codes`. Commands: `/redeem <code>`, `/code`, `/codes`.

Each player can redeem a code **once**. Codes are **not case-sensitive** (stored in uppercase).

### A code

```yaml
codes:
  WELCOME:
    currency: 500
  LAUNCH2026:
    currency: 2500
    items:
      DIAMOND: 5
    commands:
      - "lp user %player% parent add launch2026"
    expires-at: "2026-12-31"
    max-redemptions: 500
redemption-counts: {}
```

| Key               | Meaning                                                                                                                     |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `currency`        | Coins (units scaled by progress). Optional.                                                                                 |
| `items`           | `MATERIAL: amount`. Optional.                                                                                               |
| `commands`        | Console commands run on every redemption, with `%player%` replaced. Good for giving a rank or a key through another plugin. |
| `expires-at`      | `yyyy-MM-dd`. The code stops working after that date (server time).                                                         |
| `max-redemptions` | Cap shared by all players. `0` or missing = unlimited.                                                                      |

`redemption-counts:` is written by the plugin. Do not edit it by hand. Delete a code's line to reset its counter.

### Managing codes in game (no file editing)

| Command                                                                | Use                                        |
| ---------------------------------------------------------------------- | ------------------------------------------ |
| `/ceadmin codes create <code> [currency] [maxRedemptions] [expiresAt]` | New code.                                  |
| `/ceadmin codes additem <code> <material> <amount>`                    | Add an item reward.                        |
| `/ceadmin codes addcommand <code> <command>`                           | Add a console command reward (`%player%`). |
| `/ceadmin codes delete <code>`                                         | Delete.                                    |
| `/ceadmin codes grant <player> <code>`                                 | Mark redeemed for a player.                |
| `/ceadmin codes revoke <player> <code>`                                | Mark not redeemed.                         |
| `/ceadmin codes reset <player>`                                        | Forget all of a player's redemptions.      |

### Ideas

* **Give a temporary rank:** `commands: ["lp user %player% permission settemp clickem.vip.mvp true 7d accumulate"]`
* **Give a crate key:** `commands: ["crates key give %player% starter 1"]`
* **Give gems:** `commands: ["clickem admin give %player% 50 gems"]`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://lethium.gitbook.io/lethium-docs/gameplay/codes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
