For developers
Send an event. Get receipts back.
One POST for anything a user does. Your rules decide what it's worth, and the response says what changed and why.
Read the docsStart in a Staging project. Nothing there reaches real users.
POST https://api.getlurk.com/v1/events
Authorization: Bearer $LURK_KEY
{
"event": "habit.completed",
"user": "[email protected]",
"properties": {
"habit": "morning-run"
},
"idempotency_key": "run-maya-01"
}What happens to one event
Every write follows the same path: the event comes in, each live rule checks it, units change, and Activity keeps a receipt with the balance after.
- Eventin
habit.completeduser: [email protected] - Ruledecidesrule:daily-habit · before 10am, once a day
- Unitchanges+10balance: 1,250
- Receiptkeptact_01j9… by rule:daily-habit, points +10 → 1,250
Send events with curl, the SDK or MCP
curl, the TypeScript SDK, your agent over MCP, and what comes back out through webhooks. The same words everywhere.
curl https://api.getlurk.com/v1/events \
-H "Authorization: Bearer $LURK_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "habit.completed",
"user": "[email protected]",
"properties": { "habit": "morning-run" },
"idempotency_key": "run-maya-0812"
}'Use Lurk from any MCP agent
Any MCP client can read your project, write rules as drafts and preview them on real history. Going live always waits for a person, and every change carries the agent's name. Brand agents never give units by hand: rules give.
{}Sample data. The events and rules tools match the API reference.
Retries, webhooks and rate limits, built in
The parts you'd otherwise build yourself, and get wrong at 2am. Each one plays below.
Retries count once
Send the same
idempotency_keyand Lurk returns the first result. The same key with a different body is a conflict, never a second change.Signed webhooks
Every delivery carries
webhook-id,webhook-timestampandwebhook-signature(Standard Webhooks). Check it on the raw body before you trust it.Retries with backoff
Answer with any 2xx within 10 seconds. If you don't, Lurk tries again for about three days. An endpoint that fails 15 times in a row switches off, and says why.
One key per project
A key starts with
lurk_sk_and belongs to one project. Staging has its own users and rules, so nothing there reaches real people.Rate limits say how long
Past the limit you get
429 rate_limitedwith aRetry-Afterheader. A retry with the same key is safe.Errors that explain
Every error has a status, a code, a sentence you can show, the field it's about and a request ID to quote.
Views and SDKs
Read from your site, game or bot, and send from wherever your users are.
Views with endpoints
Save a question once, then read it from your backend for your site, game or bot.
Read about viewsTypeScript SDK
Typed errors, safe retries and idempotency keys built in.
Python SDK
The same calls as the TypeScript SDK, for Python backends.
The docs, for you and your agent
Short pages with real examples. Every page is also plain Markdown, and llms.txt lists them all for agents.
- QuickstartYour first event and receipt, in five minutes.
- EventsNaming, properties and idempotency.
- RulesWhen, if, limit and do.
- UnitsPoints, XP, badges, perks and their switches.
- ActivityReceipts, skips and undo.
- MCP serverPoint an agent at Lurk.
- Projects and keysStaging, Production and which key goes where.
- ErrorsEvery error code, in plain words.
- llms.txtThe docs as Markdown, for your agent.
The dashboard behind the API
The dashboard side of everything on this page.
Questions people ask
How do I identify a user?
Send whatever ID you already use, like an email or your own user ID. A visitor can start with a session ID.
What happens if I send the same event twice?
If both carry the same idempotency_key, Lurk counts it once and returns the first result. If the key is the same but the body is different, you get a 409 idempotency_conflict. Retries are always safe.
Can I test without touching real users?
Yes. Make a Staging project. It has its own users and keys, and nothing there reaches Production.
Which key goes where?
Server keys start with lurk_sk_ and stay on your backend. Agents use an agent key (lurk_ak_) from Developers → Agents.
How do I check that a webhook came from Lurk?
Every delivery has webhook-id, webhook-timestamp and webhook-signature headers (the Standard Webhooks scheme). Verify the signature on the raw body with your endpoint's secret, and reject a timestamp more than five minutes old. The SDK's constructEvent does both.
What happens when I hit a rate limit?
You get a 429 with the code rate_limited and a Retry-After header saying how long to wait. Retry with the same idempotency key and nothing is counted twice.
Can my agent take a rule live on its own?
No. Agents and keys get approval_required. A person on your team, an owner or admin, says yes before anything goes live.
Send your first event in five minutes
Make a Staging project, copy a key, and POST what your users do. The receipts come right back.