# Storelayer Documentation

Storelayer is an HTTP API for loyalty state and logic. Your backend sends customer events and carts; Storelayer evaluates your rules and promotions, keeps a wallet per customer, and tracks referrals. Everything lives inside a **project**, reached at `https://api.storelayer.io` with a project API key.

## You want to… start with…

| You want to… | Start with… | Important distinction |
| --- | --- | --- |
| Make your first API call | [Quick start](/getting-started/quick-start/) | Uses a project API key from the dashboard |
| Understand the building blocks | [Introduction](/getting-started/introduction/) | Event → rule → wallet; cart → promotion |
| Award points for purchases or signups | [Loyalty program guide](/guides/loyalty-program/) | Rules react to events asynchronously |
| Write rule or promotion conditions | [Conditions](/guides/conditions/) | Shared condition-group format |
| Discount a cart or redeem a coupon | [Creating promotions](/guides/creating-promotions/) | Cart money is integer minor units (cents) |
| Custom discount logic | [Discount scripts](/guides/discount-scripts/) | Script returns per-item discounts |
| Run a referral program | [Referral programs](/guides/referral-programs/) | Codes, attribution, completion |
| Read or adjust balances | [Wallets](/concepts/wallets/) | Balances are keyed by asset type |
| Debug why nothing happened | [Debugging](/guides/debugging/) and [Workflows](/guides/workflows/) | Each event produces an inspectable run |
| Let a coding agent build it | [Build with an agent](/getting-started/agents/) | Skill, Markdown docs, OpenAPI, MCP |

## Reference

- [API overview](/api/overview/) — conventions: envelope, errors, pagination, units.
- [Authentication](/getting-started/authentication/) — API keys vs dashboard tokens.
- [API reference](https://api.storelayer.io/docs) — every endpoint, generated from the live [OpenAPI document](https://api.storelayer.io/openapi.json).

## For coding agents

Read [/llms.txt](/llms.txt), then fetch only the pages your task needs. Every page has a Markdown version at `<path>.md` (this page: [/index.md](/index.md)). The [Storelayer skill](https://github.com/storelayer/skills/blob/main/skills/storelayer/SKILL.md) points agents at these docs.