> ## 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.

# Quickstart

> Get a key, create a unit and a rule, take it live, send an event and read the receipt. About ten minutes.

You need a Lurk project and a key. Lurk is not open for self-sign-up yet: join the waitlist at [getlurk.com](https://getlurk.com) and we will invite you. Once you have an account, try this in a project meant for testing, not one with real users.

**1. Copy a project key**

In the dashboard, open **Developers → API keys** and make a key for your project. Only an owner or admin can make keys; ask one if you are not. It starts with `lurk_sk_` and is shown once. Keep it on your server, in an environment variable:

```bash theme={null}
export LURK_KEY=lurk_sk_…
```

**2. Create the unit**

Every unit a rule names must exist, even for a draft. Create Beans first:

```bash theme={null}
curl https://api.getlurk.com/v1/units \
  -H "Authorization: Bearer $LURK_KEY" \
  -H "Idempotency-Key: quickstart-unit-1" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Beans", "key": "beans", "group": "points" }'
```

```json theme={null}
{
  "id": "unit_01j9…",
  "key": "beans",
  "name": "Beans",
  "group": "points"
}
```

The answer also includes the unit's settings and statistics. If Beans already exists, use its key instead.

**3. Create a rule as a draft**

A rule says what an event is worth. This one gives 10 beans when someone checks in. A key can create a rule, but only as a draft: it runs nothing yet.

```bash theme={null}
curl https://api.getlurk.com/v1/rules \
  -H "Authorization: Bearer $LURK_KEY" \
  -H "Idempotency-Key: quickstart-rule-1" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Morning regular",
    "when": { "event": "checkin.scanned" },
    "do": [{ "unit": "beans", "add": 10 }]
  }'
```

```json theme={null}
{
  "id": "rule_01j9…",
  "key": "morning-regular",
  "name": "Morning regular",
  "status": "draft",
  "version": 1,
  "live_version": null,
  "definition": {
    "when": { "event": "checkin.scanned" },
    "if": [],
    "limit": [],
    "do": [{ "unit": "beans", "add": 10 }]
  }
}
```

**4. Preview it**

A preview replays the events Lurk has already seen through the rule and says what it would have given. Nothing is given. A new project has seen none, so the answer is empty. It still proves the rule is valid.

```bash theme={null}
curl https://api.getlurk.com/v1/rules/morning-regular/preview \
  -H "Authorization: Bearer $LURK_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json theme={null}
{
  "rule": "morning-regular",
  "version": 1,
  "events": 0,
  "users": 0,
  "receipts": 0,
  "given": [],
  "skipped": []
}
```

The answer has more fields, such as the period it looked at and notes on how to read it; this shows the main ones.

**5. Take it live (a person does this)**

Taking a rule live needs a person. An owner or admin opens **Rules** in the dashboard, opens the draft and clicks **Go live**. A key that tries (`POST /v1/rules/{id}/live`) gets `approval_required`, and so does an agent: it can propose the change and a person approves it. Until then the rule runs nothing.

**6. Send an event**

Say what the user did. Lurk runs your live rules on it. Use the way that suits you; they all make the same request.

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

```typescript TypeScript theme={null}
import { Lurk } from "@getlurk/sdk";

const lurk = new Lurk(); // reads the key from LURK_KEY

const receipt = await lurk.events.send({
  event: "checkin.scanned",
  user: "maya@example.com",
  properties: { venue: "mission-st" },
  idempotency_key: "chk-mission-st-maya-0812",
});

console.log(receipt.receipts);
```

```python Python theme={null}
from getlurk import Lurk

lurk = Lurk()  # reads the key from LURK_KEY

receipt = lurk.events.send(
    {
        "event": "checkin.scanned",
        "user": "maya@example.com",
        "properties": {"venue": "mission-st"},
        "idempotency_key": "chk-mission-st-maya-0812",
    }
)

print(receipt["receipts"])
```

The SDKs are `npm install @getlurk/sdk` and `pip install getlurk`. [More about them](https://docs.getlurk.com/sdks/overview.md).

```json theme={null}
{
  "activity": "act_01j9…",
  "user": "maya@example.com",
  "event": "checkin.scanned",
  "receipts": [{ "by": "rule:morning-regular", "unit": "beans", "change": 10, "balance": 10 }],
  "skipped": []
}
```

The answer lists what changed and the balance after. An empty `receipts` list with a reason in `skipped` is a normal answer: no rule applied, or a limit was reached. It is not an error.

**7. Read the receipt**

List the receipts for the person:

```bash theme={null}
curl "https://api.getlurk.com/v1/activity?user=maya@example.com" \
  -H "Authorization: Bearer $LURK_KEY"
```

```json theme={null}
{
  "data": [
    {
      "id": "act_01j9…",
      "at": "2026-11-07T09:12:00.000Z",
      "user": { "id": "usr_01j9…", "external_id": "maya@example.com" },
      "by": "rule:morning-regular",
      "event": { "id": "evt_01j9…", "name": "checkin.scanned" },
      "lines": [{ "unit": "beans", "change": 10, "balance": 10, "rule": "morning-regular" }]
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

Each line is a unit that changed and the balance after. Activity in the dashboard shows the same.

> [!NOTE]
>
> Send the same `idempotency_key` on a retry and Lurk counts the event once. The SDKs make one for you and reuse it when they retry. [How retries work](https://docs.getlurk.com/guides/idempotency-and-retries.md).

## Nothing happened?

* **`receipts` is empty and `skipped` is empty too.** No live rule listens for that event name. A rule starts as a draft until a person takes it live in the dashboard.
* **`approval_required` when you take a rule live.** A key cannot do that step. An owner or admin does it in the dashboard.
* **`invalid_key`.** The key is for another project, or was revoked. Staging and Production have different keys.
* **`validation_failed`.** `param` names the field. Event names are lowercase words joined by dots, the thing first.
* **Anything else.** [Every error](https://docs.getlurk.com/errors.md) says what to do.

## Next

> [card] [Write a rule](https://docs.getlurk.com/rules.md)
>
> Say what an event is worth.

> [card] [Test your code](https://docs.getlurk.com/sdks/testing.md)
>
> A fake client with no network, and a test clock for Staging.

> [card] [Hear back with webhooks](https://docs.getlurk.com/webhooks.md)
>
> Signed, retried, safe to repeat.

> [card] [Go live](https://docs.getlurk.com/guides/going-live.md)
>
> Staging to Production, with a person's yes.


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