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

> ## Agent Instructions
> Start with https://docs.scrip.dev/agents.md and https://docs.scrip.dev/which-endpoints-you-need.md. Your application only needs a few API calls as users earn and spend (`POST /v1/events`, balance/history reads, and redemptions); program setup happens in the dashboard or setup scripts.
> Use `https://api-sandbox.scrip.dev` with `sk_test_` keys for testing, and `https://api.scrip.dev` with `sk_live_` keys for production. Keep API keys on your server.
> Pass your own user ID as `external_id` on events and prefix it with `ext:` in participant URL paths (e.g., `GET /v1/participants/ext:user_123/balances`). By default (`on_unknown_participant: CREATE`), the first event for a new `external_id` creates and enrolls the participant automatically.
> Events process asynchronously: `POST /v1/events` returns `202 Accepted` when queued, and rules evaluate in the background. Pass an `idempotency_key` (such as an order ID) on every event, and wait for the `event.completed` webhook or poll `GET /v1/events/{event_id}` before reading updated balances.
> Connect the hosted MCP server at https://mcp.scrip.dev/mcp (OAuth, defaults to Sandbox) to inspect programs, validate and simulate rules, and trace events. Append `.md` to any docs URL for Markdown, or fetch https://docs.scrip.dev/openapi.json for full endpoint schemas.

# State definitions

> Organization-wide counter and tag metadata, badges, and rolling counter windows

State definitions describe the counters and tags used across your organization (`PARTICIPANT`, `GROUP`, or `PROGRAM` scope). Use them to attach display metadata (labels, descriptions, icons, and categories for customer-facing badges) and to declare rolling [counter windows](https://docs.scrip.dev/guides/state-management.md#counter-windows) used by rules and tiers.

## Endpoints

| Endpoint | Purpose |
| - | - |
| [List counter and tag definitions](https://docs.scrip.dev/api-reference/rules/list-state-definitions.md) | List counter and tag definitions across your organization, optionally filtered by `scope`, `kind`, or `category` |
| [Set a counter or tag's display fields](https://docs.scrip.dev/api-reference/rules/set-state-definition-display-fields.md) | Create or update display metadata (label, description, icon, category) for one counter or tag |

> [!NOTE]
>
> For counter windows, badges, and display fields, see [State management](https://docs.scrip.dev/guides/state-management.md#display-fields).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.