Skip to main content
You need a Lurk project and a key. Lurk is not open for self-sign-up yet: join the waitlist at 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:
2

Create the unit

Every unit a rule names must exist, even for a draft. Create Beans first:
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.
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.
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.
The SDKs are npm install @getlurk/sdk and pip install getlurk. More about them.
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:
Each line is a unit that changed and the balance after. Activity in the dashboard shows the same.
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.

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 says what to do.

Next

Write a rule

Say what an event is worth.

Test your code

A fake client with no network, and a test clock for Staging.

Hear back with webhooks

Signed, retried, safe to repeat.

Go live

Staging to Production, with a person’s yes.