Idempotency keys
A network can fail after Lurk got your request but before you got the answer. If you send it again, you do not want it counted twice. An idempotency key makes that safe: the same key means the same request.- An event carries it in the body, as
idempotency_key. Every other write carries it in theIdempotency-Keyheader. The SDKs do both for you. - The same key with the same request returns the first answer again, byte for byte, and changes nothing.
- The same key with a different request is
idempotency_conflict(409): a key names one request, so use a new key for a new request. - Keys are remembered for 30 days.
- A key in the
Idempotency-Keyheader, or in theidempotency_keyargument of an MCP tool, has the spaces, tabs and line breaks at its start and end dropped:kandkare the same key, and a key made only of them counts as no key (an operation that needs one answersvalidation_failed, “An idempotency key is required.”). A tab or line break inside the key is refused (validation_failed). A key in an event’s body (idempotency_keyofevents.send, over REST or MCP) is used exactly as sent, and a tab or line break anywhere in it is refused.
Date.now() or a random value made per attempt, which makes a retry look like a new request.
idempotencyKey in TypeScript, RequestOptions(idempotency_key=…) in Python), so a retry that comes from your own queue, hours later, is also safe.
What to retry
Every error says which side it is on: the SDKs have
isRetryable / is_retryable, and the body has a next_step. A retry loop that never gives up is a bug: stop after a few tries and keep the event to send later.
The SDKs already retry twice for you, with a jittered delay, on the cases marked Yes. A call that makes a secret shown once (a new API key, a new webhook endpoint) is not retried after a connection failure or server error, because a second call could make a second secret. It can be retried after 429, which refuses the call before anything changes. Cancelling a TypeScript call stops its retries.
An interrupted response is a body that stops before the end, after the headers arrived. The TypeScript and Python SDKs both treat it like a dropped connection: a read, or a write that carries a key, is retried with the same key and the same body, and a write without a key (such as one that makes a secret) fails with LurkConnectionError instead of being repeated. Because the API may already have done the work, an interrupted response on a write is exactly why the key must stay the same.
Limits
Lurk limits how fast one key and one project can call it, to keep everyone’s calls quick. The numbers are per minute.
Every answer carries
RateLimit-Policy and RateLimit, which say what the nearest limit is and how much is left. Past a limit the answer is 429 with Retry-After, in seconds, and the usual error body. Wait that long and retry with the same key. If you hit it often, spread requests out, or send one event per thing that happened and let rules do the rest.
Tracing
Send atraceparent header and Lurk joins your trace. Every answer carries request-id (also x-request-id): quote it to support and we can find the call.