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

# Events

> Something a user did, with properties. Name it once, send it from anywhere. Rules decide what it changes.

An event says what a user did. You send it from your server when it happens; Lurk runs your live rules on it and answers with the receipts.

```bash theme={null}
curl https://api.getlurk.com/v1/events \
  -H "Authorization: Bearer $LURK_KEY" -H "Content-Type: application/json" \
  -d '{
    "event": "order.paid",
    "user": "maya@example.com",
    "properties": { "total_cents": 4200, "venue": "mission-st" },
    "idempotency_key": "order-8841"
  }'
```

| Field | What | Required |
| - | - | - |
| `event` | The name. Lowercase words, joined by dots, the thing first: `checkin.scanned`, `order.paid`, `signup.completed`. Letters, digits and underscores in each word, up to 100 characters, at least one dot. | yes |
| `user` | Your own identifier for the person, up to 256 characters. Lurk makes the person the first time. [People](https://docs.getlurk.com/guides/people.md) | yes |
| `idempotency_key` | Makes a retry safe. Build it from something stable, like the order ID. [Why](https://docs.getlurk.com/guides/idempotency-and-retries.md) | yes |
| `properties` | Flat facts about it, up to 50: strings (up to 1,024 characters), numbers, booleans, `null`, or short lists of those. | no |
| `timestamp` | When it happened, if not now: an ISO 8601 time with an offset. It can be in the past, so you can import history; an old event counts in the limit and budget windows of its own day, week or month. More than 5 minutes ahead of Lurk's clock is refused with `validation_failed`, so a future date cannot open a window early. | no |
| `profile` | What you know about the person (email, name, picture, handles), saved with the event, once. Rules do not read it and it is not kept with the event. [People](https://docs.getlurk.com/guides/people.md#a-persons-profile) | no |
| `alias` | Another identifier this person was known by, such as the visitor ID they had before signing in. Their history then reads that identifier's events too. A refused alias never refuses the event: `alias` in the answer says why. [Aliases](https://docs.getlurk.com/guides/people.md#aliases-who-a-visitor-was) | no |

Names are the contract between your app and your rules, so keep them and add new ones. A rule's `when` names the event it listens to, and an amount can come from a property (`{ "from": "total_cents", "per": 100 }`).

## The answer

```json theme={null}
{
  "activity": "act_01j9…",
  "user": "maya@example.com",
  "event": "order.paid",
  "receipts": [{ "by": "rule:earn-on-orders", "unit": "beans", "change": 42, "balance": 1292 }],
  "skipped": [],
  "held": []
}
```

* `receipts`: what changed, and the balance after, for each unit. [Activity](https://docs.getlurk.com/activity.md)
* `skipped`: the rules that did not apply, and why (a limit, a budget, a condition, a supply). Not an error.
* `held`: changes a rule parked for a person to give or refuse. Nothing has changed yet.
* `activity` is `null` when nothing changed.

A retry with the same `idempotency_key` returns the first answer and changes nothing; the same key with a different request is `idempotency_conflict`. [Idempotency](https://docs.getlurk.com/guides/idempotency-and-retries.md)

## The event catalog

An event nobody listens for is still recorded: it counts as heard, and shows up in `GET /v1/events/catalog` with how often it came in. That list holds every name sent in the last 30 days or listened for by a rule, in name order (`search` keeps the names that contain a part of one). It is how you (and an agent) find the names that are in use, and the ones no rule listens to yet. Lurk also defines names for chat events (`chat.checkin` and others, with `kind: "lurk"`); chat is not available yet, so Lurk itself sends none of them. Your own server may still send names that start with `chat.`; see [a rule says whose word it takes](https://docs.getlurk.com/rules.md#a-rule-says-whose-word-it-takes). Your own names have `kind: "own"`. Each event lists its property names and what each holds (`property_types`: `string`, `number`, `boolean`, `list`, never a value). `known_values` is a hint, never a rule: a rule may still use any value. The values of your own events are never listed unless you ask: see [Remember values](#remember-values) below. The dashboard's rule editor picks from this list: [Build a rule](https://docs.getlurk.com/dashboard/build-a-rule.md#pick-the-event).

## Remember values

When you write a rule on one of your own events, a typo in a value (`Pro` for `pro`) is a rule that never fires. So you can ask Lurk to remember the values of a property. It is off for every property, and you switch it on one property at a time, in the dashboard (Events, open an event, **Remember values**) (an owner or admin signed in; a key or an agent cannot).

* **What is kept.** Up to 20 different values of that property that your events carried in the last 30 days: text, numbers and true or false, at most 64 characters each. Nothing is kept for a property you did not switch on.
* **What is refused.** Lurk will not switch it on, and turns it off by itself later (deleting what it kept), if a value looks personal (an email address, a phone number, a link, a long code or free text), is longer than 64 characters, or there are more than 20 different values. Up to 100 properties are remembered once you turn them on; a project at 100 cannot turn on another. Pick properties like a plan, a tier or a venue, not an email, a coupon code or a name.
* **Where it shows.** The rule editor offers the values in a list (you can still type another; see [Build a rule](https://docs.getlurk.com/dashboard/build-a-rule.md#offer-a-propertys-values-in-a-list)), `GET /v1/events/catalog` sends them as `known_values` for that property, and Lurky and your agents read them there. `GET /v1/known-values` lists every property switched on (a key or an agent may read it), with its values, or with why it turned itself off.
* **Deleting.** Switching it off deletes the values. A value not seen for 30 days drops out by itself, and everything goes with the project. New values show up within about ten minutes.

## Good habits

* **Send one event per real thing that happened**, and let rules decide the value. "Order paid" is better than "give 42 Beans".
* **Send it once it is true**, from the place that knows (your payment confirmation), not from a screen.
* **Never send a secret as a property.** Properties are stored with the event.
* **Do not wait on a user's click for it.** Send events in the background and use the receipts when you can.


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